-
PHOENIX_COLLECTOR_ENDPOINT -
PHOENIX_PROJECT_NAME -
PHOENIX_CLIENT_HEADERS -
PHOENIX_API_KEY -
PHOENIX_GRPC_PORT
Client Challenge
phoenix/packages/phoenix-otel/README.md at main · Arize-ai/phoenix
GitHub
Installation
Install viapip.
Examples
Thephoenix.otel module provides a high-level register function to configure OpenTelemetry tracing by setting a global TracerProvider. The register function can also configure headers and whether or not to process spans one by one or by batch.
Quickstart
register defaults to sending spans to an endpoint at http://localhost using gRPC.
Phoenix Authentication
If thePHOENIX_API_KEY environment variable is set, register will automatically add anauthorization header to each span payload.
Configuring the collector endpoint
There are two ways to configure the collector endpoint:- Using environment variables
-
Using the
endpointkeyword argument
PHOENIX_COLLECTOR_ENDPOINT environment variable, register will automatically try to send spans to your Phoenix server using gRPC.
endpoint directly
When passing in the endpoint argument, you must specify the fully qualified endpoint. For example, in order to export spans via HTTP to localhost, use Phoenix’s HTTP collector endpoint:http://localhost:6006/v1/traces. The default gRPC endpoint is different: http://localhost:4317. If the PHOENIX_GRPC_PORT environment variable is set, it will override the default gRPC port.
protocol argument can be used to enforce the OTLP transport protocol regardless of the endpoint specified. This might be useful in cases such as when the GRPC endpoint is bound to a different port than the default (4317). The valid protocols are: “http/protobuf”, and “grpc”.
Additional configuration
register can be configured with different keyword arguments:
-
project_name: The Phoenix project name (orPHOENIX_PROJECT_NAMEenv. var) -
headers: Headers to send along with each span payload (orPHOENIX_CLIENT_HEADERSenv. var) -
batch: Whether or not to process spans in batch
A drop-in replacement for OTel primitives
For more granular tracing configuration, these wrappers can be used as drop-in replacements for OTel primitives:endpoint keyword argument can be passed to either a TracerProvider, SimpleSpanProcessor orBatchSpanProcessor in order to automatically infer which SpanExporter to use to simplify setup.
Using environment variables
endpoint directly
Further examples
Users can gradually add OTel components as desired:Configuring resources
Using a BatchSpanProcessor
Specifying a custom GRPC endpoint
Passing TracerProvider kwargs
Bothregister() and TracerProvider accept all the same keyword arguments as the standard OpenTelemetry TracerProvider, allowing you to configure advanced features like custom ID generators, sampling, and span limits.

