Skip to content

OTel: emit gen_ai.system on setup and conclusion spans - #32340

Merged
pelikhan merged 2 commits into
mainfrom
copilot/otel-advisor-improve-gen-ai-system-attribute
May 15, 2026
Merged

pelikhan merged 2 commits into
mainfrom
copilot/otel-advisor-improve-gen-ai-system-attribute

Conversation

Copilot AI commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

✨ Enhancement

gen_ai.system was only emitted on gh-aw.<job>.agent spans, which prevented end-to-end lifecycle analysis by provider in OTel-native GenAI dashboards. This change propagates the same provider identity to setup and conclusion spans so run-level latency/failure queries work across the full job lifecycle.

  • What does this improve?

    • Adds gen_ai.system to:
      • gh-aw.<job>.setup
      • gh-aw.<job>.conclusion
    • Keeps existing gh-aw.engine.id behavior unchanged.
  • Why is this valuable?

    • Enables provider-scoped lifecycle analytics (e.g., failure rate and p95 setup→conclusion latency) without losing non-agent span visibility.
    • Aligns span attribution with OTel GenAI semantic conventions across all key job lifecycle spans.
  • Implementation approach:

    • Reused existing ENGINE_TO_SYSTEM_MAP mapping in send_otlp_span.cjs.
    • Applied the same fallback rule used by agent spans:
      • mapped provider when known
      • raw engineId when unknown
    • Updated focused unit assertions in send_otlp_span.test.cjs to cover:
      • setup span includes/omits gen_ai.system correctly
      • conclusion span includes/omits gen_ai.system correctly
      • expected mapped values (e.g., claude -> anthropic, copilot -> github_models)
if (engineId) {
  const genAiSystem = ENGINE_TO_SYSTEM_MAP[engineId] || engineId;
  attributes.push(buildAttr("gen_ai.system", genAiSystem));
  attributes.push(buildAttr("gh-aw.engine.id", engineId));
}

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve OTel instrumentation to emit gen_ai.system on setup and conclusion spans OTel: emit gen_ai.system on setup and conclusion spans May 15, 2026
Copilot AI requested a review from pelikhan May 15, 2026 12:00
@pelikhan
pelikhan marked this pull request as ready for review May 15, 2026 12:03
Copilot AI review requested due to automatic review settings May 15, 2026 12:03
@pelikhan
pelikhan merged commit 9ede37a into main May 15, 2026
1 check passed
@pelikhan
pelikhan deleted the copilot/otel-advisor-improve-gen-ai-system-attribute branch May 15, 2026 12:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends OTel GenAI provider attribution so setup and conclusion lifecycle spans include gen_ai.system, not just dedicated agent spans.

Changes:

  • Adds gen_ai.system to setup spans when an engine ID is available.
  • Adds gen_ai.system to conclusion spans using the existing engine-to-provider mapping.
  • Updates unit assertions for mapped and omitted provider attributes.
Show a summary per file
File Description
actions/setup/js/send_otlp_span.cjs Adds provider attribution to setup and conclusion span attributes.
actions/setup/js/send_otlp_span.test.cjs Expands tests to assert gen_ai.system behavior on setup and conclusion spans.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment on lines +1424 to +1427
if (engineId) {
const genAiSystem = ENGINE_TO_SYSTEM_MAP[engineId] || engineId;
attributes.push(buildAttr("gen_ai.system", genAiSystem));
attributes.push(buildAttr("gh-aw.engine.id", engineId));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[otel-advisor] OTel improvement: emit gen_ai.system on setup and conclusion spans, not just the dedicated agent span

3 participants