Summary
Add OpenTelemetry (OTel) tracing support to LAPP so that LLM agent calls (via eino ADK) are observable in standard tracing backends (Jaeger, Grafana Tempo, etc.).
Background
eino provides a callbacks.Handler mechanism that fires on every component invocation (ChatModel, Tool, etc.) within the ADK agent execution graph. Global handlers registered via callbacks.AppendGlobalHandlers() work transparently with ADK — no changes to analyzer.go needed.
Current state of eino-ext tracing
eino-ext/callbacks/apmplus — OTel-based but vendor-locked to Volcengine APMPlus (requires AppKey)
eino-ext/callbacks/langfuse — works well but uses Langfuse's own API, not OTLP
- No vendor-neutral OTel callback handler exists in eino-ext
Proposal
Write a custom callbacks.Handler that uses standard go.opentelemetry.io/otel/trace to:
OnStart — create a span with GenAI semantic attributes (gen_ai.request.model, prompt messages, etc.)
OnEnd — end the span, record token usage (gen_ai.usage.prompt_tokens, gen_ai.usage.completion_tokens), response content
OnError — set span error status
- Streaming variants —
OnStartWithStreamInput / OnEndWithStreamOutput
Register it globally at process startup. The handler should accept a standard trace.TracerProvider so users can plug in any OTel-compatible backend.
Scope
- ~100-200 lines for the callback handler
- OTel SDK initialization (TracerProvider + OTLP exporter) configurable via env vars (
OTEL_EXPORTER_OTLP_ENDPOINT, etc.)
- Opt-in: tracing is enabled only when an OTLP endpoint is configured
References
Summary
Add OpenTelemetry (OTel) tracing support to LAPP so that LLM agent calls (via eino ADK) are observable in standard tracing backends (Jaeger, Grafana Tempo, etc.).
Background
eino provides a
callbacks.Handlermechanism that fires on every component invocation (ChatModel, Tool, etc.) within the ADK agent execution graph. Global handlers registered viacallbacks.AppendGlobalHandlers()work transparently with ADK — no changes toanalyzer.goneeded.Current state of eino-ext tracing
eino-ext/callbacks/apmplus— OTel-based but vendor-locked to Volcengine APMPlus (requires AppKey)eino-ext/callbacks/langfuse— works well but uses Langfuse's own API, not OTLPProposal
Write a custom
callbacks.Handlerthat uses standardgo.opentelemetry.io/otel/traceto:OnStart— create a span with GenAI semantic attributes (gen_ai.request.model, prompt messages, etc.)OnEnd— end the span, record token usage (gen_ai.usage.prompt_tokens,gen_ai.usage.completion_tokens), response contentOnError— set span error statusOnStartWithStreamInput/OnEndWithStreamOutputRegister it globally at process startup. The handler should accept a standard
trace.TracerProviderso users can plug in any OTel-compatible backend.Scope
OTEL_EXPORTER_OTLP_ENDPOINT, etc.)References
github.com/cloudwego/eino/callbacks