@@ -14,7 +14,7 @@ use opentelemetry_sdk::{
14
14
metrics:: {
15
15
data:: { ResourceMetrics , Temporality } ,
16
16
exporter:: PushMetricsExporter ,
17
- reader:: { DefaultTemporalitySelector , TemporalitySelector } ,
17
+ reader:: { DefaultTemporalitySelector , DeltaTemporalitySelector , TemporalitySelector } ,
18
18
InstrumentKind , PeriodicReader , SdkMeterProvider ,
19
19
} ,
20
20
runtime:: Runtime ,
@@ -169,7 +169,7 @@ where
169
169
///
170
170
/// [exporter-docs]: https://github.com/open-telemetry/opentelemetry-specification/blob/a1c13d59bb7d0fb086df2b3e1eaec9df9efef6cc/specification/metrics/sdk_exporters/otlp.md#additional-configuration
171
171
pub fn with_delta_temporality ( self ) -> Self {
172
- self . with_temporality_selector ( DeltaTemporalitySelector )
172
+ self . with_temporality_selector ( DeltaTemporalitySelector :: new ( ) )
173
173
}
174
174
}
175
175
@@ -237,35 +237,6 @@ impl<RT, EB: Debug> Debug for OtlpMetricPipeline<RT, EB> {
237
237
}
238
238
}
239
239
240
- /// A temporality selector that returns [`Delta`][Temporality::Delta] for all
241
- /// instruments except `UpDownCounter` and `ObservableUpDownCounter`.
242
- ///
243
- /// This temporality selector is equivalent to OTLP Metrics Exporter's
244
- /// `Delta` temporality preference (see [its documentation][exporter-docs]).
245
- ///
246
- /// [exporter-docs]: https://github.com/open-telemetry/opentelemetry-specification/blob/a1c13d59bb7d0fb086df2b3e1eaec9df9efef6cc/specification/metrics/sdk_exporters/otlp.md#additional-configuration
247
- #[ derive( Debug ) ]
248
- struct DeltaTemporalitySelector ;
249
-
250
- impl TemporalitySelector for DeltaTemporalitySelector {
251
- #[ rustfmt:: skip]
252
- fn temporality ( & self , kind : InstrumentKind ) -> Temporality {
253
- match kind {
254
- InstrumentKind :: Counter
255
- | InstrumentKind :: Histogram
256
- | InstrumentKind :: ObservableCounter
257
- | InstrumentKind :: Gauge
258
- | InstrumentKind :: ObservableGauge => {
259
- Temporality :: Delta
260
- }
261
- InstrumentKind :: UpDownCounter
262
- | InstrumentKind :: ObservableUpDownCounter => {
263
- Temporality :: Cumulative
264
- }
265
- }
266
- }
267
- }
268
-
269
240
/// An interface for OTLP metrics clients
270
241
#[ async_trait]
271
242
pub trait MetricsClient : fmt:: Debug + Send + Sync + ' static {
0 commit comments