Skip to content

Add AWF/AWMG runtime versions to OTLP resource attributes - #33030

Merged
pelikhan merged 2 commits into
mainfrom
copilot/otel-advisor-add-gh-aw-versions
May 18, 2026
Merged

Add AWF/AWMG runtime versions to OTLP resource attributes#33030
pelikhan merged 2 commits into
mainfrom
copilot/otel-advisor-add-gh-aw-versions

Conversation

CopilotAI commented May 18, 2026

Copy link
Copy Markdown
Contributor

OTLP spans already carried the gh-aw CLI service.version, but not the AWF and MCP gateway runtime versions that actually executed the workflow. That left incident correlation blind to runtime version bumps even though both values were already written to /tmp/gh-aw/aw_info.json.

  • What changed

    • Extended shared OTLP resource attribute construction to emit:
      • gh-aw.awf.version
      • gh-aw.awmg.version
    • Read both values from aw_info.json with env-var fallbacks for cases where runtime metadata is not available from disk.
  • Where it now applies

    • Job setup spans in send_otlp_span.cjs
    • Job conclusion spans in send_otlp_span.cjs
    • Generic tool spans in otlp.cjs
  • Why this matters

    • Makes runtime incident analysis distinguish:
      • gh-aw CLI version (service.version)
      • AWF runtime version (gh-aw.awf.version)
      • MCP gateway version (gh-aw.awmg.version)
    • Enables direct filtering and correlation when workflow behavior changes after AWF/AWMG bumps.
  • Coverage added

    • Added focused tests to verify the new resource attributes are propagated from aw_info.json for setup spans, conclusion spans, and generic OTLP tool spans.
constresourceAttributes=buildGitHubActionsResourceAttributes({
repository,
runId,
awfVersion,
awmgVersion,
staged,
runAttempt,});

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
CopilotAI changed the title [WIP] Add gh-aw.awf.version and gh-aw.awmg.version resource attributesAdd AWF/AWMG runtime versions to OTLP resource attributesMay 18, 2026
CopilotAI requested a review from pelikhanMay 18, 2026 13:16
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot recompile and ensure the version envs are set in the compiled lock file

CopilotAI commented May 18, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot recompile and ensure the version envs are set in the compiled lock file

I recompiled smoke-otel-backends locally and rechecked the generated lock; it stays clean because the compiled workflow already emits GH_AW_INFO_AWF_VERSION / GH_AW_INFO_AWMG_VERSION in the lock file. The OTLP runtime change remains in c383626.

@github-actionsgithub-actionsBot mentioned this pull request May 18, 2026
@pelikhan
pelikhan marked this pull request as ready for review May 18, 2026 13:44
CopilotAI review requested due to automatic review settings May 18, 2026 13:44
@pelikhan
pelikhan merged commit 6d33189 into mainMay 18, 2026
3 checks passed
@pelikhan
pelikhan deleted the copilot/otel-advisor-add-gh-aw-versions branch May 18, 2026 13:45

CopilotAI 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 OTLP resource attribute generation to include the AWF runtime and MCP gateway runtime versions (sourced from /tmp/gh-aw/aw_info.json with env-var fallbacks) so traces can be correlated against runtime version changes.

Changes:

  • Added gh-aw.awf.version and gh-aw.awmg.version to shared GitHub Actions OTLP resource attributes.
  • Plumbed awf_version / awmg_version from aw_info.json (with GH_AW_INFO_AWF_VERSION / GH_AW_INFO_AWMG_VERSION fallbacks) into setup, conclusion, and generic tool spans.
  • Added targeted tests to validate the new resource attributes across span types.
Show a summary per file
FileDescription
pkg/workflow/gh_cli_permissions.goFormatting/alignment cleanup in JSON struct definitions.
actions/setup/js/send_otlp_span.cjsEmits AWF/AWMG runtime versions as OTLP resource attributes and wires in aw_info/env fallbacks for setup & conclusion spans.
actions/setup/js/send_otlp_span.test.cjsAdds assertions that setup and conclusion span resources include gh-aw.awf.version / gh-aw.awmg.version.
actions/setup/js/otlp.cjsPasses AWF/AWMG runtime versions through to shared resource-attribute builder for generic tool spans.
actions/setup/js/otlp.test.cjsAdds assertion that logSpan forwards AWF/AWMG versions from aw_info.json into resource attribute construction.

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/js/send_otlp_span.test.cjs:4805

  • The sendJobConclusionSpan tests save/restore a fixed envKeys list, but it doesn't clear the new GH_AW_INFO_AWF_VERSION / GH_AW_INFO_AWMG_VERSION env-var fallbacks. If either is set in the ambient environment, conclusion-span tests (including this new one) can become flaky. Include these vars in envKeys (or delete/restore them in hooks) to keep tests deterministic.
 it("includes gh-aw.awf.version and gh-aw.awmg.version on conclusion span resources from aw_info.json", async () => {
const mockFetch = vi.fn().mockResolvedValue({ ok: true, status: 200, statusText: "OK" });
vi.stubGlobal("fetch", mockFetch);
process.env.GH_AW_OTLP_ENDPOINTS = JSON.stringify([{ url: "https://traces.example.com" }]);
  • Files reviewed: 4/5 changed files
  • Comments generated: 2

Comment on lines +1807 to +1812
it("includes gh-aw.awf.version and gh-aw.awmg.version resource attributes from aw_info.json", async () => {
const mockFetch = vi.fn().mockResolvedValue({ ok: true, status: 200, statusText: "OK" });
vi.stubGlobal("fetch", mockFetch);

process.env.GH_AW_OTLP_ENDPOINTS = JSON.stringify([{ url: "https://traces.example.com" }]);

Comment on lines +521 to +531
it("passes awfVersion and awmgVersion from aw_info.json to buildGitHubActionsResourceAttributes", async () => {
mockReadJSONIfExists.mockReturnValue({ awf_version: "v1.2.3-awf", awmg_version: "v4.5.6-awmg" });

await otlp.logSpan("my-scanner", {});

expect(mockBuildGitHubActionsResourceAttributes).toHaveBeenCalledWith(
expect.objectContaining({
awfVersion: "v1.2.3-awf",
awmgVersion: "v4.5.6-awmg",
})
);
Sign up for freeto 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] add gh-aw.awf.version and gh-aw.awmg.version resource attributes for runtime incident correlation

3 participants

@pelikhan