Repository navigation
perf(telemetry): reserve flush lock before spawning tasks - #478
Merged
aakash-saravanan-db merged 1 commit intoNov 18, 2026
Conversation
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
aakash-saravanan-db
temporarily deployed
to
azure-prod
November 17, 2026 23:52 — with
GitHub Actions
Inactive
aakash-saravanan-db
temporarily deployed
to
azure-prod
November 17, 2026 23:52 — with
GitHub Actions
Inactive
aakash-saravanan-db
temporarily deployed
to
azure-prod
November 17, 2026 23:52 — with
GitHub Actions
Inactive
aakash-saravanan-db
temporarily deployed
to
azure-prod
November 17, 2026 23:52 — with
GitHub Actions
Inactive
aakash-saravanan-db
temporarily deployed
to
azure-prod
November 17, 2026 23:52 — with
GitHub Actions
Inactive
aakash-saravanan-db
temporarily deployed
to
azure-prod
November 17, 2026 23:52 — with
GitHub Actions
Inactive
aakash-saravanan-db
temporarily deployed
to
azure-prod
November 17, 2026 23:52 — with
GitHub Actions
Inactive
aakash-saravanan-db
temporarily deployed
to
azure-prod
November 17, 2026 23:52 — with
GitHub Actions
Inactive
aakash-saravanan-db
temporarily deployed
to
azure-prod
November 17, 2026 23:52 — with
GitHub Actions
Inactive
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Terra), checked by a judge model (Claude Sonnet 5.5).
✅ No issues identified.
🔀 1 finding considered and dismissed by the judge
- 🔵 Low
src/telemetry/client.rs:370— Closing before checking the captured events lets the close flush mask a threshold task that ran but failed to export the burst. Drive the scheduled task to comp
Judge's evidence:assert_eq!(runtime.metrics().num_alive_tasks(), 1);
vuanhphung
approved these changes
Nov 18, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Telemetry enqueue schedules a flush task for every event while the pending queue is above the batch threshold. Those tasks only compete for the flush lock after they start running.
Before: A burst of 2,000 events with a batch size of 100 can schedule 1,901 tasks before the runtime runs any of them, although only one export needs to drain that queue.
After: Enqueue attempts to reserve the existing flush mutex before spawning and transfers its owned guard into the task. Each client has at most one flush task triggered by the threshold scheduled or running. Events arriving during an export remain queued for the next threshold enqueue, timer flush, or bounded close flush.
The deterministic burst test verifies one scheduled task and all 2,000 events exported. This removes redundant task creation and scheduling work during bursts; it does not establish an isolated query-throughput improvement or resolve telemetry endpoint throttling.
Validation
cargo test --locked: 1,322 passed, 64 ignored, including doc tests.cargo clippy --locked --all-targets -- -D warningspassed.