BpfMapProjector

Struct BpfMapProjector 

Source
pub struct BpfMapProjector<'a> { /* private fields */ }
Expand description

Auto-projector handle returned by SampleSeries::bpf_map. Lazily resolves the named map’s value at the requested entry index when Self::field is invoked.

Implementations§

Source§

impl<'a> BpfMapProjector<'a>

Source

pub fn at(self, index: usize) -> Self

Pin the entry index for the projection. Defaults to 0 (typical for ARRAY / .bss / .data / .rodata maps, which carry a single value at index 0). Use this to walk into a HASH map at a specific ordinal.

Source

pub fn field_u64(&self, field: &str) -> SeriesField<u64>

Project a single named struct field as u64 (the most common temporal-assertion shape — counters, byte counts). The label routed onto the resulting SeriesField is the caller-supplied field name; combined with the map name in the diagnostic the failure message reads "<map>.<entry_index>.<field>".

Source

pub fn field_i64(&self, field: &str) -> SeriesField<i64>

Project a single named struct field as i64.

Source

pub fn field_f64(&self, field: &str) -> SeriesField<f64>

Project a single named struct field as f64.

Source

pub fn member_names(&self) -> Vec<String>

Discover the struct member names of the map’s rendered value, unioned across ALL samples (first-seen order, deduplicated). Useful for tests that want to enumerate every scalar field for a blanket assertion.

Discovery spans every row rather than rows.first() alone: sample 0 can be a placeholder (the map missing or not yet captured) while later rows carry the struct, and reading only row 0 would silently enumerate nothing — blinding a “assert over every scalar field” projection. Empty ONLY when NO sample renders the map as a struct (the field set is genuinely undiscoverable).

Source

pub fn u64_fields(&self) -> Vec<(String, SeriesField<u64>)>

Project every struct member that resolves as u64 for at least one sample. Iterates Self::member_names, calls Self::field_u64 for each, and keeps the entries whose resulting SeriesField has at least one Ok value — non-numeric members (strings, nested structs, floats) drop out because their as_u64() cast always errors.

Source

pub fn f64_fields(&self) -> Vec<(String, SeriesField<f64>)>

Project every struct member that resolves as f64 for at least one sample. Mirrors Self::u64_fields using Self::field_f64.

Source

pub fn field_cpu_sum_u64(&self, field: &str) -> SeriesField<u64>

Sum a named per-CPU field across all CPUs as u64. Err(NoMatch) when every slot is None (unreadable, not a real zero); a readable all-zero map sums to Ok(0). Delegates to SnapshotEntry::cpu_sum_u64.

Source

pub fn field_cpu_sum_i64(&self, field: &str) -> SeriesField<i64>

Sum a named per-CPU field across all CPUs as i64. The sum saturates at i64::MIN / i64::MAX (parity with the u64 variant’s saturating_add). Err(NoMatch) when every slot is None (unreadable, not a real zero); a readable all-zero map sums to Ok(0). Delegates to SnapshotEntry::cpu_sum_i64.

Source

pub fn field_cpu_sum_f64(&self, field: &str) -> SeriesField<f64>

Sum a named per-CPU field across all CPUs as f64. Err(NoMatch) when every slot is None (unreadable, not a real zero); a readable all-zero map sums to Ok(0.0). Delegates to SnapshotEntry::cpu_sum_f64.

Source

pub fn field_cpu_max_u64(&self, field: &str) -> SeriesField<u64>

Maximum of a named per-CPU field across all CPUs as u64. Err(NoMatch) when no CPU slot contributed. Delegates to SnapshotEntry::cpu_max_u64.

Source

pub fn field_cpu_max_i64(&self, field: &str) -> SeriesField<i64>

Maximum of a named per-CPU field across all CPUs as i64. Err(NoMatch) when no CPU slot contributed. Delegates to SnapshotEntry::cpu_max_i64.

Source

pub fn field_cpu_max_f64(&self, field: &str) -> SeriesField<f64>

Maximum of a named per-CPU field across all CPUs as f64. Err(NoMatch) when no CPU slot contributed; an all-NaN run yields Ok(NaN). Delegates to SnapshotEntry::cpu_max_f64.

Source

pub fn field_cpu_min_u64(&self, field: &str) -> SeriesField<u64>

Minimum of a named per-CPU field across all CPUs as u64. Err(NoMatch) when no CPU slot contributed. Delegates to SnapshotEntry::cpu_min_u64.

Source

pub fn field_cpu_min_i64(&self, field: &str) -> SeriesField<i64>

Minimum of a named per-CPU field across all CPUs as i64. Err(NoMatch) when no CPU slot contributed. Delegates to SnapshotEntry::cpu_min_i64.

Source

pub fn field_cpu_min_f64(&self, field: &str) -> SeriesField<f64>

Minimum of a named per-CPU field across all CPUs as f64. Err(NoMatch) when no CPU slot contributed; an all-NaN run yields Ok(NaN). Delegates to SnapshotEntry::cpu_min_f64.

Source

pub fn cpu(self, n: usize) -> BpfMapCpuProjector<'a>

Narrow to a single CPU’s slot of a per-CPU map, returning a BpfMapCpuProjector whose field_* read CPU n (vs the cross-CPU Self::field_cpu_sum_u64 reductions). Mirrors Self::at as a builder step; making the per-CPU SELECT a distinct handle means .cpu(n).field_cpu_sum_* cannot be written (aggregate-vs-select can’t be mixed up).

On a non-per-CPU map (.bss / ARRAY / HASH) .cpu(n) is a no-op — the underlying SnapshotMap::cpu narrow is recorded but ignored, so the value reads the same as without it (it neither errors nor filters).

Auto Trait Implementations§

§

impl<'a> Freeze for BpfMapProjector<'a>

§

impl<'a> RefUnwindSafe for BpfMapProjector<'a>

§

impl<'a> Send for BpfMapProjector<'a>

§

impl<'a> Sync for BpfMapProjector<'a>

§

impl<'a> Unpin for BpfMapProjector<'a>

§

impl<'a> UnwindSafe for BpfMapProjector<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,