Repository navigation
fix(id): reset and cancel Data Streams state - #10341
Conversation
Overall package sizeSelf size: 8.97 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.5.1 | 127.66 kB | 513.61 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## tianning.li/microvm-buffer-reset-01-common-exporter-agent-spanstats-reset-and-cancel #10341 +/- ##
=========================================================================================================================
- Coverage 98.74% 87.48% -11.26%
=========================================================================================================================
Files 1029 1015 -14
Lines 161396 156099 -5297
Branches 74 74
=========================================================================================================================
- Hits 159374 136571 -22803
- Misses 2022 19528 +17506
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟡 Changes recommended
Production request cancellation is unavailable, and processor refresh handling can leave state uncleared.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR prevents Data Streams state from leaking across MicroVM identity refreshes.
Changes:
- Reset processor buckets and tags.
- Cancel pending writer requests and reject stale compression callbacks.
- Add focused processor and writer tests.
File summaries
| File | Summary |
|---|---|
packages/dd-trace/test/datastreams/writer.spec.js |
Tests request cancellation and stale payload handling. |
packages/dd-trace/test/datastreams/processor.spec.js |
Tests processor reset and subscription behavior. |
packages/dd-trace/src/datastreams/writer.js |
Adds reset integration and generation guards. Critical: the common request helper lacks the required reset-controller implementation. |
packages/dd-trace/src/datastreams/processor.js |
Resets processor state. Moderate: unconditional unsubscription can remove the active refresh handler. |
Review details
Suppressed comments (1)
packages/dd-trace/src/datastreams/processor.js:248
- This unsubscribe runs before the
this.enabledcheck, so constructing a disabledDataStreamsProcessorremoves the currently active processor's refresh handler and does not install a replacement. A later identity refresh will then leave that active processor's buckets and pending requests untouched; keep the unsubscribe inside the enabled branch.
unsubscribeBucketReset?.()
unsubscribeBucketReset = null
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 222ae63c47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
BenchmarksBenchmark execution time: 2026-09-18 21:16:47 Comparing candidate commit 0f6d759 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 2308 metrics, 5 unstable metrics.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bbd1d73e05
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
c455a3c to
6b6f648
Compare
💡 Codex ReviewWhen AGENTS.md reference: AGENTS.md:L78-L80 When AGENTS.md reference: AGENTS.md:L78-L80
AGENTS.md reference: AGENTS.md:L78-L80 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
3bb01a0 to
c228c5b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c228c5b6b4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Schema sampling and checkpoint IDs belong to the current runtime identity. | ||
| this._schemaSamplers = {} | ||
| this._checkpointRegistry = new CheckpointRegistry() | ||
| this.writer.resetPendingRequests() |
There was a problem hiding this comment.
Avoid resetting the shared controller twice
In AWS Lambda MicroVM mode, DataStreamsWriter obtains the shared controller whose getIdentityRefreshController() already subscribes it to datadog:identity:refresh; that subscription is registered during the writer construction, before this processor subscription. A refresh therefore calls reset() once in request.js and then again here. If the first cancellation callback synchronously starts a new telemetry, remote-config, or Data Streams request, the controller deliberately records it in the new generation, but this second reset immediately aborts it as well—contradicting the new controller tests that require callback-created requests to survive. Rely on the shared controller's channel subscription rather than resetting it again from the processor.
Useful? React with 👍 / 👎.
0ec9cd6 to
7647956
Compare
56806c4 to
dda557a
Compare
Drop stale Data Streams state and avoid resetting the shared identity controller twice.
7647956 to
0f6d759
Compare
|
Hi there's been no activity for 3 weeks, going to move this PR to draft. Please reopen once ready. |
What does this PR do?
Prevent Data Streams state from leaking across AWS Lambda MicroVM identity refreshes.
On identity refresh, this PR:
ERR_DD_IDENTITY_REFRESH.Motivation
A MicroVM identity refresh must not carry buffered, sampling, checkpoint, or pending exporter state into the next identity. Without request cancellation, in-flight requests and retries can send pre-refresh payloads under the clone's new runtime identity.
This is a reviewable slice from the breakdown of monolithic PR #9814, tracked by SVLS-9768.
Additional Notes
This PR is stacked on #10338 and uses its shared
request.getIdentityRefreshController()implementation. Non-MicroVM requests keep their existing lifecycle.Focused verification:
./node_modules/.bin/mocha packages/dd-trace/test/exporters/common/request.spec.js packages/dd-trace/test/datastreams/processor.spec.js packages/dd-trace/test/datastreams/writer.spec.js— 113 passinggit diff --checkpassesDependency tree
origin/master01-common-exporter-agent-spanstats-reset-and-cancel02-agentless-exporter-identity06-datastream-reset-and-cancel← current PR03-dogstatsd-buffer-reset04-otel-runtime-baseline05-otel-runtime-metric-resets