-
Notifications
You must be signed in to change notification settings - Fork 628
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
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_for
hits the definedtimeout
it should raise anasyncio.TimeoutError
,however this is not the case when
opentelemetry-instrumentation-asyncio
is enabledIf everything is good running the below code in both cases should print
timeout!
The PR fixes that by not swallowing
asyncio.CancelledError
that is used internally fromasyncio
timeouts.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.py
printstimeout!
python asyncio-wait-for-example.py
as well printstimeout!
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.