pub enum BpfMapAgg {
Scalar,
ScalarCounter,
PerCpu,
PerCpuCounter,
}Expand description
Aggregation for a WatchBpfMap target.
Picks how a watched field’s per-tick reads collapse into run-level metric key(s). Choose by the field’s semantic class: a GAUGE (a current level — fold as the mean) vs a monotonic COUNTER (an accumulating total — fold as the final value).
Variants§
Scalar
A single scalar GAUGE field (e.g. a .bss global struct member like
sys_stat.avg_lat_cri — a current level such as latency-criticality
or headroom). Emits ONE metric key (<prefix>_<label>), folded as the
mean over the run’s reporting samples. For a monotonic counter use
BpfMapAgg::ScalarCounter instead — a rising counter mean-folded
here reports a window-average below its final total.
ScalarCounter
A single scalar monotonic COUNTER field (e.g. a .bss global like
ktstr_alloc_count bumped via __sync_fetch_and_add). Emits ONE
metric key (<prefix>_<label>), folded as the value at the LAST
reporting sample — the accumulated total at the end of the monitoring
window, which is the meaningful count (not the mean of a rising
series).
PerCpu
A per-CPU array field (a BPF_MAP_TYPE_PERCPU_ARRAY value member,
e.g. cpu_ctx_stor.lat_headroom). Emits TWO metric keys: the
cross-CPU mean (<prefix>_<label>_avg) and the cross-CPU spatial
max (<prefix>_<label>_max), each folded over the run’s reporting
samples. The divisor is the count of CPUs that reported a value,
never the topology CPU count.
PerCpuCounter
A per-CPU array field that is a monotonic COUNTER (each CPU’s slot
rises independently, e.g. a BPF_MAP_TYPE_PERCPU_ARRAY per-CPU event
tally). Emits ONE metric key (<prefix>_<label>), folded as the
CROSS-CPU SUM at the LAST reporting sample — the accumulated total
across all (reporting) CPUs at the end of the monitoring window, and
SUM-folded across runs like BpfMapAgg::ScalarCounter. Watch at u64
width: a too-narrow width truncates each per-CPU slot before the sum.
An offline CPU’s accumulated count is excluded (only CPUs whose per-CPU
page is readable contribute). Use this for a rising per-CPU counter;
BpfMapAgg::PerCpu mean/max-folds (a gauge) and
BpfMapAgg::ScalarCounter is for a single scalar, not a per-CPU array.
Trait Implementations§
impl Copy for BpfMapAgg
impl Eq for BpfMapAgg
impl StructuralPartialEq for BpfMapAgg
Auto Trait Implementations§
impl Freeze for BpfMapAgg
impl RefUnwindSafe for BpfMapAgg
impl Send for BpfMapAgg
impl Sync for BpfMapAgg
impl Unpin for BpfMapAgg
impl UnwindSafe for BpfMapAgg
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more