fix: use actual job name in OTLP span names (#fix-span-names)#24648
fix: use actual job name in OTLP span names (#fix-span-names)#24648
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/dbbf08d1-3791-4538-9e1c-c1ef392a1c7e Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…nclusion) Agent-Logs-Url: https://github.com/github/gh-aw/sessions/dbbf08d1-3791-4538-9e1c-c1ef392a1c7e Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot recompile |
Ran Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot make sure the job name is passed to the setup action with as a builtin github action env var or a with input at the setup action call site |
Already in place. The compiler's - name: Setup Scripts
id: setup
uses: ./actions/setup
with:
destination: ${{ runner.temp }}/gh-aw/actions
job-name: ${{ github.job }}This was pre-existing behaviour — my PR relies on it to populate |
There was a problem hiding this comment.
Pull request overview
Updates OTLP span naming so setup/conclusion spans include the actual job name (via job-name input) instead of a generic job segment, improving trace readability.
Changes:
- Build setup span names as
gh-aw.<jobName>.setupwhenINPUT_JOB_NAMEis set (with fallback togh-aw.job.setup). - Build conclusion span names as
gh-aw.<jobName>.conclusionwhenINPUT_JOB_NAMEis set (with fallback togh-aw.job.conclusion). - Update related comments/docs and adjust tests to assert the new span names.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/send_otlp_span.cjs | Constructs setup span name using the provided job name (fallback preserved). |
| actions/setup/js/action_conclusion_otlp.cjs | Updates conclusion span name format to include job name (fallback preserved). |
| actions/setup/js/send_otlp_span.test.cjs | Updates setup-span tests to expect gh-aw.<jobName>.setup. |
| actions/setup/js/action_otlp.test.cjs | Updates conclusion-span tests to expect gh-aw.<jobName>.conclusion and fallback behavior. |
| actions/setup/action.yml | Updates input/output descriptions to reflect new span naming. |
| actions/setup/index.js | Updates inline comment about setup span naming. |
| actions/setup/post.js | Updates inline comment about conclusion span naming. |
| actions/setup/js/action_setup_otlp.cjs | Updates header comment for setup span naming. |
| .github/workflows/hourly-ci-cleaner.lock.yml | Modifies frontmatter-stripping awk logic and threat-detection CLI args (appears unrelated to span naming). |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
actions/setup/action.yml:27
- Same placeholder ambiguity here:
gh-aw.<job-name>.setupcould be misread as a literal segment instead of the resolved job name value. Aligning this placeholder with the rest of the docs (<jobName>) would make the output description clearer.
files_copied:
description: 'Number of files copied'
trace-id:
description: 'The OTLP trace ID used for the gh-aw.<job-name>.setup span. Pass this to subsequent job setup steps via the trace-id input to correlate all job spans under a single trace.'
- Files reviewed: 9/9 changed files
- Comments generated: 6
| AGENT_CONTENT="$(awk 'NR==1 && /^---$/ { in_frontmatter=1; next } in_frontmatter && /^---$/ { in_frontmatter=0; next } !in_frontmatter { print }' "${GITHUB_WORKSPACE}/.github/agents/ci-cleaner.agent.md")" | ||
| # Combine agent content with prompt | ||
| PROMPT_TEXT="$(printf '%s\n\n%s' "$AGENT_CONTENT" "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)")" | ||
| AGENT_CONTENT="$(awk 'BEGIN{skip=1} /^---$/{if(skip){skip=0;next}else{skip=1;next}} !skip' "${GITHUB_WORKSPACE}/.github/agents/ci-cleaner.agent.md")" |
There was a problem hiding this comment.
The new awk script flips the frontmatter logic: with skip starting at 1, it prints the lines between the first and second --- and suppresses the body after the closing ---. This will set AGENT_CONTENT to the frontmatter (e.g., description: ...) instead of the agent instructions. Suggest reverting to the previous in_frontmatter approach or adjusting the state machine so content is emitted only after the closing ---.
| AGENT_CONTENT="$(awk 'BEGIN{skip=1} /^---$/{if(skip){skip=0;next}else{skip=1;next}} !skip' "${GITHUB_WORKSPACE}/.github/agents/ci-cleaner.agent.md")" | |
| AGENT_CONTENT="$(awk 'BEGIN{in_frontmatter=1} /^---$/{if(in_frontmatter){in_frontmatter=0; next}} !in_frontmatter' "${GITHUB_WORKSPACE}/.github/agents/ci-cleaner.agent.md")" |
| run: | | ||
| set -o pipefail | ||
| # Extract markdown body from custom agent file (skip frontmatter) | ||
| AGENT_CONTENT="$(awk 'NR==1 && /^---$/ { in_frontmatter=1; next } in_frontmatter && /^---$/ { in_frontmatter=0; next } !in_frontmatter { print }' "${GITHUB_WORKSPACE}/.github/agents/ci-cleaner.agent.md")" | ||
| # Combine agent content with prompt | ||
| PROMPT_TEXT="$(printf '%s\n\n%s' "$AGENT_CONTENT" "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)")" | ||
| AGENT_CONTENT="$(awk 'BEGIN{skip=1} /^---$/{if(skip){skip=0;next}else{skip=1;next}} !skip' "${GITHUB_WORKSPACE}/.github/agents/ci-cleaner.agent.md")" | ||
| # Combine agent content with prompt | ||
| PROMPT_TEXT="$(printf '%s\n\n%s' "$AGENT_CONTENT" "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)")" |
There was a problem hiding this comment.
This workflow hunk changes the logic/formatting of how agent frontmatter is stripped (and also later changes the threat-detection --debug-file argument). These changes don't appear related to the PR’s stated goal of updating OTLP span names, so they look like an accidental/unrelated modification. If intentional, please update the PR description to mention the workflow behavior change; otherwise, consider dropping this workflow diff to keep the PR focused.
| job-name: | ||
| description: 'Name of the job being set up. When OTEL_EXPORTER_OTLP_ENDPOINT is configured, a gh-aw.job.setup span is pushed to the OTLP endpoint.' | ||
| description: 'Name of the job being set up. When OTEL_EXPORTER_OTLP_ENDPOINT is configured, a gh-aw.<job-name>.setup span is pushed to the OTLP endpoint.' | ||
| required: false | ||
| default: '' |
There was a problem hiding this comment.
In this description, gh-aw.<job-name>.setup reads like it might literally include the input name (job-name) rather than the value of the job name. Elsewhere in the code/comments you use gh-aw.<jobName>...; consider using the same placeholder here (or explicitly say “”) to avoid confusion.
This issue also appears on line 23 of the same file.
| // Send a gh-aw.<jobName>.conclusion span to the configured OTLP endpoint, if any. | ||
| // Delegates to action_conclusion_otlp.cjs so that script mode (clean.sh) and | ||
| // dev/release mode share the same implementation. Non-fatal: errors are | ||
| // handled inside sendJobConclusionSpan via console.warn. |
There was a problem hiding this comment.
This comment implies the conclusion span will always be gh-aw.<jobName>.conclusion, but action_conclusion_otlp.cjs falls back to gh-aw.job.conclusion when INPUT_JOB_NAME isn’t set. Consider mentioning the fallback here to keep the comment accurate.
| // Send a gh-aw.<jobName>.conclusion span to the configured OTLP endpoint, if any. | |
| // Delegates to action_conclusion_otlp.cjs so that script mode (clean.sh) and | |
| // dev/release mode share the same implementation. Non-fatal: errors are | |
| // handled inside sendJobConclusionSpan via console.warn. | |
| // Send a job conclusion span to the configured OTLP endpoint, if any: | |
| // gh-aw.<jobName>.conclusion when INPUT_JOB_NAME is set, otherwise | |
| // gh-aw.job.conclusion. Delegates to action_conclusion_otlp.cjs so that | |
| // script mode (clean.sh) and dev/release mode share the same implementation. | |
| // Non-fatal: errors are handled inside sendJobConclusionSpan via console.warn. |
| } | ||
|
|
||
| // Send a gh-aw.job.setup span to the OTLP endpoint when configured. | ||
| // Send a gh-aw.<jobName>.setup span to the OTLP endpoint when configured. |
There was a problem hiding this comment.
This comment suggests the setup span is always gh-aw.<jobName>.setup, but sendJobSetupSpan falls back to gh-aw.job.setup when INPUT_JOB_NAME isn’t set. Consider noting the fallback here to match the actual behavior (and the PR description).
| // Send a gh-aw.<jobName>.setup span to the OTLP endpoint when configured. | |
| // Send a setup span to the OTLP endpoint when configured: | |
| // gh-aw.<jobName>.setup, or gh-aw.job.setup when INPUT_JOB_NAME is unset. |
| * action_setup_otlp.cjs | ||
| * | ||
| * Sends a gh-aw.job.setup OTLP span and writes the trace/span IDs to | ||
| * Sends a `gh-aw.<jobName>.setup` OTLP span and writes the trace/span IDs to |
There was a problem hiding this comment.
Header comment says this always sends gh-aw.<jobName>.setup, but sendJobSetupSpan falls back to gh-aw.job.setup when no job name is configured. Consider updating the comment to reflect the fallback behavior.
| * Sends a `gh-aw.<jobName>.setup` OTLP span and writes the trace/span IDs to | |
| * Sends a `gh-aw.<jobName>.setup` OTLP span when a job name is configured, | |
| * or falls back to `gh-aw.job.setup`, and writes the trace/span IDs to |
Summary
Updates OTLP span names to include the actual job name instead of the generic
jobsegment, making traces much easier to distinguish at a glance.Before:
After:
Falls back to
gh-aw.job.setup/gh-aw.job.conclusionwhen nojob-nameinput is configured.Changes
send_otlp_span.cjs:sendJobSetupSpannow constructs the span name as`gh-aw.${jobName}.setup`whenINPUT_JOB_NAMEis setaction_conclusion_otlp.cjs: conclusion span name changed from`gh-aw.job.${name}`to`gh-aw.${name}.conclusion`action.yml,index.js,post.js,action_setup_otlp.cjssend_otlp_span.test.cjsandaction_otlp.test.cjs