-
Notifications
You must be signed in to change notification settings - Fork 1
feat: integrate OpenTelemetry tracing for LLM agent observability #13
Copy link
Copy link
Open
Description
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 contentOnError— 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
- eino callbacks interface:
github.com/cloudwego/eino/callbacks - apmplus implementation (reference): https://github.com/cloudwego/eino-ext/tree/main/callbacks/apmplus
- OpenTelemetry GenAI Semantic Conventions
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels