Struct relay_metrics::meta::MetaAggregator
source · 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
impl MetaAggregator
sourcepub fn add(
&mut self,
project_key: ProjectKey,
meta: MetricMeta
) -> Option<MetricMeta>
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.
sourcepub fn get_all_relevant(
&self,
project_key: ProjectKey
) -> impl Iterator<Item = MetricMeta>
pub fn get_all_relevant( &self, project_key: ProjectKey ) -> impl Iterator<Item = MetricMeta>
Retrieves all currently relevant metric meta for a project.
sourcepub fn clear(&mut self, project_key: ProjectKey)
pub fn clear(&mut self, project_key: ProjectKey)
Remove all contained state related to a project.