@@ -357,7 +357,7 @@ impl PeriodicReader {
357357 reader
358358 }
359359
360- fn collect_and_export ( & self , timeout : Duration ) -> MetricResult < ( ) > {
360+ fn collect_and_export ( & self , timeout : Duration ) -> OTelSdkResult {
361361 self . inner . collect_and_export ( timeout)
362362 }
363363}
@@ -402,7 +402,7 @@ impl PeriodicReaderInner {
402402 }
403403 }
404404
405- fn collect_and_export ( & self , timeout : Duration ) -> MetricResult < ( ) > {
405+ fn collect_and_export ( & self , timeout : Duration ) -> OTelSdkResult {
406406 // TODO: Reuse the internal vectors. Or refactor to avoid needing any
407407 // owned data structures to be passed to exporters.
408408 let mut rm = ResourceMetrics {
@@ -425,7 +425,7 @@ impl PeriodicReaderInner {
425425 name: "PeriodReaderCollectError" ,
426426 error = format!( "{:?}" , e)
427427 ) ;
428- return Err ( e ) ;
428+ return Err ( OTelSdkError :: InternalFailure ( e . to_string ( ) ) ) ;
429429 }
430430
431431 if rm. scope_metrics . is_empty ( ) {
@@ -546,7 +546,7 @@ mod tests {
546546 error:: { OTelSdkError , OTelSdkResult } ,
547547 metrics:: {
548548 data:: ResourceMetrics , exporter:: PushMetricExporter , reader:: MetricReader ,
549- InMemoryMetricExporter , MetricError , MetricResult , SdkMeterProvider , Temporality ,
549+ InMemoryMetricExporter , MetricResult , SdkMeterProvider , Temporality ,
550550 } ,
551551 Resource ,
552552 } ;
@@ -584,9 +584,9 @@ mod tests {
584584
585585 #[ async_trait]
586586 impl PushMetricExporter for MetricExporterThatFailsOnlyOnFirst {
587- async fn export ( & self , _metrics : & mut ResourceMetrics ) -> MetricResult < ( ) > {
587+ async fn export ( & self , _metrics : & mut ResourceMetrics ) -> OTelSdkResult {
588588 if self . count . fetch_add ( 1 , Ordering :: Relaxed ) == 0 {
589- Err ( MetricError :: Other ( "export failed" . into ( ) ) )
589+ Err ( OTelSdkError :: InternalFailure ( "export failed" . into ( ) ) )
590590 } else {
591591 Ok ( ( ) )
592592 }
@@ -612,7 +612,7 @@ mod tests {
612612
613613 #[ async_trait]
614614 impl PushMetricExporter for MockMetricExporter {
615- async fn export ( & self , _metrics : & mut ResourceMetrics ) -> MetricResult < ( ) > {
615+ async fn export ( & self , _metrics : & mut ResourceMetrics ) -> OTelSdkResult {
616616 Ok ( ( ) )
617617 }
618618
0 commit comments