Skip to content

Update OpenTelemetry GenAI conventions to latest - #14

Closed
github-actions[bot] wants to merge 4 commits into
mainfrom
update-otel-genai-to-latest-28304923869
Closed

Update OpenTelemetry GenAI conventions to latest#14
github-actions[bot] wants to merge 4 commits into
mainfrom
update-otel-genai-to-latest-28304923869

Conversation

@github-actions

@github-actions github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown

Draft pending the first release of
open-telemetry/semantic-conventions-genai.
Both conventions are Development stability and unreleased. Merge once they ship in a tagged release.

Supersedes #13 (closed without merge).

What this PR implements

Area Convention Upstream Compensating change
gen-ai document modality for application/* MIME types #142 Return "document" from DeriveModalityFromMediaType() for application/ media types. Test augmented in OpenTelemetryChatClientTests.cs.
gen-ai gen_ai.request.reasoning.level #258 Emit ChatOptions.Reasoning?.Effort on chat spans. Constant in OpenTelemetryConsts.cs. Test augmented.

Validation: build clean (net8.0/net9.0/net10.0, 0 warnings); 15 tests pass. No public API change; doc-comment at v1.41.

Upstream scan tracking

Legend: 🔴 implemented here · ✅ already aligned · 🟡 watch/deferred · 🟢 not applicable (no client / docs-only)

Merged upstream changes (Unreleased) — applicability to dotnet/extensions

Upstream PR Area Change Appl. Status
#142 gen-ai document modality added 🔴 Implemented in DeriveModalityFromMediaType().
#258 gen-ai gen_ai.request.reasoning.level 🔴 Implemented in OpenTelemetryChatClient.
#321 gen-ai gen_ai.invoke_agent.duration clarified as in-proc span 🟢 Docs clarification of deferred metric.
#322 gen-ai tool.name / tool.type sampling-relevant; agent.name on execute_tool; agent.version removed from invoke_agent 🟡 sampling-relevant: ✅ (set in StartActivity tags). agent.name: deferred. agent.version removal: ✅.
#330 gen-ai Complex-attribute schema moved to Weaver templates 🟢 Tooling/codegen change; no runtime impact.
#179 gen-ai gen_ai.prompt.version / gen_ai.prompt.variable 🟢 Deferred — no MEAI prompt API.
#201 gen-ai gen_ai.invoke_agent.duration / gen_ai.execute_tool.duration metrics 🟡 Deferred — no Meter in FunctionInvocationProcessor, no agent framework.
#162 gen-ai gen_ai.conversation.compacted + CompactionPart 🟡 Deferred — no compaction support.
#107 gen-ai gen_ai.agent.name sampling-relevant 🟡 Deferred — no agent-name emission site.
#97 gen-ai plan operation name 🟡 Deferred — no plan-operation instrumentation.
#126 gen-ai gen_ai.workflow.duration metric 🟢 No workflow instrumentation.
#136 mcp gen_ai.tool.call.arguments / .result on MCP server 🟢 No MCP server instrumentation.
#140 gen-ai GenAI memory operation spans 🟢 No memory instrumentation.
#289 gen-ai gen_ai.provider.name removed from invoke_agent span Already aligned — not emitted.
#217 gen-ai gen_ai.request.top_k type doubleint Already aligned — emitted as int.
#242 gen-ai gen_ai.agent.id removed from internal spans Already aligned — not emitted.
#257 gen-ai gen_ai.system_instructions limited to text Already aligned — text-only.
#211 gen-ai Billed vs consumed token count clarification 🟢 Docs only.
#212 gen-ai gen_ai.provider.name description generalized 🟢 Docs only.
#214 gen-ai gen_ai.provider.name requiredness relaxed 🟢 Docs only.
#216 gen-ai Span covers full caller-observed duration 🟢 Docs only.
#219 gen-ai gen_ai.conversation.id population guidance 🟢 Docs only.
#220 mcp MCP context propagation clarification 🟢 No MCP instrumentation.
#99 gen-ai moonshot_ai well-known provider value 🟢 Docs only.

In-flight upstream changes (open PRs) — applicability if merged

Filter: convention-changing PRs. Excluded CI/chore/deps/reference-scenario-only: dotnet#340, dotnet#328, dotnet#325, dotnet#324, dotnet#290, dotnet#283, dotnet#112.

🟡 Watch — potential dotnet/extensions changes if merged:

Upstream PR Change Status
#341 Rename gen_ai.workflow.durationgen_ai.invoke_workflow.duration Watch — deferred workflow metric rename.
#197 Token usage modality / cache / phase breakdowns Watch — could affect OpenTelemetryChatClient token metrics.
#350 gen_ai.agent.identity.id / .name Watch — no current client.
#96 gen_ai.token.cache / gen_ai.token.reasoning metric attrs Watch — could affect gen_ai.client.token.usage.
#144 BlobPart.content optional + stripped_reason Watch — could affect OtelMessageSerializer.
#143 Optional byte_size on multimodal content parts Watch — could affect OtelMessageSerializer.

🟢 Out-of-scope (no client in this repo / server-side / docs-only):
#98, #164, #165, #184, #185, #188, #190, #195, #202, #215, #238, #250, #252, #262, #267, #270, #291, #336, #351

Tracking state

Upstream-Repo: open-telemetry/semantic-conventions-genai
Upstream-Scan-Ref: e153ed94728993acd0ee6a958559032ca8b20afe  # chore/deps/reference-scenarios since prior ref (#342, #349, #348, #347, #346); no new convention changes
Upstream-Scan-Date: 2026-06-28T00:39:42Z
Upstream-Release: none                      # Unreleased; Towncrier fragments under changelog.d/
Core-Semconv-Dependency: v1.42.0            # versions.env SEMCONV_VERSION (core dep, NOT the GenAI version)
DotnetExtensions-Implemented-Version: v1.41 # doc-comment version reference currently in source

Generated by MEAI: Update Otel Gen-AI · 111.1 AIC · ⊞ 10.7K ·

jeffhandley and others added 3 commits June 27, 2026 17:58
Add .github/workflows/meai-update-otel-genai.md (and its compiled lock)
that runs daily, plus on manual dispatch, to integrate
open-telemetry/semantic-conventions GenAI updates into
Microsoft.Extensions.AI and maintain a single draft PR until the upstream
release is published.

- Invokes the update-otel-genai-conventions skill in Plan-then-Implement
  mode, comparing upstream HEAD against this repo''s main.
- Relies on the skill''s change-classification reference to classify each
  upstream change as actionable-now (code/minor action on an
  already-emitted item) vs deferred (constant not yet emitted, no client,
  server-side, doc-only), and adds a lifecycle invariant so deferral never
  collapses a run into a no-op -- deferred items still keep a maintained
  draft PR open.
- Finds the workflow''s PR by content (automation + area-ai labels plus the
  otel-genai-tracking state block), never by branch name, then chooses an
  action from PR state plus an upstream-SHA comparison: caught-up
  open/merged is a no-op; behind-open-draft does an incremental push to the
  PR''s existing head branch; behind-non-draft leaves an advisory comment;
  merged-but-behind and any closed-without-merge PR (caught up or behind)
  start a fresh PR; a still-open prior published-version PR gets only an
  advisory comment.
- Defers the PR title, target token, and full PR body (status note,
  what-this-implements table, upstream-scan applicability tables, and the
  otel-genai-tracking state block) to the skill''s pr-description
  reference: the target is `latest` while the conventions are unreleased
  and a concrete v{version} once a release/schema publishes. Fresh PRs use
  a unique, run-scoped branch update-otel-genai-to-{target}-{GITHUB_RUN_ID}
  so they never collide with a branch a closed PR left behind; labeled
  automation and area-ai; retitles the PR when the skill''s target resolves
  to a version; marks it ready for review once the upstream release is
  published.
- Restricts edits to src/test/docs/samples for Microsoft.Extensions.AI via
  allowed-files; commits on the checked-out HEAD without creating the PR
  branch locally so patch generation diffs against the exact checkout SHA.
- No-op runs write the reason to the step summary and emit no issue,
  comment, or report; failures are not reported as issues; threat
  detection is disabled (the sandbox, read-only permissions, and file
  allow-list already constrain the run); at most one comment is posted
  per run.
- Guards execution with an if condition so it only runs on dispatch or on
  the canonical (non-fork) repository, and uses the Copilot PAT pool.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…-genai ref

Add an optional `upstream_ref` workflow_dispatch input to the MEAI: Update
Otel Gen-AI workflow so a manual dispatch can scan a specific ref of
open-telemetry/semantic-conventions-genai instead of the default-branch HEAD.

- Declare the input in the workflow_dispatch frontmatter (git ref -- branch,
  tag, or commit SHA; optional string; empty by default).
- Wire it into Step 1 via `${{ github.event.inputs.upstream_ref }}`: a
  non-empty value is scanned as the upstream ref, while an empty value (every
  scheduled run, and dispatches that leave it blank) scans the default-branch
  HEAD. The resolved commit SHA flows into Upstream-Scan-Ref and all
  downstream SHA comparisons.
- Generalize the "upstream HEAD" wording to "scanned upstream commit/SHA"
  across Steps 2, 3, and 5 and the no-op rules so the language matches an
  overridable scan ref.
- Recompile the lock (gh-aw v0.80.9).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add 'document' modality for application/* MIME types in DeriveModalityFromMediaType(),
aligning with the updated Modality enum in the upstream gen-ai input/output message
schemas (open-telemetry/semantic-conventions-genai#142).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ai#258)

Emit ChatOptions.Reasoning?.Effort as gen_ai.request.reasoning.level on
chat spans. Add ReasoningLevel constant to OpenTelemetryConsts.GenAI.Request.
Augment ExpectedInformationLogged_Async test with Reasoning.Effort = High
and the corresponding gen_ai.request.reasoning.level assertion.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Author

Commit pushed: cc95f80

Generated by MEAI: Update Otel Gen-AI · 283.8 AIC · ⊞ 10.7K

@github-actions

Copy link
Copy Markdown
Author

Incremental update — upstream scan 93de98a5 (2026-06-27)

Scanned open-telemetry/semantic-conventions-genai at 93de98a5b1298ee6708c76ca87cb389861689732 (prior scan: 78350d4a). Found 3 new changelog.d/ fragments since the last scan.

New upstream changes

Upstream PR Area Change Action
#258 gen-ai gen_ai.request.reasoning.level attribute added 🔴 Implemented
#162 gen-ai gen_ai.conversation.compacted + CompactionPart schema 🟡 Deferred
#289 gen-ai gen_ai.provider.name removed from invoke_agent internal span Already aligned

What was implemented

gen_ai.request.reasoning.level (#258):

  • Added ReasoningLevel = "gen_ai.request.reasoning.level" constant to OpenTelemetryConsts.GenAI.Request
  • OpenTelemetryChatClient now emits ChatOptions.Reasoning?.Effort as gen_ai.request.reasoning.level when set (e.g. ReasoningEffort.High"high")
  • Augmented ExpectedInformationLogged_Async test with Reasoning = new ReasoningOptions { Effort = ReasoningEffort.High } and assertion for "high"

What was deferred

gen_ai.conversation.compacted + CompactionPart (#162): MEAI has no IsCompacted property on ChatOptions/ChatResponse and no CompactionContent type — both items deferred until MEAI adds compaction support.

Validation

Build clean (net8.0/net9.0/net10.0, 0 warnings). 15 OpenTelemetryChatClientTests pass across all target frameworks.

Generated by MEAI: Update Otel Gen-AI · 283.8 AIC · ⊞ 10.7K ·

@github-actions

Copy link
Copy Markdown
Author

Incremental scan update — 0183a25b (2026-06-28)

Scanned open-telemetry/semantic-conventions-genai at 0183a25b, advanced from prior ref 93de98a5. 2 new upstream changes found; no code changes needed for this delta (all deferred or N/A).

New merged upstream changes since prior scan

Upstream PR Area Change Applicability Rationale
#179 gen-ai gen_ai.prompt.version / gen_ai.prompt.variable added 🟢 No MEAI ChatOptions or IChatClient API exposes prompt name, version, or template variables today. Deferred until MEAI adds prompt-tracking API.
#201 gen-ai gen_ai.invoke_agent.duration / gen_ai.execute_tool.duration metrics added 🟡 execute_tool.duration deferred — FunctionInvocationProcessor has no Meter/histogram infrastructure today. invoke_agent.duration — no agent framework in this repo.

PR body updated: new rows added to the changes table and merged-upstream table; in-flight table populated with 14 open upstream PRs; Upstream-Scan-Ref advanced to 0183a25b.

Generated by MEAI: Update Otel Gen-AI · 144.9 AIC · ⊞ 10.7K ·

@github-actions

Copy link
Copy Markdown
Author

Upstream scan update — 2026-06-28

Scanned upstream ref 791c3419 (prior ref: 0183a25b). No code changes needed — all 3 new merged changes are already aligned or deferred.

New merged changes since prior scan

Upstream PR Change Applicability Result
#321 Clarify gen_ai.invoke_agent.duration is in-proc / internal span 🟢 Documentation clarification of deferred metric; no code change.
#322 Mark gen_ai.tool.name / gen_ai.tool.type sampling-relevant; add gen_ai.agent.name to execute_tool span; remove gen_ai.agent.version from invoke_agent internal span 🟡 sampling_relevant flags: already aligned (both are set as initial StartActivity tags in FunctionInvocationProcessor). gen_ai.agent.name on execute_tool: deferred (no agent-name emission site). gen_ai.agent.version removal: already aligned.
#330 Move complex-attribute JSON schema annotations to Weaver/Jinja templates 🟢 Weaver tooling / codegen change; no semantic convention change at runtime.

Also merged between refs: dotnet#337 (pydantic-ai dep), dotnet#339 (weaver dep) — excluded (CI/deps).

In-flight table updates

Added 10 newly opened upstream PRs to the watch list: dotnet#96, dotnet#98, dotnet#143, dotnet#144, dotnet#164, dotnet#165, dotnet#184, dotnet#185, dotnet#188, dotnet#190, dotnet#195. Added dotnet#290 to the excluded list. All are 🟢 or 🟡 Watch with no current emission site in this repo.

The PR body tracking block has been advanced to Upstream-Scan-Ref: 791c341968d4d14cdc4d26f5c59fe690a7fcba5b.

Generated by MEAI: Update Otel Gen-AI · 169.5 AIC · ⊞ 10.7K ·

@github-actions

Copy link
Copy Markdown
Author

Upstream scan refresh — 5 chore/deps/reference-scenario commits merged upstream since last scan (791c341...e153ed9...):

  • #342 [chore] Add basic agents.md reference scenario
  • #349 Update dependency google-cloud-aiplatform to v2
  • #348 Remove description from copilot instructions
  • #347 Bump python-security dependencies
  • #346 PR dashboard moved to shared-workflows repo

No new changelog.d/ convention fragments. All 25 tracked fragments and their classifications are unchanged. No code changes needed.

Added #112 (Update dependency google-genai to v2) to the excluded CI/chore/deps list. Tracking state advanced to e153ed94 / 2026-06-28T00:39:42Z. Added <!-- otel-genai-tracking:begin/end --> markers to the tracking state block for reliable machine parsing.

Generated by MEAI: Update Otel Gen-AI · 111.1 AIC · ⊞ 10.7K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant