File tree 3 files changed +23
-0
lines changed
instrumentation/opentelemetry-instrumentation-asyncio
src/opentelemetry/instrumentation/asyncio
3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
6
6
and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
7
7
8
+ ## Version 1.25.0/0.46b0+asyncio-wait-for-fix (2024-06-26)
9
+
10
+ ### Fixed
11
+
12
+ - ` opentelemetry-instrumentation-asyncio ` instrumented ` asyncio.wait_for ` properly raises ` asyncio.TimeoutError ` as expected
13
+ ([ #2637 ] ( https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2637 ) )
14
+
8
15
## Version 1.25.0/0.46b0 (2024-05-30)
9
16
10
17
### Breaking changes
Original file line number Diff line number Diff line change @@ -280,8 +280,11 @@ async def trace_coroutine(self, coro):
280
280
# CancelledError is raised when a coroutine is cancelled
281
281
# before it has a chance to run. We don't want to record
282
282
# this as an error.
283
+ # Still it needs to be raised in order for `asyncio.wait_for`
284
+ # to properly work with timeout and raise accordingly `asyncio.TimeoutError`
283
285
except asyncio .CancelledError :
284
286
attr ["state" ] = "cancelled"
287
+ raise
285
288
except Exception as exc :
286
289
exception = exc
287
290
state = determine_state (exception )
Original file line number Diff line number Diff line change @@ -68,6 +68,19 @@ async def main():
68
68
spans = self .memory_exporter .get_finished_spans ()
69
69
self .assertEqual (len (spans ), 2 )
70
70
71
+ def test_asyncio_wait_for_with_timeout (self ):
72
+ expected_timeout_error = None
73
+
74
+ async def main ():
75
+ nonlocal expected_timeout_error
76
+ try :
77
+ await asyncio .wait_for (async_func (), 0.01 )
78
+ except asyncio .TimeoutError as timeout_error :
79
+ expected_timeout_error = timeout_error
80
+
81
+ asyncio .run (main ())
82
+ self .assertNotEqual (expected_timeout_error , None )
83
+
71
84
def test_asyncio_as_completed (self ):
72
85
async def main ():
73
86
if sys .version_info >= (3 , 11 ):
You can’t perform that action at this time.
0 commit comments