Configure OTEL Tracer
When the register_otel
function does not offer enough customization for your needs, you can use the opentelemetry_sdk
to control how you send traces.
This snippet contains a few OTel concepts:
The header is an environment variable for authentication to send data.
A resource represents an origin (e.g., a particular service, or in this case, a project) from which your spans are emitted.
Span processors filter, batch, and perform operations on your spans prior to export. You can set multiple locations for exporting data, such as the console.
Your tracer provides a handle for you to create spans and add attributes in your application code.
The collector (e.g., Phoenix) receives the spans exported by your application.
The SimpleSpanProcessor is synchronous and blocking. Use the BatchSpanProcessor for non-blocking production application instrumentation.
Here is sample code to setup instrumentation using OpenTelemetry libraries before starting the OpenAI auto instrumentor from openinference.
Install the libraries
Customize your tracing below
Now start asking questions to your LLM app and watch the traces being collected by Arize. For more examples of editing your OTEL tracer, check our openinferenece-instrumentation-openai examples.
Last updated