Skip to content

OpenTelemetry

Candela is built on OpenTelemetry (OTel) for distributed tracing. Every proxied LLM request creates an OTel span with semantic attributes following emerging GenAI observability conventions.

Every proxy span includes:

AttributeExampleDescription
gen_ai.systemgoogleProvider name
gen_ai.request.modelgemini-2.0-flashRequested model
gen_ai.usage.input_tokens150Input token count
gen_ai.usage.output_tokens42Output token count
gen_ai.response.modelgemini-2.0-flashResponse model
candela.cost_usd0.0023Calculated cost
candela.ttfb_ms234Time to first byte

Send spans to any OTLP-compatible collector (Datadog, Grafana Tempo, Jaeger, Elastic, Honeycomb):

# candela-sidecar env
OTLP_ENDPOINT: "http://localhost:4318/v1/traces"

Async export for production GCP workloads:

# candela-sidecar env
GCP_PROJECT: "my-project"
PUBSUB_TOPIC: "candela-spans"

Print spans as JSON for local debugging:

Terminal window
candela-sidecar --export stdout

The sidecar supports full W3C Trace Context propagation:

  1. Incoming — Extracts traceparent header from caller
  2. Span creation — Uses caller’s trace ID for unified trace tree
  3. Outgoing — Forwards updated traceparent with sidecar’s span ID to upstream provider

This enables unified traces across ADK → sidecar → LLM provider.

FrameworkHow to Integrate
Google ADKSet base_url + OTel env vars. See ADK Integration
LangChainPoint base_url at Candela; enable opentelemetry-instrumentation-httpx
LiteLLMSet api_base to Candela endpoint
Raw HTTPAdd traceparent header for trace correlation