- Overview
- Uploading large blobs from OpenInference
- Installation
- Quickstart
- Routing Traces to Different Arize Spaces and Projects
- Using Environment Variables
- Using OTel Primitives
- Questions?
- Copyright, Patent, and License
Overview
arize-otel provides Arize-aware OpenTelemetry defaults for instrumenting LLM
applications and exporting their traces to Arize.
Uploading large blobs from OpenInference
OpenInference instrumentors can capture images as base64-encoded span
attributes. arize-otel can upload oversized images to Arize and replace the
inline content with a lightweight arize:// reference. This avoids sending
large image payloads through the trace exporter while preserving the image in
Arize.
Blob uploading requires Python 3.10 or newer and
openinference-instrumentation>=0.1.56. Python 3.8 and 3.9 remain supported for
tracing without blob uploading.
For zero-code configuration, set the normal Arize tracing variables and select the registered uploader:
export ARIZE_API_KEY="..."
export ARIZE_SPACE_ID="..."
export ARIZE_PROJECT_NAME="my-project"
export OPENINFERENCE_BLOB_UPLOADER="arize"
Use OPENINFERENCE_BASE64_IMAGE_MAX_LENGTH to configure the maximum image data
URI length that OpenInference keeps inline.
You can also configure the uploader explicitly:
from arize.otel import ArizeBlobUploader
from openinference.instrumentation import TraceConfig
config = TraceConfig(blob_uploader=ArizeBlobUploader())
Uploads run in the background after a bounded one-second grant request. If a
grant cannot be obtained, OpenInference falls back to redacting the oversized
value. A failure after an arize:// reference has been emitted is logged but
cannot rewrite the exported span.
Use ARIZE_BLOB_ENDPOINT to override the blob upload endpoint independently of
ARIZE_COLLECTOR_ENDPOINT, such as for an on-prem deployment. The uploader also
honors set_routing_context(...) for applications that route traces dynamically
between spaces and projects.
Installation
Install arize-otel using pip
pip install arize-otel
Quickstart
The arize.otel module provides a high-level register function to configure OpenTelemetry tracing by returning a TracerProvider. The register function can also configure headers and whether or not to process spans one by one or by batch.
The following examples showcase how to use register to setup Opentelemetry in order to send traces to a collector. However, this is NOT the same as instrumenting your application. You can instrument installed OpenInference instrumentors automatically with auto_instrument=True, or manually call a specific instrumentor after register.
Automatically instrument installed OpenInference packages
Set auto_instrument=True to discover installed OpenInference instrumentors and call instrument(tracer_provider=...) for each one:
from arize.otel import register
tracer_provider = register(
space_id="your-arize-space-id",
api_key="your-arize-api-key",
project_name="your-model-id",
auto_instrument=True,
)
auto_instrument=True only instruments libraries with a corresponding OpenInference instrumentation package installed in your Python environment.
To instrument one library explicitly instead, run instrument() after using register:
from arize.otel import register
# Setup OTel via our convenience function
tracer_provider = register(
# See details in examples below...
)
# Instrument your application using OpenInference AutoInstrumentators
from openinference.instrumentation.openai import OpenAIInstrumentor
OpenAIInstrumentor().instrument(tracer_provider=tracer_provider)
The above code snippet will yield a fully setup and instrumented application. It is worth noting that this is completely optional. The usage of this package is for convenience only, you can set up OpenTelemetry and send traces to Arize without installing this or any other package from Arize.
In the following sections we have examples on how to use the register function:
Add pre-export span processors
Some OpenInference integrations, such as processor-style integrations that transform native OpenTelemetry spans into OpenInference attributes, expose a SpanProcessor instead of an instrument() method. Pass those processors to register(span_processors=[...]) so they run before the Arize exporter while register continues to configure Arize authentication headers, endpoint, transport, batching, and project metadata:
from arize.otel import register
from openinference.instrumentation.pydantic_ai import OpenInferenceSpanProcessor
tracer_provider = register(
space_id="your-arize-space-id",
api_key="your-arize-api-key",
project_name="your-model-id",
span_processors=[OpenInferenceSpanProcessor()],
)
Use span_processors for processors that enrich or transform spans before export. You do not need to create a separate Arize SpanExporter just to preserve Arize headers.
Send traces to Arize
To send traces to Arize you need to authenticate via the Space ID and API Key. You can find them in the Space Settings page in the Arize platform. In addition, you'll need to specify the project name, a unique name to identify your project in the Arize platform.
from arize.otel import register
tracer_provider = register(
space_id = "your-arize-space-id",
api_key = "your-arize-api-key",
project_name = "your-model-id",
)
If you are located in the European Union, you'll need to specify the corresponding Endpoint (the default endpoint is Endpoint.ARIZE):
from arize.otel import register, Endpoint
tracer_provider = register(
endpoint=Endpoint.ARIZE_EUROPE,
space_id = "your-arize-space-id",
api_key = "your-arize-api-key",
project_name = "your-model-id",
)
If you would like to configure your tracing using environment variables instead of passing arguments, read Using Environment Variables.
Send traces to Custom Endpoint
Sending traces to a collector on a custom endpoint is simple, you just need to provide the endpoint as a string. In addition, it is worth noting that the default is to use a GRPCSpanExporter. If you'd like to use a HTTPSpanExporter instead, specify the transport as shown below:
from arize.otel import register
tracer_provider = register(
endpoint = "https://my-custom-endpoint"
# any other options...
)
Specify exporter type
If you're using endpoints from the Endpoint enum, you do not need to do this, since we know what exporter to use. However, if you're using a custom endpoint, it is worth noting that the default is to use a GRPCSpanExporter. If you'd like to use a HTTPSpanExporter instead, specify the transport as shown below:
from arize.otel import register, Transport
tracer_provider = register(
endpoint = "https://my-custom-endpoint"
transport = Transport.HTTP,
# any other options...
)
Turn off batch processing of spans
We default to using BatchSpanProcessor from OpenTelemetry because it is non-blocking in case telemetry goes down. In contrast, "SimpleSpanProcessor processes spans as they are created." This can be helpful in development. You can use SimpleSpanProcessor with the option use_batch_processor=False.
from arize.otel import register
tracer_provider = register(
# other options...
batch=False
)
Debug
As you're setting up your tracing, it is helpful to print to console the spans created. You can achieve this by setting log_to_console=True.
from arize.otel import register
tracer_provider = register(
# other options...
log_to_console=True
)
Routing Traces to Different Arize Spaces and Projects
The register_with_routing function enables dynamic routing of traces to different Arize spaces and projects. This is useful when you need to route traces from a single application to multiple Arize spaces (e.g., based on the team or service generating the request).
Usage
First, set up the tracer provider with routing enabled via register_with_routing. Note that unlike the standard register() function, you don't need to specify a single space_id or project_name upfront.
Then, call with set_routing_context() to set the space id and project to which traces should be routed. The set_routing_context() context manager uses OpenTelemetry's context API to set routing attributes that automatically propagate to all child spans within that context. This works seamlessly with auto-instrumentors (OpenAI, LangChain, LlamaIndex, etc.) because the routing attributes are inherited by all spans created within the context.
from arize.otel import register_with_routing, set_routing_context
from openinference.instrumentation.openai import OpenAIInstrumentor
tracer_provider = register_with_routing(
api_key="your-arize-api-key",
# endpoint and transport are optional and default to Arize's GRPC endpoint
)
OpenAIInstrumentor().instrument(tracer_provider=tracer_provider)
current_project_id = "project-123"
current_space_id = "current-space"
# Both space_id and project_name must be provided for routing to work;
# otherwise, spans will be skipped and not sent to Arize
with set_routing_context(space_id=current_space_id, project_name=current_project_id):
# All OpenAI calls and spans within this context will be routed to the specified space and project
response = openai_client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Hello!"}]
)
# Traces automatically go to "current-space" with project name "project-123"
Performance Considerations
The routing processor creates a dedicated span processor (with its own exporter) for each unique space_id encountered. These processors are cached in memory for the lifetime of the application. If your application routes to many different spaces (e.g., hundreds or thousands), memory usage will grow accordingly.
Using Environment Variables
register and the tracing constructors read environment defaults when called. Set or update
environment variables after importing the package and before constructing a provider or exporter.
Omitting an environment-backed argument, or passing None, uses the current environment value.
Existing providers and exporters retain their original configuration.
from arize.otel import register
tracer_provider = register()
| Argument | Environment variable | Default when unset |
|---|---|---|
space_id |
ARIZE_SPACE_ID |
Required |
api_key |
ARIZE_API_KEY |
Required |
project_name |
ARIZE_PROJECT_NAME |
default |
project_type |
ARIZE_PROJECT_TYPE |
application |
endpoint |
ARIZE_COLLECTOR_ENDPOINT |
Endpoint.ARIZE |
register accepts application, harness, or experiment for project_type and sets it on the
provider resource as arize.project.type. Explicit arguments take precedence over environment
values. Empty strings are explicit values and fail validation; an unset or empty environment
endpoint uses Endpoint.ARIZE. Processors with a custom span_exporter do not require Arize
configuration.
Using OTel Primitives
For more granular tracing configuration, these wrappers can be used as drop-in replacements for OTel primitives:
from opentelemetry import trace as trace_api
from arize.otel import HTTPSpanExporter, TracerProvider, SimpleSpanProcessor
tracer_provider = TracerProvider()
span_exporter = HTTPSpanExporter(endpoint=...)
span_processor = SimpleSpanProcessor(span_exporter=span_exporter)
tracer_provider.add_span_processor(span_processor)
trace_api.set_tracer_provider(tracer_provider)
Wrappers have Arize-aware defaults to greatly simplify the OTel configuration process. A special
endpoint keyword argument can be passed to either a TracerProvider, SimpleSpanProcessor or
BatchSpanProcessor in order to automatically infer which SpanExporter to use to simplify setup.
Specifying the endpoint directly
from opentelemetry import trace as trace_api
from arize.otel import TracerProvider
tracer_provider = TracerProvider(endpoint="https://your-desired-endpoint.com")
trace_api.set_tracer_provider(tracer_provider)
Configuring resources
# export ARIZE_COLLECTOR_ENDPOINT=https://your-desired-endpoint.com
from opentelemetry import trace as trace_api
from arize.otel import Resource, PROJECT_NAME, TracerProvider
tracer_provider = TracerProvider(resource=Resource({PROJECT_NAME: "my-project"}))
trace_api.set_tracer_provider(tracer_provider)
Using a BatchSpanProcessor
# export ARIZE_COLLECTOR_ENDPOINT=https://your-desired-endpoint.com
from opentelemetry import trace as trace_api
from arize.otel import TracerProvider, BatchSpanProcessor
tracer_provider = TracerProvider()
batch_processor = BatchSpanProcessor()
tracer_provider.add_span_processor(batch_processor)
Specifying a custom GRPC endpoint
from opentelemetry import trace as trace_api
from arize.otel import TracerProvider, BatchSpanProcessor, GRPCSpanExporter
tracer_provider = TracerProvider()
batch_processor = BatchSpanProcessor(
span_exporter=GRPCSpanExporter(endpoint="https://your-desired-endpoint.com")
)
tracer_provider.add_span_processor(batch_processor)
Questions?
Find us in our Slack Community or email support@arize.com
Copyright, Patent, and License
Copyright 2024 Arize AI, Inc. All Rights Reserved.
This software is licensed under the terms of the 3-Clause BSD License. See LICENSE.
Metadata
Release files for arize-otel 0.14.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| arize_otel-0.14.1.tar.gz | 26.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| arize_otel-0.14.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.4 kB
Release files / arize_otel-0.14.1.tar.gz
| Download URL | arize_otel-0.14.1.tar.gz |
|---|---|
| Size | 26.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d609d35b21a2538307fe293a8193d876159d8f669cb76befee98f543db53875
|
|
BLAKE2b-256 checksum How to use checksums |
083e160341d23dc7e1bed7a491ce67d68e70b18524e8d9a12e349a6a1f285696
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logRelease files / arize_otel-0.14.1-py3-none-any.whl
| Download URL | arize_otel-0.14.1-py3-none-any.whl |
|---|---|
| Size | 29.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
055689c89364b80158a4088364422ce7a827d88ca465debf16e5de9c0720ed90
|
|
BLAKE2b-256 checksum How to use checksums |
64e8ef2603c30228a1061d32b8b7f1525e053a8834d501ce61ef990b19538086
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency log