Uh oh!
There was an error while loading. Please reload this page.
feat: add dropped_count property to BatchTraceProcessor - #4792
feat: add dropped_count property to BatchTraceProcessor#4792Showmick119 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:09797974d6
ℹ️ 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".
| try: | ||
| self._queue.put_nowait(trace) | ||
| except queue.Full: | ||
| self._dropped_count += 1 |
There was a problem hiding this comment.
Serialize concurrent dropped-count updates
When multiple application threads finish spans or start traces while the queue is full, both callbacks can read the same _dropped_count value before either stores its increment, causing the public metric to undercount dropped telemetry; this is especially reachable on free-threaded Python builds and other interpreters because += is not an atomic counter operation. Protect both increments and reads with a shared lock or another thread-safe counter, and cover the interleaving with a controlled concurrency test rather than only the sequential test.
AGENTS.md reference: AGENTS.md:L149-L149
Useful? React with 👍 / 👎.
This pull request adds a dropped_count property to BatchTraceProcessor to provide visibility into trace data loss.
Previously, when the internal queue of BatchTraceProcessor became full (which can happen under heavy load or if the background export thread falls behind), traces and spans were dropped with only a logger.warning. There was no programmatic way to observe or alert on this data loss.
This PR: