praval.observability.export.otlp_exporter

OTLP (OpenTelemetry Protocol) HTTP exporter.

Sends traces to OTLP-compatible collectors like: - Jaeger - Zipkin - Honeycomb - DataDog - New Relic - etc.

Functions

export_traces_to_otlp(endpoint[, trace_ids, ...])

Export traces from local storage to OTLP endpoint.

Classes

OTLPExporter(endpoint[, headers])

OTLP HTTP exporter for sending traces to collectors.

class praval.observability.export.otlp_exporter.OTLPExporter(endpoint, headers=None)[source]

Bases: object

OTLP HTTP exporter for sending traces to collectors.

Parameters:
  • endpoint (str)

  • headers (Dict[str, str] | None)

__init__(endpoint, headers=None)[source]

Initialize OTLP exporter.

Parameters:
  • endpoint (str) – OTLP HTTP endpoint URL (e.g., “http://localhost:4318/v1/traces”)

  • headers (Optional[Dict[str, str]]) – Optional HTTP headers (e.g., API keys)

export_spans(spans)[source]

Export a batch of spans to the OTLP endpoint.

Parameters:

spans (List[Dict[str, Any]]) – List of span dictionaries

Return type:

bool

Returns:

True if export successful, False otherwise

praval.observability.export.otlp_exporter.export_traces_to_otlp(endpoint, trace_ids=None, limit=100, headers=None)[source]

Export traces from local storage to OTLP endpoint.

Parameters:
  • endpoint (str) – OTLP HTTP endpoint URL

  • trace_ids (Optional[List[str]]) – Optional list of specific trace IDs to export (None = recent traces)

  • limit (int) – Maximum number of traces to export (default: 100)

  • headers (Optional[Dict[str, str]]) – Optional HTTP headers

Return type:

bool

Returns:

True if export successful, False otherwise