You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
π‘ OTel Instrumentation Improvement: Add Trigger Item Context to All Spans
Analysis Date: 2026-04-28 Priority: High Effort: Small (< 2h)
Problem
Every gh-aw workflow is triggered by a specific GitHub item β an issue, a pull request, a discussion, or a check run. The buildAwContext() function in aw_context.cjs resolves these details (item_type, item_number, comment_id, trigger_label) from the event payload and writes them to aw_info.json under context.
However, neither sendJobSetupSpan nor sendJobConclusionSpan in send_otlp_span.cjs reads these fields or emits them as span attributes. As a result, every OTel span is completely blind to what triggered the workflow. A DevOps engineer looking at a failing span in Grafana or Honeycomb cannot answer:
"Which GitHub issue caused this agent failure?"
"How many agent failures are on pull requests vs. issues this week?"
The same gap exists in sendJobConclusionSpan (lines 692, 757).
Proposed Change
In sendJobSetupSpan and sendJobConclusionSpan, read the four trigger-context fields from awInfo.context and emit them as span attributes.
// Proposed addition to sendJobSetupSpan and sendJobConclusionSpan// in actions/setup/js/send_otlp_span.cjs// After the existing awInfo.context reads (around line 518 for setup, 757 for conclusion):consttriggerItemType=typeofawInfo.context?.item_type==="string" ? awInfo.context.item_type : "";consttriggerItemNumber=typeofawInfo.context?.item_number==="string" ? awInfo.context.item_number : "";consttriggerLabel=typeofawInfo.context?.trigger_label==="string" ? awInfo.context.trigger_label : "";// In the attributes array:if(triggerItemType){attributes.push(buildAttr("gh-aw.trigger.item_type",triggerItemType));}if(triggerItemNumber){attributes.push(buildAttr("gh-aw.trigger.item_number",triggerItemNumber));}if(triggerLabel){attributes.push(buildAttr("gh-aw.trigger.label",triggerLabel));}
These three attributes are non-sensitive (item types are enum values, item numbers are public GitHub resource IDs) and do not need to be added to the redaction pattern in SENSITIVE_ATTR_KEY_RE.
Expected Outcome
After this change:
In Grafana / Honeycomb / Datadog: spans can be grouped by gh-aw.trigger.item_type ("issue" vs "pull_request" vs "discussion") and filtered by gh-aw.trigger.item_number to find all runs associated with a specific GitHub item.
In the JSONL mirror: /tmp/gh-aw/otel.jsonl will include trigger context on every span, making the artifact immediately useful for "which issue triggered this failing run?" without opening the GitHub Actions UI.
For on-call engineers: the first thing visible in any span detail view will identify the triggering item, reducing the time-to-context from ~3 navigation steps to zero.
Implementation Steps
In actions/setup/js/send_otlp_span.cjs, add reads for awInfo.context.item_type, awInfo.context.item_number, and awInfo.context.trigger_label in both sendJobSetupSpan (after line 518) and sendJobConclusionSpan (after line 757)
Emit gh-aw.trigger.item_type, gh-aw.trigger.item_number, and gh-aw.trigger.label as conditional span attributes in both functions
Update actions/setup/js/action_otlp.test.cjs to assert that setup and conclusion spans include trigger attributes when awInfo.context provides them
Add a test case for the empty-string fallback (no item context for push/workflow_dispatch events) to confirm no spurious attributes are emitted
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 server returned an empty tool list ([]) during this analysis run, so live span payload inspection was not possible. The gap is confirmed entirely from static code analysis:
buildAwContext() (aw_context.cjs:143β179) populates item_type, item_number, comment_id, and trigger_label on every workflow invocation.
These fields are serialized into aw_info.json under the context key.
Both sendJobSetupSpan and sendJobConclusionSpan read awInfo.context for OTel propagation fields (otel_trace_id, otel_parent_span_id, deployment_state) but make no mention of item_type, item_number, or trigger_label.
A grep -rn "item_type\|item_number\|trigger_label" actions/setup/js/send_otlp_span.cjs returns zero matches, confirming these attributes are never emitted.
Related Files
actions/setup/js/send_otlp_span.cjs β primary change target (both sendJobSetupSpan and sendJobConclusionSpan)
actions/setup/js/aw_context.cjs β source of truth for trigger item context (buildAwContext)
π‘ OTel Instrumentation Improvement: Add Trigger Item Context to All Spans
Analysis Date: 2026-04-28
Priority: High
Effort: Small (< 2h)
Problem
Every
gh-awworkflow is triggered by a specific GitHub item β an issue, a pull request, a discussion, or a check run. ThebuildAwContext()function inaw_context.cjsresolves these details (item_type,item_number,comment_id,trigger_label) from the event payload and writes them toaw_info.jsonundercontext.However, neither
sendJobSetupSpannorsendJobConclusionSpaninsend_otlp_span.cjsreads these fields or emits them as span attributes. As a result, every OTel span is completely blind to what triggered the workflow. A DevOps engineer looking at a failing span in Grafana or Honeycomb cannot answer:This is the most operationally valuable missing attribute: it directly links every trace to a concrete, actionable GitHub item.
Why This Matters (DevOps Perspective)
Without item context, correlating a failed span back to its triggering GitHub item requires:
With
gh-aw.trigger.item_typeandgh-aw.trigger.item_numberon every span, engineers can:Current Behavior
In
actions/setup/js/aw_context.cjs,buildAwContext()resolves full item context:In
send_otlp_span.cjs,sendJobSetupSpanreadsawInfo.contextfor OTel propagation fields only:The same gap exists in
sendJobConclusionSpan(lines 692, 757).Proposed Change
In
sendJobSetupSpanandsendJobConclusionSpan, read the four trigger-context fields fromawInfo.contextand emit them as span attributes.These three attributes are non-sensitive (item types are enum values, item numbers are public GitHub resource IDs) and do not need to be added to the redaction pattern in
SENSITIVE_ATTR_KEY_RE.Expected Outcome
After this change:
gh-aw.trigger.item_type("issue" vs "pull_request" vs "discussion") and filtered bygh-aw.trigger.item_numberto find all runs associated with a specific GitHub item./tmp/gh-aw/otel.jsonlwill include trigger context on every span, making the artifact immediately useful for "which issue triggered this failing run?" without opening the GitHub Actions UI.Implementation Steps
actions/setup/js/send_otlp_span.cjs, add reads forawInfo.context.item_type,awInfo.context.item_number, andawInfo.context.trigger_labelin bothsendJobSetupSpan(after line 518) andsendJobConclusionSpan(after line 757)gh-aw.trigger.item_type,gh-aw.trigger.item_number, andgh-aw.trigger.labelas conditional span attributes in both functionsactions/setup/js/action_otlp.test.cjsto assert that setup and conclusion spans include trigger attributes whenawInfo.contextprovides thempush/workflow_dispatchevents) to confirm no spurious attributes are emittedcd actions/setup/js && npx vitest runto confirm tests passmake fmtto ensure formattingEvidence from Live Sentry Data
The Sentry MCP server returned an empty tool list (
[]) during this analysis run, so live span payload inspection was not possible. The gap is confirmed entirely from static code analysis:buildAwContext()(aw_context.cjs:143β179) populatesitem_type,item_number,comment_id, andtrigger_labelon every workflow invocation.aw_info.jsonunder thecontextkey.sendJobSetupSpanandsendJobConclusionSpanreadawInfo.contextfor OTel propagation fields (otel_trace_id,otel_parent_span_id,deployment_state) but make no mention ofitem_type,item_number, ortrigger_label.grep -rn "item_type\|item_number\|trigger_label" actions/setup/js/send_otlp_span.cjsreturns zero matches, confirming these attributes are never emitted.Related Files
actions/setup/js/send_otlp_span.cjsβ primary change target (bothsendJobSetupSpanandsendJobConclusionSpan)actions/setup/js/aw_context.cjsβ source of truth for trigger item context (buildAwContext)actions/setup/js/action_setup_otlp.cjsβ callssendJobSetupSpanactions/setup/js/action_conclusion_otlp.cjsβ callssendJobConclusionSpanactions/setup/js/action_otlp.test.cjsβ test file to update with new attribute assertionsGenerated by the Daily OTel Instrumentation Advisor workflow