Skip to content

Commit 2b7c754

Browse files
authored
[otap-dataflow] Add Sampling (based on zap) to DebugProcessor (open-telemetry#1250)
Added the SamplingConfig struct to allow the user to configure their sampling settings ```rust #[derive(Debug, Clone, Copy, Deserialize)] pub struct SamplingConfig { // number of samples to log initially within the sampling interval pub sampling_initial: u64, // the sampling rate pub sampling_thereafter: u64, // the interval that we sample in, unit is seconds pub sampling_interval: u64, } ``` Added the Sampler struct to handle the sampling logic for the debug processor ```rust /// The sampler keeps track of the current state, number of msgs seen and next interval pub struct Sampler { // sampling settings sampling_config: SamplingConfig, // counter for msgs seen msgs_current_interval: u64, next_interval: Instant, } ``` uses the sample function that accepts a closure (in this closure is the call to output the msgs either to console or outport depending on configuration) to determine whether to log or drop a msg
1 parent 98baa29 commit 2b7c754

File tree

5 files changed

+461
-176
lines changed

5 files changed

+461
-176
lines changed

0 commit comments

Comments
 (0)