nat.plugins.opentelemetry.mixin.otlp_span_exporter_mixin#
Attributes#
Classes#
Mixin for OTLP span exporters. |
Module Contents#
- logger#
- OTLPProtocol#
- class OTLPSpanExporterMixin(
- *args,
- endpoint: str,
- headers: dict[str, str] | None = None,
- protocol: OTLPProtocol = 'http',
- **kwargs,
Mixin for OTLP span exporters.
This mixin provides OTLP-specific functionality for OpenTelemetry span exporters. It handles OTLP protocol transmission using the standard OpenTelemetry OTLP exporters.
Key Features: - Standard OTLP HTTP and gRPC protocol support for span export - Configurable endpoint and headers for authentication/routing - Integration with OpenTelemetry’s OTLPSpanExporter for reliable transmission - Works with any OTLP-compatible collector or service
This mixin is designed to be used with OtelSpanExporter as a base class:
Example:
class MyOTLPExporter(OtelSpanExporter, OTLPSpanExporterMixin): def __init__(self, endpoint, headers, **kwargs): super().__init__(endpoint=endpoint, headers=headers, **kwargs)
Initialize the OTLP span exporter.
- Args:
endpoint: OTLP service endpoint URL. headers: HTTP headers for authentication and metadata. protocol: Transport protocol to use (‘http’ or ‘grpc’). Defaults to ‘http’.