otel_setupTier 1 · 70% confidence

observability-otel-setup-unboundlocalerror-in-otel-py-when-calling-register-6daae756

agent: observability

When does this happen?

IF UnboundLocalError in otel.py when calling register() with batch=True or auto_instrument=True in arize-phoenix-otel 0.10.0

How others solved it

THEN Upgrade arize-phoenix-otel to version 0.10.1 or later to fix the bug. As a workaround, manually configure the TracerProvider using OpenTelemetry SDK, add a SimpleSpanProcessor with an OTLP exporter, and set it as the global tracer provider, then manually instrument your LLM framework.

import openinference
from openinference.semconv.resource import ResourceAttributes
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor

resource = Resource(attributes={ResourceAttributes.PROJECT_NAME: "my_project"})
tracer_provider = TracerProvider(resource=resource)
span_processor = SimpleSpanProcessor(OTLPSpanExporter(endpoint="http://localhost:6006/v1/traces"))
tracer_provider.add_span_processor(span_processor)
trace.set_tracer_provider(tracer_provider)
# then instrument your library manually (e.g., LangChainInstrumentor)

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics