OpenTelemetry

Both

Understanding 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

Because Traccia uses OpenTelemetry under the hood, all traces are fully compatible with any OTLP-capable backend. You can switch backends without changing your instrumentation code.

OTLP Export Format

Traccia exports traces using the OpenTelemetry Protocol (OTLP) over HTTP. This is the standard format supported by all major observability backends:

Default endpoint (local):http://localhost:4318/v1/traces
Traccia platform (SDK default):https://api.traccia.ai/v2/traces
Protocol:OTLP/HTTP (protobuf or JSON)
Compatible backends:

Jaeger, 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

main.py
python
from traccia import init
# Export to local Jaeger
init(endpoint="http://localhost:4318/v1/traces")
# Or to Grafana Cloud
init(
endpoint="https://otlp-gateway-prod.grafana.net/otlp/v1/traces",
api_key="your-grafana-api-key"
)
# Or to Traccia Platform
init(
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

traceparent

Format: 00-<trace-id>-<span-id>-<flags>

tracestate

Vendor-specific context (optional)

Usage

multi_agent.py
python
from traccia.context import inject_http_headers, extract_parent_context
import requests
# Agent 1: Inject context into outgoing HTTP request
headers = {}
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

If you've enabled auto-instrumentation for requests and FastAPI, context propagation happens automatically—no manual inject/extract needed!

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

Your Application
↓ @observe() decorator
Traccia SDK
Auto-instrumentation (OpenAI, Anthropic, etc.)
Span Processors (tokens, costs, enrichment)
Rate Limiter & Batcher
OpenTelemetry SDK (Core)
Context Propagation
Trace/Span Management
OTLP Exporter
↓ OTLP/HTTP
Observability Backend
Jaeger / Grafana Tempo (open-source)
Traccia Platform (hosted)

Next Steps

© 2026 Traccia.