feat(openai-agents) GenAI semconv compliance#3823
feat(openai-agents) GenAI semconv compliance#3823max-deygin-traceloop wants to merge 7 commits intomax/tlp-1925-python-sdk-otel-semantic-conventionfrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
740ee81 to
6401889
Compare
60cb4f7 to
82e355e
Compare
749f737 to
40c18fb
Compare
| SpanAttributes.LLM_REQUEST_TYPE: "response", | ||
| GenAIAttributes.GEN_AI_SYSTEM: "openai", | ||
| GenAIAttributes.GEN_AI_OPERATION_NAME: "response", | ||
| GenAIAttributes.GEN_AI_SYSTEM: "openai", |
There was a problem hiding this comment.
@max-deygin-traceloop @OzBenSimhonTraceloop we need to set also GEN_AI_PROVIDER_NAME
here:
https://github.com/traceloop/openllmetry/pull/3808/changes#r2959993030
There was a problem hiding this comment.
actually, after double checking it, we should put only GEN_AI_PROVIDER_NAME as system is deprecated
| SpanAttributes.LLM_REQUEST_TYPE: "chat", | ||
| GenAIAttributes.GEN_AI_SYSTEM: "openai", | ||
| GenAIAttributes.GEN_AI_OPERATION_NAME: "chat", | ||
| GenAIAttributes.GEN_AI_SYSTEM: "openai", |
| SpanAttributes.LLM_REQUEST_TYPE: "realtime", | ||
| GenAIAttributes.GEN_AI_SYSTEM: "openai", | ||
| GenAIAttributes.GEN_AI_OPERATION_NAME: "speech", | ||
| GenAIAttributes.GEN_AI_SYSTEM: "openai", |
| SpanAttributes.LLM_REQUEST_TYPE: "realtime", | ||
| GenAIAttributes.GEN_AI_SYSTEM: "openai", | ||
| GenAIAttributes.GEN_AI_OPERATION_NAME: "transcription", | ||
| GenAIAttributes.GEN_AI_SYSTEM: "openai", |
| SpanAttributes.LLM_REQUEST_TYPE: "realtime", | ||
| GenAIAttributes.GEN_AI_SYSTEM: "openai", | ||
| GenAIAttributes.GEN_AI_OPERATION_NAME: "speech_group", | ||
| GenAIAttributes.GEN_AI_SYSTEM: "openai", |
| context=parent_context, | ||
| attributes={ | ||
| SpanAttributes.LLM_REQUEST_TYPE: "realtime", | ||
| GenAIAttributes.GEN_AI_OPERATION_NAME: "realtime", |
There was a problem hiding this comment.
@max-deygin-traceloop @OzBenSimhonTraceloop we need to set also GEN_AI_SYSTEM
here:
https://github.com/traceloop/openllmetry/pull/3808/changes#r2959993030
| attributes={ | ||
| SpanAttributes.LLM_REQUEST_TYPE: "realtime", | ||
| SpanAttributes.LLM_SYSTEM: "openai", | ||
| GenAIAttributes.GEN_AI_OPERATION_NAME: "realtime", |
…LM_ → GEN_AI_ - Replace SpanAttributes.LLM_REQUEST_TYPE with GenAIAttributes.GEN_AI_OPERATION_NAME - Replace SpanAttributes.LLM_REQUEST_FUNCTIONS with GenAIAttributes.GEN_AI_TOOL_DEFINITIONS - Replace SpanAttributes.LLM_SYSTEM with GenAIAttributes.GEN_AI_SYSTEM - Replace SpanAttributes.LLM_USAGE_TOTAL_TOKENS with SpanAttributes.GEN_AI_USAGE_TOTAL_TOKENS - Add test_semconv_compliance.py and [tool.uv.sources] for local semconv_ai Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…l definitions to JSON array Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…en test constants, remove duplicate GEN_AI_SYSTEM key Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ssage format Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ve orphaned completion.tool.* attrs
- _realtime_wrappers.py: replace flat gen_ai.prompt.*/gen_ai.completion.* in
create_llm_span() with GEN_AI_INPUT_MESSAGES/GEN_AI_OUTPUT_MESSAGES JSON arrays
- _hooks.py: remove gen_ai.completion.tool.{name,type,strict_json_schema} sub-attributes
from FunctionSpanData handler (tool name already captured via GEN_AI_TOOL_NAME)
- tests: update test_realtime_session.py assertions to parse JSON array attributes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…, remove AgentSpanData misfeature - _hooks.py: remove misplaced catch-all 'elif span_data:' that was shadowing SpeechSpanData, TranscriptionSpanData, SpeechGroupSpanData, and AgentSpanData branches - _hooks.py: remove AgentSpanData handler that incorrectly propagated model settings to agent spans (test spec: agent spans must NOT carry gen_ai.request.* params) - _hooks.py: replace hardcoded "openai.agent.model.frequency_penalty" with GenAIAttributes.GEN_AI_REQUEST_FREQUENCY_PENALTY constant - tests: fix dead "llm.usage.*" prefix check, fix vestigial "gen_ai.prompt" scan, fix hardcoded frequency_penalty string, fix long line in test_realtime_session.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40c18fb to
db6adb2
Compare
Migrate openai-agents instrumentation to OTel GenAI semconv
Aligns the OpenAI Agents SDK instrumentation with the upstream OpenTelemetry GenAI
semantic conventions.
Changes:
SpanAttributes.LLM_*constants with upstreamGenAIAttributes.GEN_AI_*equivalentsgen_ai.prompt.{i}.*/gen_ai.completion.{i}.*attributes togen_ai.input.messages/gen_ai.output.messagesJSON arraysgen_ai.tool.definitions.{i}.*attributes togen_ai.tool.definitionsJSON array
gen_ai.operation.namedict keys in_hooks.pygen_ai.systemkey in_realtime_wrappers.py