Skip to content

fix(cli): concurrent deploy telemetry events share an event id - #2128

Closed
9pace wants to merge 1 commit into
aws:mainfrom
9pace:fix/telemetry-event-id-race
Closed

9pace wants to merge 1 commit into
aws:mainfrom
9pace:fix/telemetry-event-id-race

Conversation

@9pace

@9pace 9pace commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #

TelemetrySession.emit() increments this.count, then for DEPLOY events awaits trackDeployStatistics() (a read and write of the telemetry state file), and only then builds eventId from this.count. With --concurrency, other events are emitted during that await, so several DEPLOY events read the same final count and are sent with the same eventId.

We saw this in the telemetry data as repeated event IDs on CLI versions after the subprocess sender, mostly DEPLOY events in the same request with different contents.

This takes the event id and timestamp at the start of emit(), before the await. The timestamp had the same problem, it recorded when the state file write finished.

withTelemetryState is also an unlocked read and write, so concurrent DEPLOY events can lose updates to sequentialDeploymentFailures. Not changed here.

Added a unit test that emits two DEPLOY events at once and checks they get :1 and :2. On main both get :2. Ran the session.test.ts suite and eslint for aws-cdk.

Checklist

  • This change contains a major version upgrade for a dependency and I confirm all breaking changes are addressed
    • Release notes for the new version:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions Bot added the p2 label Nov 5, 2026
@9pace 9pace closed this Nov 5, 2026
@9pace
9pace deleted the fix/telemetry-event-id-race branch November 5, 2026 16:31
@codecov-commenter

codecov-commenter commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.06%. Comparing base (611e948) to head (0d9e90b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2128   +/-   ##
=======================================
  Coverage   92.05%   92.06%           
=======================================
  Files          82       82           
  Lines       13195    13199    +4     
  Branches     1894     1897    +3     
=======================================
+ Hits        12146    12151    +5     
+ Misses       1011     1010    -1     
  Partials       38       38           
Flag Coverage Δ
suite.unit 92.06% <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 is waiting to be deployed

1 failed, 2 inactive, and 1 waiting deployments
run-tests — 0d9e90b7 Deployed Nov 5, 2026 by 9pace via integ_init-templates (init-fsharp, 24.19) #7633
no-approval — 0d9e90b7 Deployed Nov 5, 2026 by 9pace via prepare #7633
automation — 0d9e90b7 Deployed Nov 5, 2026 by 9pace via Set AutoQueue on PR #2129 #3957
integ-approval — 0d9e90b7 Waiting Nov 5, 2026 by 9pace via prepare #7632
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants