nat.plugins.phoenix.mixin.phoenix_mixin#

Attributes#

Classes#

PhoenixMixin

Mixin for Phoenix exporters.

Module Contents#

logger#
class PhoenixMixin(*args, endpoint: str, project: str, **kwargs)#

Mixin for Phoenix exporters.

This mixin provides Phoenix-specific functionality for OpenTelemetry span exporters. It handles Phoenix project scoping and uses the HTTPSpanExporter from the phoenix.otel module.

Key Features: - Automatic Phoenix project name injection into resource attributes - Phoenix project scoping via using_project() context manager - Integration with Phoenix’s HTTPSpanExporter for telemetry transmission

This mixin is designed to be used with OtelSpanExporter as a base class:

Example:

class MyPhoenixExporter(OtelSpanExporter, PhoenixMixin):
    def __init__(self, endpoint, project, **kwargs):
        super().__init__(endpoint=endpoint, project=project, **kwargs)

Initialize the Phoenix exporter.

Args:

endpoint: Phoenix service endpoint URL. project: Phoenix project name for trace grouping.

_exporter#
_project#
async export_otel_spans(
spans: list[nat.plugins.opentelemetry.otel_span.OtelSpan],
) None#

Export a list of OtelSpans using the Phoenix exporter.

Args:

spans (list[OtelSpan]): The list of spans to export.

Raises:

Exception: If there’s an error during span export (logged but not re-raised).