From 7899bb9a94b11a6dbf38013eca2e97bad7e7fe18 Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Tue, 5 Nov 2024 15:02:08 -0800 Subject: [PATCH 1/2] Add few debug level internal logs to PeriodicReader --- .../src/metrics/periodic_reader.rs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/opentelemetry-sdk/src/metrics/periodic_reader.rs b/opentelemetry-sdk/src/metrics/periodic_reader.rs index 03a10a54ee..c0412c833c 100644 --- a/opentelemetry-sdk/src/metrics/periodic_reader.rs +++ b/opentelemetry-sdk/src/metrics/periodic_reader.rs @@ -131,6 +131,12 @@ where })); }; + otel_debug!( + name: "PeriodicReaderBuilt", + message = "Periodic reader built.", + interval_in_secs = self.interval.as_secs(), + ); + PeriodicReader { exporter: Arc::new(self.exporter), inner: Arc::new(Mutex::new(PeriodicReaderInner { @@ -251,6 +257,10 @@ impl PeriodicReaderWorker { async fn process_message(&mut self, message: Message) -> bool { match message { Message::Export => { + otel_debug!( + name: "PeriodicReader.ExportMessageReceived", + message = "Export message received.", + ); if let Err(err) = self.collect_and_export().await { otel_error!( name: "PeriodicReader.ExportFailed", @@ -259,16 +269,24 @@ impl PeriodicReaderWorker { } } Message::Flush(ch) => { + otel_debug!( + name: "PeriodicReader.FlushMessageReceived", + message = "Flush message received.", + ); let res = self.collect_and_export().await; if let Err(send_error) = ch.send(res) { otel_debug!( name: "PeriodicReader.Flush.SendResultError", - message = "Failed to send flush result", + message = "Failed to send flush result.", reason = format!("{:?}", send_error), ); } } Message::Shutdown(ch) => { + otel_debug!( + name: "PeriodicReader.ShutdownMessageReceived", + message = "Shutdown message received", + ); let res = self.collect_and_export().await; let _ = self.reader.exporter.shutdown(); if let Err(send_error) = ch.send(res) { From c4ef0e87a8d32c1c6a2d07a873844c716ac8fec6 Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Tue, 5 Nov 2024 16:56:07 -0800 Subject: [PATCH 2/2] rename for consistency --- opentelemetry-sdk/src/metrics/periodic_reader.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/opentelemetry-sdk/src/metrics/periodic_reader.rs b/opentelemetry-sdk/src/metrics/periodic_reader.rs index c0412c833c..1cab53edd1 100644 --- a/opentelemetry-sdk/src/metrics/periodic_reader.rs +++ b/opentelemetry-sdk/src/metrics/periodic_reader.rs @@ -132,7 +132,7 @@ where }; otel_debug!( - name: "PeriodicReaderBuilt", + name: "PeriodicReader.BuildCompleted", message = "Periodic reader built.", interval_in_secs = self.interval.as_secs(), ); @@ -258,7 +258,7 @@ impl PeriodicReaderWorker { match message { Message::Export => { otel_debug!( - name: "PeriodicReader.ExportMessageReceived", + name: "PeriodicReader.ExportTriggered", message = "Export message received.", ); if let Err(err) = self.collect_and_export().await { @@ -270,7 +270,7 @@ impl PeriodicReaderWorker { } Message::Flush(ch) => { otel_debug!( - name: "PeriodicReader.FlushMessageReceived", + name: "PeriodicReader.ForceFlushCalled", message = "Flush message received.", ); let res = self.collect_and_export().await; @@ -284,7 +284,7 @@ impl PeriodicReaderWorker { } Message::Shutdown(ch) => { otel_debug!( - name: "PeriodicReader.ShutdownMessageReceived", + name: "PeriodicReader.ShutdownCalled", message = "Shutdown message received", ); let res = self.collect_and_export().await;