OpenTelemetry
BothUnderstanding OpenTelemetry and how Traccia uses it.
OpenTelemetry (OTel) is an industry-standard, vendor-neutral observability framework. Traccia is built on top of OpenTelemetry, ensuring full compatibility with the broader ecosystem while adding AI-specific enhancements.
What is OpenTelemetry?
OpenTelemetry is a collection of APIs, SDKs, and tools for collecting telemetry data (traces, metrics, and logs) from applications. It's a CNCF graduated project with wide industry adoption.
Vendor-neutral
Works with any observability backend that supports OTLP
Three signals
Traces, metrics, and logs (Traccia focuses on traces)
Context propagation
W3C Trace Context standard for distributed tracing
Wide ecosystem
Auto-instrumentation for popular libraries and frameworks
How Traccia Builds on OpenTelemetry
Traccia extends the OpenTelemetry Python SDK with AI-specific features while maintaining full compatibility:
Standard OTel
- • TracerProvider and Tracer APIs
- • Span creation and management
- • Context propagation (W3C Trace Context)
- • OTLP/HTTP export protocol
- • Standard semantic conventions
Traccia Additions
- • Token counting processor (using tiktoken)
- • Cost calculation processor (with pricing tables)
- • Agent enrichment processor (session/user/tenant metadata)
- • Rate limiting span processor
- • Auto-instrumentation for OpenAI & Anthropic
- • @observe() decorator for easy instrumentation
- • Simplified init() API with config file support
Compatibility guarantee
OTLP Export Format
Traccia exports traces using the OpenTelemetry Protocol (OTLP) over HTTP. This is the standard format supported by all major observability backends:
http://localhost:4318/v1/traceshttps://api.traccia.ai/v2/tracesJaeger, Grafana Tempo, Zipkin (via collector), Honeycomb, Lightstep, Datadog, New Relic, and more
The hosted platform also accepts OTLP/gRPC for third-party OpenTelemetry clients. The Traccia SDK does not use gRPC — see Platform OTLP Ingestion.
Configuration Example
from traccia import init
# Export to local Jaegerinit(endpoint="http://localhost:4318/v1/traces")
# Or to Grafana Cloudinit( endpoint="https://otlp-gateway-prod.grafana.net/otlp/v1/traces", api_key="your-grafana-api-key")
# Or to Traccia Platforminit( endpoint="https://api.traccia.ai/v2/traces", api_key="your-traccia-api-key")Context Propagation
Traccia supports W3C Trace Context for propagating trace information across service boundaries. This is essential for distributed tracing in multi-agent or microservice architectures.
HTTP Headers
traceparentFormat: 00-<trace-id>-<span-id>-<flags>
tracestateVendor-specific context (optional)
Usage
from traccia.context import inject_http_headers, extract_parent_contextimport requests
# Agent 1: Inject context into outgoing HTTP requestheaders = {}inject_http_headers(headers)response = requests.post("http://agent2/task", headers=headers, json=data)
# Agent 2: Extract context from incoming request@app.post("/task")def handle_task(request): # Extract trace context from request headers parent_context = extract_parent_context(request.headers) # Now all spans created in this handler are children of the incoming trace ...Automatic propagation
Why OpenTelemetry Matters
No Vendor Lock-in
Switch observability backends without changing your instrumentation code
Rich Ecosystem
Auto-instrumentation libraries for hundreds of frameworks and libraries
Future-Proof
Industry standard backed by major tech companies and CNCF
Integration Ready
Works alongside your existing APM tools and monitoring stack
Traccia Architecture
Next Steps
© 2026 Traccia.