Update OpenTelemetry GenAI conventions to latest#7589
Draft
jeffhandley wants to merge 1 commit into
Draft
Conversation
…elemetry - Emit gen_ai.request.reasoning.level on chat spans from ChatOptions.Reasoning.Effort in OpenTelemetryChatClient, mapping ReasoningEffort to a normalized lowercase token. - Add the gen_ai.execute_tool.duration histogram: expose the Meter via GetService on OpenTelemetryChatClient and OpenTelemetryRealtimeClientSession; FunctionInvokingChatClient and FunctionInvokingRealtimeClientSession retrieve it and build the histogram; FunctionInvocationProcessor records the duration with gen_ai.tool.name, gen_ai.tool.type, and error.type. - Add OpenTelemetryConsts.GenAI.Request.ReasoningLevel and GenAI.ExecuteTool.Duration constants plus the CreateGenAIExecuteToolDurationHistogram helper. - Augment OpenTelemetryChatClientTests for reasoning.level and add the ExecuteToolDurationMetricRecorded test. Implements open-telemetry/semantic-conventions-genai#258 (reasoning.level) and dotnet#201/dotnet#322 (execute_tool.duration), both unreleased / development stability. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collaborator
🎉 Good job! The coverage increased 🎉
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1482921&view=codecoverage-tab |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR implements
gen-aigen_ai.request.reasoning.levelChatOptions.Reasoning.EffortinOpenTelemetryChatClient(normalized lowercase token; exact provider wire string may differ, e.g. OpenAIxhigh).gen-ai/agentgen_ai.execute_tool.durationFunctionInvocationProcessor(gen_ai.tool.name,gen_ai.tool.type,error.type).Metershared viaGetService(typeof(Meter))on the chat + realtime OTel clients.Validation: build clean (net8.0/net9.0/net10.0, 0 warnings); 677 AI + 103 realtime tests pass. No public API surface change (constants/helpers
internal); doc-comment version reference left atv1.41(GenAI repo has no release to bump to yet).Upstream scan tracking
Legend: 🔴 implemented here · ✅ already aligned · 🟡 watch/deferred · 🟢 not applicable (no client / docs-only)
Merged upstream changes (Unreleased) -- applicability to dotnet/extensions
gen_ai.request.reasoning.levelexecute_tool.duration+invoke_agent.durationtop_kdouble->int, splitretrieval.top_kChatOptions.TopKalreadyint?system_instructionsto text partsconversation.idno fallback UUIDsdocumentmodality in message schemaconversation.compacted+CompactionPartprompt.version/prompt.variableprovider.namecond-required on operation.durationprovider.namedescriptionmoonshot_aiprovider valueworkflow.durationmetricplanoperationagent.namesampling-relevantagent.idto stable idsagent.idnot emittedprovider.namefrom internal agent spansIn-flight upstream changes (open PRs) -- applicability if merged
Filter: open PRs proposing convention changes (excludes currently-open pure dependency/CI/chore PRs: #112, #290, #328, #340; since the prior scan, chore #342 merged and #282 closed unmerged).
execute_toolspanclient.operation.durationscopetoken.cache/token.reasoningmetric attrsbyte_sizeon multimodal content partsworkflow.duration->invoke_workflow.durationserver.inter_token_latencymetricTracking state