Ensure gh-aw.aic is emitted on conclusion spans when INPUT_JOB_NAME is missing#38510
Merged
Conversation
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix AIC consumption metric reporting issue
Ensure Jun 11, 2026
gh-aw.aic is emitted on conclusion spans when INPUT_JOB_NAME is missing
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an observability gap where conclusion spans could skip emitting the numeric gh-aw.aic attribute when INPUT_JOB_NAME was not present in certain post-step execution paths, preventing reliable querying/aggregation in Sentry/Tempo.
Changes:
- Added
resolveConclusionJobName(spanName)to derive the job name fromINPUT_JOB_NAME, or fall back to parsinggh-aw.<job>.conclusion. - Updated
sendJobConclusionSpanto use the resolved job name before computingjobEmitsOwnTokenUsage(restoringgh-aw.aicemission for affected conclusion spans). - Added a regression test covering missing
INPUT_JOB_NAMEwith span namegh-aw.agent.conclusionand verifying numericgh-aw.aicemission fromGH_AW_AIC.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/send_otlp_span.cjs | Adds job-name resolution fallback for conclusion spans to ensure gh-aw.aic is emitted when INPUT_JOB_NAME is missing. |
| actions/setup/js/send_otlp_span.test.cjs | Adds a regression test verifying gh-aw.aic is included when INPUT_JOB_NAME is absent but the span name identifies the job. |
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: 0
This was referenced Jun 11, 2026
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.
The daily AIC report showed an observability gap: AIC could not be queried in Sentry/Tempo even though OTLP spans were flowing. The missing signal came from conclusion spans that skipped AIC emission when
INPUT_JOB_NAMEwas absent in some post-step execution paths.Root cause addressed
sendJobConclusionSpangated AIC emission onjobEmitsOwnTokenUsage, which depended only onINPUT_JOB_NAME.INPUT_JOB_NAME, spans likegh-aw.agent.conclusiondid not emitgh-aw.aic.Implementation change
resolveConclusionJobName(spanName)inactions/setup/js/send_otlp_span.cjs.INPUT_JOB_NAMEwhen presentgh-aw.<job>.conclusionsendJobConclusionSpannow uses this resolver before computingjobEmitsOwnTokenUsage.Coverage update
actions/setup/js/send_otlp_span.test.cjsfor:INPUT_JOB_NAMEgh-aw.agent.conclusiongh-aw.aicemission fromGH_AW_AIC.