-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52e40c6
commit 1ef219b
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use opentelemetry_sdk::metrics::{ | ||
reader::{AggregationSelector, DefaultAggregationSelector}, | ||
Aggregation, InstrumentKind, | ||
}; | ||
|
||
#[derive(Clone, Default, Debug)] | ||
pub struct CustomAggregationSelector { | ||
default_aggregation_selector: DefaultAggregationSelector, | ||
} | ||
|
||
impl CustomAggregationSelector { | ||
/// Create a new default aggregation selector. | ||
pub fn new() -> Self { | ||
Self::default() | ||
} | ||
} | ||
|
||
impl AggregationSelector for CustomAggregationSelector { | ||
fn aggregation(&self, kind: InstrumentKind) -> Aggregation { | ||
match kind { | ||
InstrumentKind::Histogram => Aggregation::Base2ExponentialHistogram { | ||
max_size: 160, | ||
max_scale: 20, | ||
record_min_max: true, | ||
}, | ||
x => self.default_aggregation_selector.aggregation(x), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters