Skip to content

feat(telemetry): record interrupts as cancelled, add ci_provider and is_wsl, send cli_version with every event - #1737

Draft
Lena Forlin (moshimorschi) wants to merge 1 commit into
mainfrom
feat/telemetry-command-tags
Draft

Lena Forlin (moshimorschi) wants to merge 1 commit into
mainfrom
feat/telemetry-command-tags

Conversation

@moshimorschi

Copy link
Copy Markdown
Contributor

What changed?

Four small telemetry changes to the command event and the shared tracking code. No event name changes, so the telemetry pipeline's allow-list stays as it is.

  • Interrupted runs are recorded as cancelled. Until now a run stopped with Ctrl+C or SIGTERM counted as failure whenever the command returned its child process's exit error instead of the context error, which is what the watcher commands do. The tracker now also looks at the interrupted context. A run that still finished successfully stays success.
  • ci_provider tag on the command event. github, gitlab or bitbucket; other when CI is detected without a known provider; no tag at all outside CI.
  • is_wsl tag on the command event. true when a Linux run happens inside the Windows Subsystem for Linux, false otherwise, using the WSL detection the proxy code already has.
  • cli_version on every event. The shared Track function adds it to any event that does not set it, on a copy of the caller's tags, so the Dev TUI events carry it too. An explicitly set value wins.

Tags of a command event after this change, captured from the built binary with a local UDP listener and shortened. The first run is a developer machine, the second the same run with the GitHub Actions variable set:

{"command_name": "extension.validate", "result": "failure", "cli_version": "dev", "os": "linux", "is_tui": "false", "is_wsl": "false"}
{"command_name": "extension.validate", "result": "failure", "cli_version": "dev", "os": "linux", "is_tui": "false", "is_wsl": "false", "ci_provider": "github"}

docs/TELEMETRY.md documents the two tags, the result rule and the version on every event.

Why?

These are the four smallest items of the telemetry improvements the DX tools team is working through. The data could not tell CI runs from people, could not separate WSL from native Linux, counted Ctrl+C on long-running commands as failures, and could not exclude dev builds from Dev TUI events because those carried no version.

Two effects to expect in the dashboards once a release with this change is in use: failure rates of the watcher commands drop, because interrupted runs no longer count as failures, and Dev TUI events can be filtered by cli_version like the command event.

How was this tested?

  • Unit tests: the result rule (interrupted context with a child exit error, interrupted context with a successful run), the provider detection for each CI system, the new tags on the command event, and the version on every event including the explicit-value case. The Dev TUI package tests run through the changed Track path.
  • Real payloads: the built binary was run against a local UDP listener; the tags above are those captures.
  • Interrupt handling end to end: project console with a PHP child received a terminal-style SIGINT to its whole process group, on main and on this branch. Both recorded cancelled, so that command already wrapped the cancellation. The watcher commands, where the old classification was wrong, need a full shop with built assets to run and were not exercised; the unit test covers their case.
  • Lint reports no issues; the cmd, tracking, system and Dev TUI packages pass.

Related issue or discussion

Part of the DX tools telemetry improvements. The Ctrl+C classification was already listed as a known trap in the team's telemetry analysis notes.

…is_wsl, send cli_version with every event

A run stopped with Ctrl+C or SIGTERM counted as a failure whenever the command returned its child's exit error instead of the context error; the tracker now also looks at the interrupted context. The command event gains ci_provider (github, gitlab, bitbucket, other; absent outside CI) and is_wsl. Track adds cli_version to every event that does not set it, so Dev TUI events can exclude dev builds too.
@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.52%. Comparing base (5ed3f7c) to head (b9fff16).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1737      +/-   ##
==========================================
+ Coverage   66.50%   66.52%   +0.01%     
==========================================
  Files         479      479              
  Lines       32539    32549      +10     
==========================================
+ Hits        21641    21652      +11     
+ Misses      10898    10897       -1     
Flag Coverage Δ
go-test 66.52% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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