Skip to content

Add integration test for workflow-level and job-level instrumentation - #4847

Open
plengauer wants to merge 10 commits into
mainfrom
claude/github-workflow-instrumentation-test-ufsd16
Open

plengauer wants to merge 10 commits into
mainfrom
claude/github-workflow-instrumentation-test-ufsd16

Conversation

@plengauer

Copy link
Copy Markdown
Owner

Adds integration-workflow-job-instrumentation to test_github.yml. It needs all five *-smoke jobs of that file (and the same secret/fork guard as deploy).

What it does:

  1. Creates a fresh, uniquely named public repository with the test token and sets the same OTEL_EXPORTER_OTLP_ENDPOINT/OTEL_EXPORTER_OTLP_HEADERS as secrets in it.
  2. Deploys the instrumentation from the ref under test (README snippet, uses: <this repo>/actions/instrument/deploy@<inputs.ref>) and waits until it is done.
  3. Adds six workflows (tests/github/propagation/workflows) so the deployment instruments them, waits until they are instrumented, then kicks off the chain: Test push -> repository_dispatch -> Test repository_dispatch -> workflow_dispatch -> Test workflow_dispatch -> workflow_run -> Test workflow_run -> push -> Test push 2 -> issue -> Test issues. Both multi-job workflows go through the workflow-level exporter, the single-job ones through only_job.
  4. Waits for the runs on GitHub, installs dtctl, and queries all spans of the repository from Dynatrace every 5 minutes (up to 10 attempts).
  5. tests/github/propagation/assert.sh asserts: all workflow and job spans present exactly once with the expected event/conclusion/kind, one trace for the whole chain, one root, no orphaned spans, and that each hop's workflow span descends from the right job of the upstream workflow (for workflow_run: parent is the upstream workflow span).
  6. Always deletes the repository in a final if: always() step.

Verification done locally: assert.sh against synthetic span data (one passing trace in three record shapes, nine broken variants), the deployment wait logic against a mocked deployed repo with real yq, shellcheck, yamllint. The workflow itself has not run yet.

Assumptions to review:

  • The Dynatrace token is secrets.DYNATRACE_MCP_TOKEN (the only Dynatrace secret in the repo) and is a platform token with storage:spans:read. The environment URL is derived from the OTLP endpoint secret.
  • The dtctl query -o json output shape and the flat dotted span field names (trace.id, span.parent_id, github.actions.*) are taken from docs, not observed. The assertions also accept {records: [...]} and nested records.
  • Push propagation needs ACTIONS_RUNTIME_TOKEN, which run steps do not have by default, so Test workflow_run exports it via actions/github-script.
  • The second push hop is named Test push 2 (two hops share the push trigger).
  • The hop-1 push comes from the test job into another repository, so Test push is expected to be the trace root.

Generated by Claude Code

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

✅⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Max errors Warnings Elapsed time
✅ ACTION actionlint 1 0 0 2.43s
✅ ACTION zizmor 1 0 0 8.29s
✅ BASH shellcheck 1 0 0 0.2s
✅ BASH shfmt 1 0 0 1.0s
✅ COPYPASTE jscpd yes no no 1.03s
✅ REPOSITORY betterleaks yes no no 7.92s
✅ REPOSITORY checkov yes no no 39.37s
✅ REPOSITORY dustilock yes no no 18.55s
✅ REPOSITORY git_diff yes no no 0.22s
⚠️ REPOSITORY grype yes no 1 81.04s
✅ REPOSITORY kingfisher yes no no 6.57s
✅ REPOSITORY osv-scanner yes no no 7.33s
✅ REPOSITORY secretlint yes no no 2.22s
✅ REPOSITORY syft yes no no 2.66s
✅ REPOSITORY trivy yes no no 15.07s
✅ REPOSITORY trivy-sbom yes no no 0.38s
✅ REPOSITORY trufflehog yes no no 4.54s
✅ SPELL lychee 8 0 0 2.85s
✅ YAML v8r 7 0 0 3.43s
✅ YAML yamllint 8 0 0 2.49s

Detailed Issues

⚠️ REPOSITORY / grype - 1 warning
warning: A medium vulnerability in github-action package: anthropics/claude-code-action, version v1 was found at: /.github/workflows/claude.yml

warning: 1 warnings emitted

See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is provided by OX Security
Show us your support by starring ⭐ the repository

Copy link
Copy Markdown
Owner Author

ci / build / verify-deb-dependencies failed with find UNAVAILABLE (an apt-file search lookup at runtime, job log). This PR only adds tests/github/propagation/** and one job in test_github.yml; src/ is identical to main (bd10fab), so I do not think it is caused by this change. I will re-run that job once the run has finished (GitHub refuses a re-run while the run is in progress).


Generated by Claude Code

@plengauer plengauer self-assigned this Dec 3, 2026
@plengauer
plengauer marked this pull request as ready for review December 3, 2026 11:05
@plengauer
plengauer requested a review from moflwi as a code owner December 3, 2026 11:05
@plengauer
plengauer enabled auto-merge (squash) December 3, 2026 11:05
… with trace propagation across triggers

Creates a fresh repository, deploys the instrumentation from the ref under test,
chains workflows via push, repository_dispatch, workflow_dispatch, workflow_run,
push, and issues, then asserts the spans queried from Dynatrace via dtctl.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WAy2Ncu8chY8CdC8qK7EYT
@plengauer
plengauer force-pushed the claude/github-workflow-instrumentation-test-ufsd16 branch from 66c2cca to f814f39 Compare December 3, 2026 17:46
claude and others added 8 commits December 3, 2026 20:46
…ory instrumentation does not exist yet

The exclusion filter read a non-existent input name and cat'ed instrumentation files that are not deployed yet. The resulting empty pattern made 'grep -vF' drop every name and exit 1, which failed the step under pipefail. Build the exclusion list from the files that exist instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WAy2Ncu8chY8CdC8qK7EYT
…tation-test-ufsd16' into claude/github-workflow-instrumentation-test-ufsd16
Sign up for free to 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.

2 participants