Repository navigation
Conversation
Fixes getsentry#8300 Signed-off-by: Mark Colley <39366189+M-Colley@users.noreply.github.com>
Contributor
PR risk: mediumFor commit Main concerns: reach, public contract, host performance. This label is a hint for reviewers, not an approval. |
This branch has not been 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.
Description
Batcher._flush()andSpanBatcher._flush()previously released_lockbefore invoking_capture_func(), allowing concurrentflush()orclose()calls to observe an empty buffer and return while the flusher thread was still delivering an in-flight batch to the transport. This change tracks active_capture_func()calls with_in_flight_flushesand athreading.Conditionbound to_lockso externalflush()calls wait within the remaining timeout budget until in-flight batches reach the transport. Re-entrantflush()calls invoked from inside_capture_func()skip waiting via_active.flagto prevent self-deadlock. In addition,Client._flush_components()and the test handshake wrapper intests/conftest.pypropagate the remaining timeout budget to batchers and transport flushing. Regression tests intests/tracing/test_span_batcher.pyandtests/test_logs.pycover in-flight handoffs inBatcher,SpanBatcher,Client.flush(), andClient.close(), re-entrantflush()safety, and timeout bounds.Issues
flush()can return before a batch taken by the flusher thread reaches the transport #8300