Skip to content

[otel-advisor] add gen_ai.system attribute to agent span to comply with OTel GenAI semantic conventions #28803

Closed

Description

@github-actions

📡 OTel Instrumentation Improvement: Replace gen_ai.provider.name with standard gen_ai.system

Analysis Date: 2026-04-27
Priority: Medium
Effort: Small (< 2h)

Problem

The gh-aw.agent.agent sub-span (emitted by sendJobConclusionSpan for the agent job) sets the AI provider using a non-standard attribute key gen_ai.provider.name instead of the required gen_ai.system defined by the [OpenTelemetry GenAI Semantic Conventions]((opentelemetry.io/redacted)

A DevOps engineer querying spans in Grafana Tempo, Honeycomb, or Datadog cannot use their backend's built-in GenAI dashboards or auto-discovery for these spans because those tools look for gen_ai.system, not gen_ai.provider.name. The agent spans are invisible to any tooling that follows the OTel GenAI spec.

Why This Matters (DevOps Perspective)

The OTel GenAI Semantic Conventions (semconv v1.27.0+) define gen_ai.system as the required attribute for all AI inference spans. Without it:

  • Grafana's built-in GenAI dashboards (GenAI / LLM Requests) will not populate — they filter on gen_ai.system
  • Honeycomb's AI Observability features won't recognize gh-aw agent spans as LLM calls
  • Datadog's LLM Observability product looks for gen_ai.system to classify and route spans into LLM-specific views
  • Any backend that follows the OTel spec for auto-discovery of AI spans will miss these entirely

Fixing this reduces MTTR for AI-related incidents by making agent spans visible in standard GenAI dashboards without requiring custom attribute mappings.

Current Behavior

In send_otlp_span.cjs (around line 886–888), the agent sub-span is built with:

// Current: actions/setup/js/send_otlp_span.cjs (lines 886–888)
// Emit gen_ai.provider.name when engineId is available; it may be omitted when
// engine metadata is unavailable, so this span does not guarantee full GenAI spec compliance.
if (engineId) agentAttributes.push(buildAttr("gen_ai.provider.name", engineId));

The attribute key gen_ai.provider.name does not exist in the OTel Semantic Conventions. The test at send_otlp_span.test.cjs:1843 asserts:

expect(attrs["gen_ai.provider.name"]).toBe("claude");

Values observed in production workflows (from smoke-claude.lock.yml): engine_id = "claude".

Proposed Change

Rename the attribute key to the spec-required gen_ai.system. Retain gen_ai.provider.name as an alias for one release cycle to avoid breaking any existing custom dashboards built against it.

// Proposed: actions/setup/js/send_otlp_span.cjs (~line 886)
// gen_ai.system is Required by the OTel GenAI spec (semconv v1.27.0+).
// It identifies the AI provider so backends can auto-classify this as a GenAI span.
if (engineId) {
  agentAttributes.push(buildAttr("gen_ai.system", engineId));
  // Keep legacy alias for one release to avoid breaking existing dashboards.
  agentAttributes.push(buildAttr("gen_ai.provider.name", engineId));
}

If backwards compatibility is not a concern, the alias can be dropped immediately. The gen_ai.system value "claude" is not a registered well-known value (the registered value is "anthropic"), but the spec allows any string and backends accept it. A follow-up can map "claude" → "anthropic" if standard dashboards require the exact registered value.

Expected Outcome

After this change:

  • In Grafana / Honeycomb / Datadog: agent spans become visible in built-in GenAI/LLM dashboards that filter on gen_ai.system
  • In the JSONL mirror (/tmp/gh-aw/otel.jsonl): each agent span entry gains "key": "gen_ai.system" alongside the existing attributes
  • For on-call engineers: token usage, model, and operation data are surfaced automatically in provider-native views without custom queries
Implementation Steps
  • In actions/setup/js/send_otlp_span.cjs (~line 888): change "gen_ai.provider.name" → "gen_ai.system" (and optionally keep the alias)
  • Update send_otlp_span.test.cjs line 1843: change expect(attrs["gen_ai.provider.name"]).toBe("claude") → expect(attrs["gen_ai.system"]).toBe("claude")
  • Update send_otlp_span.test.cjs line 1873 accordingly (the "omits" test)
  • Update the comment on line 886 to reference the correct attribute name
  • Run cd actions/setup/js && npx vitest run to confirm tests pass
  • Run make fmt to ensure formatting
  • Open a PR referencing this issue
Evidence from Live Sentry Data

The Sentry MCP bridge was unavailable at analysis time (0 tools loaded in the bridge), so this finding is based entirely on static code review of send_otlp_span.cjs and the associated test file send_otlp_span.test.cjs. The non-standard attribute key gen_ai.provider.name is plainly visible at line 888 and confirmed by the test at line 1843. No live span payload could be sampled to verify whether additional attributes were absent from the wire format.

Related Files
  • actions/setup/js/send_otlp_span.cjs — line 886–888 (agent sub-span builder)
  • actions/setup/js/send_otlp_span.test.cjs — lines 1843, 1873 (tests to update)

Generated by the Daily OTel Instrumentation Advisor workflow

Generated by Daily OTel Instrumentation Advisor · ● 184.6K · ◷

  • expires on May 4, 2026, 9:35 PM UTC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions