opentelemetry-instrumentation-starlette: fix memory leak and double middleware#3529
Merged
xrmx merged 4 commits intoopen-telemetry:mainfrom Jun 3, 2025
Merged
Conversation
anuraaga
commented
May 22, 2025
Contributor
|
@anuraaga this is ready to review since you fixed the testcase right? |
anuraaga
commented
May 22, 2025
Contributor
Author
Contributor
Author
Yup should be ok now |
Contributor
Author
|
Oh no, I didn't check existing PRs before making this one and now see @MattiasDC's #3456 is quite similar. I found the tests seem to pass fine for the current baseline version so didn't raise it here which is the main difference. Feel free to reject this PR as a duplicate and get that one in instead though, then I can send another one with just the |
emdneto
reviewed
May 22, 2025
Member
dee09c0 to
3aebb34
Compare
jomcgi
approved these changes
May 30, 2025
Co-authored-by: Joe McGinley <[email protected]>
xrmx
approved these changes
Jun 3, 2025
emdneto
approved these changes
Jun 3, 2025
devmonkey22
pushed a commit
to devmonkey22/opentelemetry-python-contrib
that referenced
this pull request
Aug 5, 2025
…iddleware (open-telemetry#3529) * opentelemetry-instrumentation-starlette: fix memory leak and double middleware * Changelog * Update CHANGELOG.md Co-authored-by: Joe McGinley <[email protected]> --------- Co-authored-by: Joe McGinley <[email protected]>
sightseeker
added a commit
to sightseeker/opentelemetry-python-contrib
that referenced
this pull request
Mar 11, 2026
…iddleware (open-telemetry#3529) * opentelemetry-instrumentation-starlette: fix memory leak and double middleware * Changelog * Update CHANGELOG.md Co-authored-by: Joe McGinley <[email protected]> --------- Co-authored-by: Joe McGinley <[email protected]>
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
Fixes memory leak from using
set, which prevents__del__, which means starlette apps can never be garbage collected.Fixes adding two middlewares if
instrument_appis called with auto instrumentation active/cc @xrmx
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.