-
Couldn't load subscription status.
- Fork 801
fix(async-io): instrumented asyncio.wait_for properly raises asyncio.TimeoutError
#2637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(async-io): instrumented asyncio.wait_for properly raises asyncio.TimeoutError
#2637
Conversation
650cbfd to
ffb012d
Compare
|
@smoke please fix lint |
3c7766f to
094a085
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but would appreciate a review from @bourbonkk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you for your PR.
|
@smoke we'll take care of it |
Pull Request is not mergeable
|
There seems to be a test failing that is not related to this PR https://github.com/open-telemetry/opentelemetry-python-contrib/actions/runs/9700988497/job/26773822151?pr=2637#step:6:626 |
Description
As per the example from https://docs.python.org/3.13/library/asyncio-task.html#asyncio.wait_for when
asyncio.wait_forhits the definedtimeoutit should raise anasyncio.TimeoutError,however this is not the case when
opentelemetry-instrumentation-asynciois enabledIf everything is good running the below code in both cases should print
timeout!The PR fixes that by not swallowing
asyncio.CancelledErrorthat is used internally fromasynciotimeouts.Type of change
Please delete options that are not relevant.
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
OTEL_PYTHON_DISABLED_INSTRUMENTATIONS="asyncio" python asyncio-wait-for-example.pyprintstimeout!python asyncio-wait-for-example.pyas well printstimeout!Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.