fix(tests): Fix flaky continuous profiler test under gevent#5899
Open
stephanie-anderson wants to merge 3 commits intomasterfrom
Open
fix(tests): Fix flaky continuous profiler test under gevent#5899stephanie-anderson wants to merge 3 commits intomasterfrom
stephanie-anderson wants to merge 3 commits intomasterfrom
Conversation
The `assert_single_transaction_with_profile_chunks` helper now polls for profile_chunk envelope items with a timeout instead of asserting immediately. Under gevent on slow CI runners, the profiler thread may not have flushed its buffer by the time the assertion runs, causing sporadic failures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Langchain
Bug Fixes 🐛Ci
Openai
Other
Documentation 📚
Internal Changes 🔧Langchain
Openai
Other
Other
🤖 This preview updates automatically when you update the PR. |
Contributor
Codecov Results 📊✅ 134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 21.07s All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 13622 uncovered lines. Generated by Codecov Action |
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.
Fix flaky
test_continuous_profiler_manual_start_and_stop_sampledtestthat intermittently fails under the gevent scheduler on slow CI runners.
The test asserts that
profile_chunkenvelope items exist immediatelyafter a transaction completes, but the profiler thread may not have
flushed its buffer yet — especially under gevent's cooperative scheduling
on resource-constrained CI. The fix adds polling with a timeout to
assert_single_transaction_with_profile_chunksso it waits up to 2seconds for chunks to arrive before asserting, rather than assuming
they're already present.
Example failure: https://github.com/getsentry/sentry-python/actions/runs/23643367140/job/68869340875