Skip to content

Add telemetry status reporting to upload-code-coverage Action#15

Open
akream wants to merge 3 commits into
mainfrom
akream/action-telemetry
Open

Add telemetry status reporting to upload-code-coverage Action#15
akream wants to merge 3 commits into
mainfrom
akream/action-telemetry

Conversation

@akream

@akream akream commented Jun 16, 2026

Copy link
Copy Markdown

Instrument the action to report status to the monolith endpoint at start and end of execution, following the CodeQL Action pattern.

  • Add status_report.py: telemetry module calling PUT /repos/{repo}/code-coverage/action/status with action metadata, runner info, timing, payload size, outcome, workflow & git context
  • Instrument upload_coverage.py: send 'starting' report at entry, 'success'/'failure'/'user-error' at exit with duration and error info
  • Add post_upload_coverage.py: post step that sends 'aborted' if main step didn't report completion (cancelled/crashed workflows)
  • Update action.yml: add always-run post step for telemetry
  • Add test_status_report.py with full coverage of the new module
  • Update test_upload_coverage.py with telemetry integration tests
  • Update CI to run new test file

Telemetry never causes the action to fail - all calls are wrapped in try/catch with 30s timeout and failures logged as warnings.

The monolith PR to enable the endpoint is now merged an has been verified: https://github.com/github/github/pull/436372

Splunk log

Instrument the action to report status to the monolith endpoint at
start and end of execution, following the CodeQL Action pattern.

- Add status_report.py: telemetry module calling
  PUT /repos/{repo}/code-coverage/action/status with action metadata,
  runner info, timing, payload size, outcome, workflow & git context
- Instrument upload_coverage.py: send 'starting' report at entry,
  'success'/'failure'/'user-error' at exit with duration and error info
- Add post_upload_coverage.py: post step that sends 'aborted' if main
  step didn't report completion (cancelled/crashed workflows)
- Update action.yml: add always-run post step for telemetry
- Add test_status_report.py with full coverage of the new module
- Update test_upload_coverage.py with telemetry integration tests
- Update CI to run new test file

Telemetry never causes the action to fail - all calls are wrapped in
try/catch with 30s timeout and failures logged as warnings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@akream akream marked this pull request as ready for review June 19, 2026 15:17
Copilot AI review requested due to automatic review settings June 19, 2026 15:17

Copilot AI left a comment

Copy link
Copy Markdown

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 adds telemetry status reporting to the upload-code-coverage composite Action, emitting a “starting” report at entry and a terminal status (“success”/“failure”/“user-error”), plus a post-step fallback intended to report “aborted” when the main step doesn’t complete. It also introduces unit tests for the new telemetry module and integrates telemetry assertions into existing upload tests.

Changes:

  • Add status_report.py to build/send telemetry payloads and persist Action state for a post step.
  • Instrument upload_coverage.py to send telemetry at start and completion, including timing and payload size.
  • Add post_upload_coverage.py and wire it into action.yml as an always() post step; update CI to run the new tests.
Show a summary per file
File Description
upload_coverage.py Adds telemetry start/completion reporting and persists state for post-step behavior.
status_report.py Implements telemetry report construction, HTTP PUT sender, and state helpers.
post_upload_coverage.py Adds post-step script intended to emit “aborted” when main step didn’t complete.
action.yml Adds an always-run post step for telemetry.
test_upload_coverage.py Adds integration-style tests asserting telemetry calls and payload fields.
test_status_report.py Adds unit tests for telemetry report building/sending and state helpers.
.github/workflows/ci.yml Runs the new telemetry test module in CI.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 7/7 changed files
  • Comments generated: 7

Comment thread upload_coverage.py
Comment thread upload_coverage.py Outdated
Comment thread status_report.py
Comment thread status_report.py Outdated
Comment thread post_upload_coverage.py
Comment thread action.yml
Comment thread post_upload_coverage.py
akream and others added 2 commits June 19, 2026 16:35
- Persist started_at and starting_report to state immediately so the
  post step has full context even if main exits early
- Only set status_sent when send_status_report() returns True
- Check HTTP response code in send_status_report(); treat non-2xx as
  failure and return False
- Fix action_oid to resolve symbolic refs and validate 40-hex SHA
- Rework post step to retry saved completed_report, or build aborted
  report from saved starting_report (no private helper calls)
- Add input env vars to post step in action.yml
- Add test_post_upload_coverage.py with 5 tests for post step logic

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Actions are downloaded as tarballs — there's no .git directory at
GITHUB_ACTION_PATH. The CodeQL action also hardcodes action_oid as
'unknown'. We already capture GITHUB_ACTION_REF as action_ref which
provides the version the caller specified.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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