From 5f9da72cab20e8a6e85029c54d6380ed617e3e4b Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Thu, 24 Oct 2024 10:48:25 -0700 Subject: [PATCH 1/4] commit --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a91ecbb4e0..60717100b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ hyper-util = "0.1" log = "0.4.21" once_cell = "1.13" ordered-float = "4.0" -pin-project-lite = "0.2" +pin-project-lite = "0.2.14" # 0.2.15 is failing for cargo-check-external-types prost = "0.13" prost-build = "0.13" prost-types = "0.13" From 6fcc36e184fcef698b801b90ebc497eefa7c1613 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Thu, 24 Oct 2024 11:58:16 -0700 Subject: [PATCH 2/4] Update Cargo.toml --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 60717100b3..e08de8187d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ hyper-util = "0.1" log = "0.4.21" once_cell = "1.13" ordered-float = "4.0" -pin-project-lite = "0.2.14" # 0.2.15 is failing for cargo-check-external-types +pin-project-lite = "=0.2.14" # 0.2.15 is failing for cargo-check-external-types prost = "0.13" prost-build = "0.13" prost-types = "0.13" From d595d06d2164f593d0d639b5ecd811b747e02824 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Thu, 24 Oct 2024 13:24:59 -0700 Subject: [PATCH 3/4] initial commit --- opentelemetry-sdk/src/metrics/meter.rs | 44 ++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/opentelemetry-sdk/src/metrics/meter.rs b/opentelemetry-sdk/src/metrics/meter.rs index 8cab6e1b68..17ce802e91 100644 --- a/opentelemetry-sdk/src/metrics/meter.rs +++ b/opentelemetry-sdk/src/metrics/meter.rs @@ -179,19 +179,30 @@ impl SdkMeter { { let validation_result = validate_instrument_config(builder.name.as_ref(), &builder.unit); if let Err(err) = validation_result { - global::handle_error(err); + otel_error!( + name: "InstrumentCreationFailed", + meter_name = self.scope.name.as_ref(), + instrument_name = builder.name.as_ref(), + message = "Callbacks for this observable updown counter will not be invoked.", + reason = format!("{}", err)); return ObservableUpDownCounter::new(); } match resolver.measures( InstrumentKind::ObservableUpDownCounter, - builder.name, + builder.name.clone(), builder.description, builder.unit, None, ) { Ok(ms) => { if ms.is_empty() { + otel_error!( + name: "InstrumentCreationFailed", + meter_name = self.scope.name.as_ref(), + instrument_name = builder.name.as_ref(), + message = "Callbacks for this observable updown counter will not be invoked. Check View Configuration." + ); return ObservableUpDownCounter::new(); } @@ -206,7 +217,12 @@ impl SdkMeter { ObservableUpDownCounter::new() } Err(err) => { - global::handle_error(err); + otel_error!( + name: "InstrumentCreationFailed", + meter_name = self.scope.name.as_ref(), + instrument_name = builder.name.as_ref(), + message = "Callbacks for this observable updown counter will not be invoked.", + reason = format!("{}", err)); ObservableUpDownCounter::new() } } @@ -222,19 +238,30 @@ impl SdkMeter { { let validation_result = validate_instrument_config(builder.name.as_ref(), &builder.unit); if let Err(err) = validation_result { - global::handle_error(err); + otel_error!( + name: "InstrumentCreationFailed", + meter_name = self.scope.name.as_ref(), + instrument_name = builder.name.as_ref(), + message = "Callbacks for this observable gauge will not be invoked.", + reason = format!("{}", err)); return ObservableGauge::new(); } match resolver.measures( InstrumentKind::ObservableGauge, - builder.name, + builder.name.clone(), builder.description, builder.unit, None, ) { Ok(ms) => { if ms.is_empty() { + otel_error!( + name: "InstrumentCreationFailed", + meter_name = self.scope.name.as_ref(), + instrument_name = builder.name.as_ref(), + message = "Callbacks for this observable gauge will not be invoked. Check View Configuration." + ); return ObservableGauge::new(); } @@ -249,7 +276,12 @@ impl SdkMeter { ObservableGauge::new() } Err(err) => { - global::handle_error(err); + otel_error!( + name: "InstrumentCreationFailed", + meter_name = self.scope.name.as_ref(), + instrument_name = builder.name.as_ref(), + message = "Callbacks for this observable gauge will not be invoked.", + reason = format!("{}", err)); ObservableGauge::new() } } From 9e2f6b1cc943d369bff5da73d7c1edd290e0e6c8 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Thu, 24 Oct 2024 13:24:59 -0700 Subject: [PATCH 4/4] initial commit --- opentelemetry-sdk/src/metrics/meter.rs | 44 ++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/opentelemetry-sdk/src/metrics/meter.rs b/opentelemetry-sdk/src/metrics/meter.rs index 8cab6e1b68..17ce802e91 100644 --- a/opentelemetry-sdk/src/metrics/meter.rs +++ b/opentelemetry-sdk/src/metrics/meter.rs @@ -179,19 +179,30 @@ impl SdkMeter { { let validation_result = validate_instrument_config(builder.name.as_ref(), &builder.unit); if let Err(err) = validation_result { - global::handle_error(err); + otel_error!( + name: "InstrumentCreationFailed", + meter_name = self.scope.name.as_ref(), + instrument_name = builder.name.as_ref(), + message = "Callbacks for this observable updown counter will not be invoked.", + reason = format!("{}", err)); return ObservableUpDownCounter::new(); } match resolver.measures( InstrumentKind::ObservableUpDownCounter, - builder.name, + builder.name.clone(), builder.description, builder.unit, None, ) { Ok(ms) => { if ms.is_empty() { + otel_error!( + name: "InstrumentCreationFailed", + meter_name = self.scope.name.as_ref(), + instrument_name = builder.name.as_ref(), + message = "Callbacks for this observable updown counter will not be invoked. Check View Configuration." + ); return ObservableUpDownCounter::new(); } @@ -206,7 +217,12 @@ impl SdkMeter { ObservableUpDownCounter::new() } Err(err) => { - global::handle_error(err); + otel_error!( + name: "InstrumentCreationFailed", + meter_name = self.scope.name.as_ref(), + instrument_name = builder.name.as_ref(), + message = "Callbacks for this observable updown counter will not be invoked.", + reason = format!("{}", err)); ObservableUpDownCounter::new() } } @@ -222,19 +238,30 @@ impl SdkMeter { { let validation_result = validate_instrument_config(builder.name.as_ref(), &builder.unit); if let Err(err) = validation_result { - global::handle_error(err); + otel_error!( + name: "InstrumentCreationFailed", + meter_name = self.scope.name.as_ref(), + instrument_name = builder.name.as_ref(), + message = "Callbacks for this observable gauge will not be invoked.", + reason = format!("{}", err)); return ObservableGauge::new(); } match resolver.measures( InstrumentKind::ObservableGauge, - builder.name, + builder.name.clone(), builder.description, builder.unit, None, ) { Ok(ms) => { if ms.is_empty() { + otel_error!( + name: "InstrumentCreationFailed", + meter_name = self.scope.name.as_ref(), + instrument_name = builder.name.as_ref(), + message = "Callbacks for this observable gauge will not be invoked. Check View Configuration." + ); return ObservableGauge::new(); } @@ -249,7 +276,12 @@ impl SdkMeter { ObservableGauge::new() } Err(err) => { - global::handle_error(err); + otel_error!( + name: "InstrumentCreationFailed", + meter_name = self.scope.name.as_ref(), + instrument_name = builder.name.as_ref(), + message = "Callbacks for this observable gauge will not be invoked.", + reason = format!("{}", err)); ObservableGauge::new() } }