@@ -8,7 +8,7 @@ pub mod tonic {
88 use std:: any:: Any ;
99 use std:: fmt;
1010
11- use opentelemetry:: { global , metrics :: MetricsError , Key , Value } ;
11+ use opentelemetry:: { otel_debug , otel_warn , Key , Value } ;
1212 use opentelemetry_sdk:: metrics:: data:: {
1313 self , Exemplar as SdkExemplar , ExponentialHistogram as SdkExponentialHistogram ,
1414 Gauge as SdkGauge , Histogram as SdkHistogram , Metric as SdkMetric ,
@@ -97,10 +97,12 @@ pub mod tonic {
9797 Temporality :: Cumulative => AggregationTemporality :: Cumulative ,
9898 Temporality :: Delta => AggregationTemporality :: Delta ,
9999 other => {
100- opentelemetry:: global:: handle_error ( MetricsError :: Other ( format ! (
101- "Unknown temporality {:?}, using default instead." ,
102- other
103- ) ) ) ;
100+ otel_warn ! (
101+ name: "AggregationTemporality::Unknown" ,
102+ message = "Unknown temporality,using default instead." ,
103+ unknown_temporality = format!( "{:?}" , other) ,
104+ default_temporality = format!( "{:?}" , Temporality :: Cumulative )
105+ ) ;
104106 AggregationTemporality :: Cumulative
105107 }
106108 }
@@ -184,7 +186,11 @@ pub mod tonic {
184186 } else if let Some ( gauge) = data. downcast_ref :: < SdkGauge < f64 > > ( ) {
185187 Ok ( TonicMetricData :: Gauge ( gauge. into ( ) ) )
186188 } else {
187- global:: handle_error ( MetricsError :: Other ( "unknown aggregator" . into ( ) ) ) ;
189+ otel_debug ! (
190+ name: "TonicMetricData::UnknownAggregator" ,
191+ message= "Unknown aggregator type" ,
192+ unknown_type= format!( "{:?}" , data) ,
193+ ) ;
188194 Err ( ( ) )
189195 }
190196 }
0 commit comments