[Discuss][Observability] OpenTelemetry GenAI export for Agent Traces (follow-up to #900) #929
Zhuoxi2000
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Motivation
#900 defines how Agent Traces are recorded in the Event Log, and deliberately lists OTel export as a non-goal of the recording scope. In that thread, @joeyutong agreed that OpenTelemetry export should be a supported follow-up once the recording contract settles, with the exact GenAI attribute mapping to be worked out as part of the exporter design. This discussion is that follow-up: a config-gated exporter that maps recorded Execution Events to the OpenTelemetry GenAI semantic conventions, so any OTLP-compatible backend (Jaeger, Grafana Tempo, Langfuse, Phoenix, vendor APMs) can visualize and analyze agent runs without flink-agents shipping its own UI.
Proposed mapping
Trace topology, aligned with the #900 recording model:
input_run_id)execution_id/parent_execution_id)invoke_agent {agent_name};gen_ai.operation.name = invoke_agent,gen_ai.agent.nameexecute_tool {tool_name};gen_ai.operation.name = execute_tool,gen_ai.tool.namechat {model};gen_ai.operation.name = chat,gen_ai.request.model,gen_ai.provider.namebusiness_keygen_ai.conversation.idstatus/problem_categoryerror.typegen_ai.usage.input_tokens/gen_ai.usage.output_tokensID derivation. Framework IDs stay opaque, as preferred in #900; the exporter derives fixed-width OTel IDs deterministically, e.g.
trace_id = truncate(SHA-256(input_run_id), 128 bits)andspan_id = truncate(SHA-256(execution_id), 64 bits). Deterministic derivation keeps re-exports idempotent.Design points to agree on
Where the exporter runs. Two candidate shapes:
I lean toward (b) first, since it derives everything from the recording contract and adds no runtime risk, keeping (a) as a later option. Opinions welcome.
Config surface.
event-log.trace.otel.enabled(defaultfalse, mirroring the recording flag), OTLP endpoint/protocol/headers,service.name. Content capture (prompt/response bodies) stays off by default and is opted into separately — gen_ai content capture has privacy and volume implications.Semconv version. The
gen_ai.*conventions are stilldevelopmentstability; we should pin the exportedschema_urland document the target version. I'm engaging in the OTel GenAI SIG, so we can track upstream changes as they stabilize.Scope for 0.4. Phase 1 = Java, spans-only, out-of-band exporter + config; Phase 2 = usage-metrics enrichment; Phase 3 = Python parity. Is Phase 1 realistic for the 0.4 feature freeze (Sept 15)?
What I'd deliver
I've already implemented the inverse mapping (OTel GenAI → storage) in a side project, so the attribute table above is grounded in working code. If maintainers agree with the general shape, I'll break this into concrete issues and start with Phase 1.
All reactions