File tree 2 files changed +10
-5
lines changed
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 22
22
` SpanData ` now stores ` events ` as ` SpanEvents ` instead of ` EvictedQueue ` where
23
23
` SpanEvents ` is a struct with a ` Vec ` of events and ` dropped_count ` .
24
24
25
+ - [ #1375 ] ( https://github.com/open-telemetry/opentelemetry-rust/pull/1375/ ) Fix metric collections during PeriodicReader shutdown
26
+
25
27
## v0.21.1
26
28
27
29
### Fixed
Original file line number Diff line number Diff line change @@ -374,18 +374,21 @@ impl MetricReader for PeriodicReader {
374
374
if inner. is_shutdown {
375
375
return Err ( MetricsError :: Other ( "reader is already shut down" . into ( ) ) ) ;
376
376
}
377
- inner. is_shutdown = true ;
378
377
379
378
let ( sender, receiver) = oneshot:: channel ( ) ;
380
379
inner
381
380
. message_sender
382
381
. try_send ( Message :: Shutdown ( sender) )
383
382
. map_err ( |e| MetricsError :: Other ( e. to_string ( ) ) ) ?;
384
-
385
383
drop ( inner) ; // don't hold lock when blocking on future
386
384
387
- futures_executor:: block_on ( receiver)
388
- . map_err ( |err| MetricsError :: Other ( err. to_string ( ) ) )
389
- . and_then ( |res| res)
385
+ let shutdown_result = futures_executor:: block_on ( receiver)
386
+ . map_err ( |err| MetricsError :: Other ( err. to_string ( ) ) ) ?;
387
+
388
+ // Acquire the lock again to set the shutdown flag
389
+ let mut inner = self . inner . lock ( ) ?;
390
+ inner. is_shutdown = true ;
391
+
392
+ shutdown_result
390
393
}
391
394
}
You can’t perform that action at this time.
0 commit comments