Traces for AI apps: finding which LLM call is slow
I added OTel to a Python service that calls 3 LLM APIs (OpenAI, Anthropic, DeepSeek) in parallel. A trace showed: OpenAI took 800ms, Anthropic 1.2s, DeepSeek 400ms. The total request was gated by Anthropic at 1.2s. I switched the Anthropic call to a cheaper model and latency dropped to 800ms. Without traces, I would have guessed wrong about which API was the bottleneck.
Auto-instrumentation: 5 lines, no code changes
Python: `pip install opentelemetry-distro; opentelemetry-bootstrap -a install; opentelemetry-instrument python app.py`. This auto-instruments: HTTP requests (requests, urllib, aiohttp), databases (psycopg2, pymysql, pymongo), gRPC, Redis, Celery, and more. Flask/FastAPI/Django get automatic traces for every request handler. 90% of observability needs are covered by auto-instrumentation. Custom spans for LLM calls take 5 lines.
The OTLP protocol: send data anywhere
OTel uses the OTLP protocol (gRPC or HTTP) to export telemetry. Exporters exist for: Jaeger (traces), Prometheus (metrics), Grafana (all), Datadog (all), Honeycomb (all), and any OTLP-compatible backend. The protocol is vendor-neutral. You can switch from Jaeger to Grafana by changing the exporter URL. This avoids vendor lock-in for observability tools.
The cost of NOT having observability
Without traces: debugging a slow endpoint means reading logs, guessing which function is slow, adding print statements, redeploying, waiting for the issue to reproduce. With traces: open the trace, see the waterfall of spans, find the 300ms PostgreSQL query, optimize the index. The before scenario takes hours. The after takes minutes. For production systems, OTel pays for itself in the first incident.
OpenTelemetry vs Datadog APM vs Sentry
OTel: open standard, vendor-neutral, auto-instrumentation. Best for teams that own their infrastructure. Datadog APM: best UI, auto-correlation between traces and logs, expensive at scale. Best for teams that want managed observability. Sentry: error tracking with stack traces, not general observability. Best for debugging production errors.