Align spans with the OTel GenAI convention (N3 WP4) #32

Merged
weichen merged 1 commits from feature/n3-otel-wp4 into main 2026-10-07 15:38:08 +00:00
Owner

Why: acceptance clause 3 requires span names/attributes to follow the convention; names were bare words, attributes ad-hoc, and every span had a fresh random trace with no parentage.

What: names become invoke_agent / chat / execute_tool ; attributes move to gen_ai.* (system, request.model, agent.name, tool.name, usage.input/output_tokens as intValue); one Run shares one trace with invoke_agent as root and chat/tool children linked by parentSpanId; OTLP resource gains service.name; StartFunc gains WithServiceName/WithEndpoint options. Prompt-body and reserved-key exclusion preserved and tested.

Evidence: GOWORK=off go vet + go test -count=1 ./... green; TestSpanNamesFollowGenAIConvention (acceptance ③), TestLoopSpansFollowGenAIConvention; pre-existing denylist test unchanged.

Impact: span shape changes intentionally (recorded in the N3 card); defaults (no endpoint, agent-native service name) preserve current behavior for hosts that set nothing.

Refs: Agent-System-Documents#43 (N3 plan WP4)

Why: acceptance clause 3 requires span names/attributes to follow the convention; names were bare words, attributes ad-hoc, and every span had a fresh random trace with no parentage. What: names become invoke_agent <agent> / chat <model> / execute_tool <tool>; attributes move to gen_ai.* (system, request.model, agent.name, tool.name, usage.input/output_tokens as intValue); one Run shares one trace with invoke_agent as root and chat/tool children linked by parentSpanId; OTLP resource gains service.name; StartFunc gains WithServiceName/WithEndpoint options. Prompt-body and reserved-key exclusion preserved and tested. Evidence: GOWORK=off go vet + go test -count=1 ./... green; TestSpanNamesFollowGenAIConvention (acceptance ③), TestLoopSpansFollowGenAIConvention; pre-existing denylist test unchanged. Impact: span shape changes intentionally (recorded in the N3 card); defaults (no endpoint, agent-native service name) preserve current behavior for hosts that set nothing. Refs: Agent-System-Documents#43 (N3 plan WP4)
weichen added 1 commit 2026-10-07 15:36:51 +00:00
Align spans with the OTel GenAI convention (N3 WP4)
ci / vet-and-test (pull_request) Successful in 51s
ci / docker-checkout-hostgateway (pull_request) Successful in 1s
fc0558fc93
Why: acceptance clause 3 requires span names and attributes to follow
the convention; today names were bare words with two ad-hoc attribute
keys, and every span got a fresh random trace with no parentage.
Evidence: GOWORK=off go vet + go test -count=1 ./... green;
TestSpanNamesFollowGenAIConvention (name suffixes, gen_ai.* key enum,
intValue usage, service.name resource, prompt/reserved-key exclusion),
TestLoopSpansFollowGenAIConvention (invoke_agent root with shared
trace, chat/execute_tool children with parent links, usage attrs on
chat spans); the pre-existing prompt-body denylist test passes
unchanged.
Impact: span names become invoke_agent <agent> / chat <model> /
execute_tool <tool>; attributes move to gen_ai.* with usage as
intValue; one Run shares one trace with invoke_agent as root. New
Config.AgentName/ProviderName (documented defaults keep old hosts
meaningful); telemetry StartFunc gains WithServiceName/WithEndpoint
options (defaults preserve current behavior).
Refs: Agent-System-Documents#43 (N3 plan WP4)
weichen merged commit fe0c4a9f82 into main 2026-10-07 15:38:08 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-Native#32