@@ -234,6 +234,8 @@ struct PeriodicReaderWorker<RT: Runtime> {
234
234
235
235
impl < RT : Runtime > PeriodicReaderWorker < RT > {
236
236
async fn collect_and_export ( & mut self ) -> Result < ( ) > {
237
+ #[ cfg( feature = "experimental-internal-logs" ) ]
238
+ tracing:: debug!( name: "metrics_collect_and_export" , target: "opentelemetry-sdk" , status = "started" ) ;
237
239
self . reader . collect ( & mut self . rm ) ?;
238
240
if self . rm . scope_metrics . is_empty ( ) {
239
241
// No metrics to export.
@@ -246,25 +248,48 @@ impl<RT: Runtime> PeriodicReaderWorker<RT> {
246
248
pin_mut ! ( timeout) ;
247
249
248
250
match future:: select ( export, timeout) . await {
249
- Either :: Left ( ( res, _) ) => res, // return the status of export.
250
- Either :: Right ( _) => Err ( MetricsError :: Other ( "export timed out" . into ( ) ) ) ,
251
+ Either :: Left ( ( res, _) ) => {
252
+ #[ cfg( feature = "experimental-internal-logs" ) ]
253
+ tracing:: debug!(
254
+ name: "collect_and_export" ,
255
+ target: "opentelemetry-sdk" ,
256
+ status = "completed" ,
257
+ result = ?res
258
+ ) ;
259
+ res // return the status of export.
260
+ }
261
+ Either :: Right ( _) => {
262
+ #[ cfg( feature = "experimental-internal-logs" ) ]
263
+ tracing:: error!(
264
+ name = "collect_and_export" ,
265
+ target = "opentelemetry-sdk" ,
266
+ status = "timed_out"
267
+ ) ;
268
+ Err ( MetricsError :: Other ( "export timed out" . into ( ) ) )
269
+ }
251
270
}
252
271
}
253
272
254
273
async fn process_message ( & mut self , message : Message ) -> bool {
255
274
match message {
256
275
Message :: Export => {
276
+ #[ cfg( feature = "experimental-internal-logs" ) ]
277
+ tracing:: debug!( name: "process_message" , target: "opentelemetry-sdk" , message_type = "export" ) ;
257
278
if let Err ( err) = self . collect_and_export ( ) . await {
258
279
global:: handle_error ( err)
259
280
}
260
281
}
261
282
Message :: Flush ( ch) => {
283
+ #[ cfg( feature = "experimental-internal-logs" ) ]
284
+ tracing:: debug!( name: "process_message" , target: "opentelemetry-sdk" , message_type = "flush" ) ;
262
285
let res = self . collect_and_export ( ) . await ;
263
286
if ch. send ( res) . is_err ( ) {
264
287
global:: handle_error ( MetricsError :: Other ( "flush channel closed" . into ( ) ) )
265
288
}
266
289
}
267
290
Message :: Shutdown ( ch) => {
291
+ #[ cfg( feature = "experimental-internal-logs" ) ]
292
+ tracing:: debug!( name: "process_message" , target: "opentelemetry-sdk" , message_type = "shutdown" ) ;
268
293
let res = self . collect_and_export ( ) . await ;
269
294
let _ = self . reader . exporter . shutdown ( ) ;
270
295
if ch. send ( res) . is_err ( ) {
0 commit comments