diff --git a/opentelemetry-sdk/src/metrics/internal/aggregate.rs b/opentelemetry-sdk/src/metrics/internal/aggregate.rs index 79a06f7242..e004240c60 100644 --- a/opentelemetry-sdk/src/metrics/internal/aggregate.rs +++ b/opentelemetry-sdk/src/metrics/internal/aggregate.rs @@ -71,7 +71,7 @@ pub(crate) struct AggregateBuilder { type Filter = Arc bool + Send + Sync>; -impl> AggregateBuilder { +impl AggregateBuilder { pub(crate) fn new(temporality: Option, filter: Option) -> Self { AggregateBuilder { temporality, diff --git a/opentelemetry-sdk/src/metrics/internal/exponential_histogram.rs b/opentelemetry-sdk/src/metrics/internal/exponential_histogram.rs index bf44beb59c..c23b441663 100644 --- a/opentelemetry-sdk/src/metrics/internal/exponential_histogram.rs +++ b/opentelemetry-sdk/src/metrics/internal/exponential_histogram.rs @@ -32,7 +32,7 @@ struct ExpoHistogramDataPoint { zero_count: u64, } -impl> ExpoHistogramDataPoint { +impl ExpoHistogramDataPoint { fn new(max_size: i32, max_scale: i8, record_min_max: bool, record_sum: bool) -> Self { ExpoHistogramDataPoint { count: 0, @@ -50,7 +50,7 @@ impl> ExpoHistogramDataPoint { } } -impl> ExpoHistogramDataPoint { +impl ExpoHistogramDataPoint { /// Adds a new measurement to the histogram. /// /// It will rescale the buckets if needed. @@ -322,7 +322,7 @@ pub(crate) struct ExpoHistogram { start: Mutex, } -impl> ExpoHistogram { +impl ExpoHistogram { /// Create a new exponential histogram. pub(crate) fn new( max_size: u32, @@ -535,7 +535,7 @@ mod tests { run_data_point_record::(); } - fn run_data_point_record + Neg + From>() { + fn run_data_point_record + From>() { struct TestCase { max_size: i32, values: Vec, @@ -695,7 +695,7 @@ mod tests { } } - fn run_min_max_sum + From>() { + fn run_min_max_sum>() { let alice = &[KeyValue::new("user", "alice")][..]; struct Expected { min: T, @@ -703,7 +703,7 @@ mod tests { sum: T, count: usize, } - impl> Expected { + impl Expected { fn new(min: T, max: T, sum: T, count: usize) -> Self { Expected { min, @@ -1229,7 +1229,7 @@ mod tests { (Box::new(m), Box::new(ca)) } - fn hist_aggregation + From>() { + fn hist_aggregation>() { let max_size = 4; let max_scale = 20; let record_min_max = true; @@ -1449,7 +1449,7 @@ mod tests { } } - fn assert_aggregation_eq + PartialEq>( + fn assert_aggregation_eq( a: Box, b: Box, ignore_timestamp: bool, @@ -1558,7 +1558,7 @@ mod tests { } } - fn assert_data_points_eq>( + fn assert_data_points_eq( a: &data::DataPoint, b: &data::DataPoint, ignore_timestamp: bool, @@ -1582,7 +1582,7 @@ mod tests { } } - fn assert_hist_data_points_eq>( + fn assert_hist_data_points_eq( a: &data::HistogramDataPoint, b: &data::HistogramDataPoint, ignore_timestamp: bool, @@ -1615,7 +1615,7 @@ mod tests { } } - fn assert_exponential_hist_data_points_eq>( + fn assert_exponential_hist_data_points_eq( a: &data::ExponentialHistogramDataPoint, b: &data::ExponentialHistogramDataPoint, ignore_timestamp: bool, diff --git a/opentelemetry-sdk/src/metrics/internal/histogram.rs b/opentelemetry-sdk/src/metrics/internal/histogram.rs index 8fc5bf59c1..089415ba7c 100644 --- a/opentelemetry-sdk/src/metrics/internal/histogram.rs +++ b/opentelemetry-sdk/src/metrics/internal/histogram.rs @@ -22,7 +22,7 @@ struct HistogramTracker { buckets: Mutex>, } -impl> AtomicTracker for HistogramTracker { +impl AtomicTracker for HistogramTracker { fn update_histogram(&self, index: usize, value: T) { let mut buckets = match self.buckets.lock() { Ok(guard) => guard, @@ -34,7 +34,7 @@ impl> AtomicTracker for HistogramTracker { } } -impl> AtomicallyUpdate for HistogramTracker { +impl AtomicallyUpdate for HistogramTracker { type AtomicTracker = HistogramTracker; fn new_atomic_tracker(buckets_count: Option) -> Self::AtomicTracker { @@ -54,7 +54,7 @@ struct Buckets { max: T, } -impl> Buckets { +impl Buckets { /// returns buckets with `n` bins. fn new(n: usize) -> Buckets { Buckets { @@ -93,7 +93,7 @@ impl> Buckets { /// Summarizes a set of measurements as a histogram with explicitly defined /// buckets. -pub(crate) struct Histogram> { +pub(crate) struct Histogram { value_map: ValueMap, T, HistogramUpdate>, bounds: Vec, record_min_max: bool, @@ -101,7 +101,7 @@ pub(crate) struct Histogram> { start: Mutex, } -impl> Histogram { +impl Histogram { pub(crate) fn new(boundaries: Vec, record_min_max: bool, record_sum: bool) -> Self { let buckets_count = boundaries.len() + 1; let mut histogram = Histogram { diff --git a/opentelemetry-sdk/src/metrics/internal/last_value.rs b/opentelemetry-sdk/src/metrics/internal/last_value.rs index cce14c5c42..d1eab4fada 100644 --- a/opentelemetry-sdk/src/metrics/internal/last_value.rs +++ b/opentelemetry-sdk/src/metrics/internal/last_value.rs @@ -10,12 +10,12 @@ use opentelemetry::KeyValue; use super::{Assign, AtomicTracker, Number, ValueMap}; /// Summarizes a set of measurements as the last one made. -pub(crate) struct LastValue> { +pub(crate) struct LastValue { value_map: ValueMap, start: Mutex, } -impl> LastValue { +impl LastValue { pub(crate) fn new() -> Self { LastValue { value_map: ValueMap::new(), diff --git a/opentelemetry-sdk/src/metrics/internal/mod.rs b/opentelemetry-sdk/src/metrics/internal/mod.rs index 41f97aa20b..abc691b2fc 100644 --- a/opentelemetry-sdk/src/metrics/internal/mod.rs +++ b/opentelemetry-sdk/src/metrics/internal/mod.rs @@ -49,7 +49,7 @@ impl Operation for Assign { /// /// This structure is parametrized by an `Operation` that indicates how /// updates to the underlying value trackers should be performed. -pub(crate) struct ValueMap, T: Number, O> { +pub(crate) struct ValueMap, T: Number, O> { /// Trackers store the values associated with different attribute sets. trackers: RwLock, Arc>>, /// Number of different attribute set stored in the `trackers` map. @@ -63,13 +63,13 @@ pub(crate) struct ValueMap, T: Number, O> { phantom: PhantomData, } -impl, T: Number, O> Default for ValueMap { +impl, T: Number, O> Default for ValueMap { fn default() -> Self { ValueMap::new() } } -impl, T: Number, O> ValueMap { +impl, T: Number, O> ValueMap { fn new() -> Self { ValueMap { trackers: RwLock::new(HashMap::new()), @@ -93,7 +93,7 @@ impl, T: Number, O> ValueMap { } } -impl, T: Number, O: Operation> ValueMap { +impl, T: Number, O: Operation> ValueMap { fn measure(&self, measurement: T, attributes: &[KeyValue], index: usize) { if attributes.is_empty() { O::update_tracker(&self.no_attribute_tracker, measurement, index); @@ -171,10 +171,10 @@ pub(crate) trait AtomicallyUpdate { fn new_atomic_tracker(buckets_count: Option) -> Self::AtomicTracker; } -pub(crate) trait Number: - Add +pub(crate) trait Number: + Add + AddAssign - + Sub + + Sub + PartialOrd + fmt::Debug + Clone @@ -184,7 +184,7 @@ pub(crate) trait Number: + Send + Sync + 'static - + AtomicallyUpdate + + AtomicallyUpdate { fn min() -> Self; fn max() -> Self; @@ -192,7 +192,7 @@ pub(crate) trait Number: fn into_float(self) -> f64; } -impl Number for i64 { +impl Number for i64 { fn min() -> Self { i64::MIN } @@ -206,7 +206,7 @@ impl Number for i64 { self as f64 } } -impl Number for u64 { +impl Number for u64 { fn min() -> Self { u64::MIN } @@ -220,7 +220,7 @@ impl Number for u64 { self as f64 } } -impl Number for f64 { +impl Number for f64 { fn min() -> Self { f64::MIN } diff --git a/opentelemetry-sdk/src/metrics/internal/precomputed_sum.rs b/opentelemetry-sdk/src/metrics/internal/precomputed_sum.rs index 14e9c19b25..060c7baaa6 100644 --- a/opentelemetry-sdk/src/metrics/internal/precomputed_sum.rs +++ b/opentelemetry-sdk/src/metrics/internal/precomputed_sum.rs @@ -10,14 +10,14 @@ use std::{ }; /// Summarizes a set of pre-computed sums as their arithmetic sum. -pub(crate) struct PrecomputedSum> { +pub(crate) struct PrecomputedSum { value_map: ValueMap, monotonic: bool, start: Mutex, reported: Mutex, T>>, } -impl> PrecomputedSum { +impl PrecomputedSum { pub(crate) fn new(monotonic: bool) -> Self { PrecomputedSum { value_map: ValueMap::new(), diff --git a/opentelemetry-sdk/src/metrics/internal/sum.rs b/opentelemetry-sdk/src/metrics/internal/sum.rs index 68a58d1e8d..66af75734d 100644 --- a/opentelemetry-sdk/src/metrics/internal/sum.rs +++ b/opentelemetry-sdk/src/metrics/internal/sum.rs @@ -11,13 +11,13 @@ use super::{AtomicTracker, Number}; use super::{Increment, ValueMap}; /// Summarizes a set of measurements made as their arithmetic sum. -pub(crate) struct Sum> { +pub(crate) struct Sum { value_map: ValueMap, monotonic: bool, start: Mutex, } -impl> Sum { +impl Sum { /// Returns an aggregator that summarizes a set of measurements as their /// arithmetic sum. /// diff --git a/opentelemetry-sdk/src/metrics/meter.rs b/opentelemetry-sdk/src/metrics/meter.rs index eace66644f..7c2df90e5b 100644 --- a/opentelemetry-sdk/src/metrics/meter.rs +++ b/opentelemetry-sdk/src/metrics/meter.rs @@ -42,7 +42,7 @@ const INSTRUMENT_UNIT_INVALID_CHAR: &str = "characters in instrument unit must b /// See the [Meter API] docs for usage. /// /// [Meter API]: opentelemetry::metrics::Meter -pub struct SdkMeter { +pub(crate) struct SdkMeter { scope: Scope, pipes: Arc, u64_resolver: Resolver, @@ -481,7 +481,7 @@ struct InstrumentResolver<'a, T> { impl<'a, T> InstrumentResolver<'a, T> where - T: Number, + T: Number, { fn new(meter: &'a SdkMeter, resolve: &'a Resolver) -> Self { InstrumentResolver { meter, resolve } diff --git a/opentelemetry-sdk/src/metrics/mod.rs b/opentelemetry-sdk/src/metrics/mod.rs index 0e1f978525..cf6e3fb928 100644 --- a/opentelemetry-sdk/src/metrics/mod.rs +++ b/opentelemetry-sdk/src/metrics/mod.rs @@ -55,7 +55,6 @@ pub(crate) mod view; pub use aggregation::*; pub use instrument::*; pub use manual_reader::*; -pub use meter::*; pub use meter_provider::*; pub use periodic_reader::*; pub use pipeline::Pipeline; diff --git a/opentelemetry-sdk/src/metrics/pipeline.rs b/opentelemetry-sdk/src/metrics/pipeline.rs index 9ab31c95e3..6e0f139809 100644 --- a/opentelemetry-sdk/src/metrics/pipeline.rs +++ b/opentelemetry-sdk/src/metrics/pipeline.rs @@ -211,7 +211,7 @@ struct Inserter { impl Inserter where - T: Number, + T: Number, { fn new(p: Arc, vc: Arc, InstrumentId>>>) -> Self { Inserter { @@ -465,7 +465,7 @@ type AggregateFns = ( /// Returns new aggregate functions for the given params. /// /// If the aggregation is unknown or temporality is invalid, an error is returned. -fn aggregate_fn>( +fn aggregate_fn( b: AggregateBuilder, agg: &aggregation::Aggregation, kind: InstrumentKind, @@ -668,7 +668,7 @@ pub(crate) struct Resolver { impl Resolver where - T: Number, + T: Number, { pub(crate) fn new( pipelines: Arc,