pub struct MetaAggregator { /* private fields */ }
Expand description

A metrics meta aggregator.

Aggregates metric metadata based on their scope (project, mri, timestamp) and only keeps the most relevant entries.

Currently we track the first N amount of unique metric meta elements we get.

This should represent the actual adoption rate of different code versions.

This aggregator is purely in memeory and will lose its state on restart, which may cause multiple different items being emitted after restarts. For this we have de-deuplication in the storage and the volume overall of this happening is small enough to just add it to the storage worst case.

Implementations§

source§

impl MetaAggregator

source

pub fn new(max_locations: usize) -> Self

Creates a new metrics meta aggregator.

source

pub fn add( &mut self, project_key: ProjectKey, meta: MetricMeta ) -> Option<MetricMeta>

Adds a new meta item to the aggregator.

Returns a new MetricMeta element when the element should be stored or sent upstream for storage.

Returns None when the meta item was already seen or is not considered relevant.

source

pub fn get_all_relevant( &self, project_key: ProjectKey ) -> impl Iterator<Item = MetricMeta>

Retrieves all currently relevant metric meta for a project.

source

pub fn clear(&mut self, project_key: ProjectKey)

Remove all contained state related to a project.

Trait Implementations§

source§

impl Debug for MetaAggregator

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.

source§

impl<T> Instrument for T

source§

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

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

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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

source§

impl<T> WithSubscriber for T

source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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