Skip to content

Commit

Permalink
tor review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dav1dde committed Nov 17, 2023
1 parent b08d27b commit f7d7690
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions relay-metrics/src/aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ impl BucketKey {
}
}

/// Pendant to [`BucketKey`] for referenced data, not owned data.
///
/// This makes it possible to compute a hash for a [`Bucket`]
/// without destructing the bucket into a [`BucketKey`].
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
struct BucketKeyRef<'a> {
project_key: ProjectKey,
Expand Down Expand Up @@ -540,7 +544,7 @@ impl Aggregator {
aggregator = &self.name,
);

let mut buckets = HashMap::<ProjectKey, Vec<_>>::new();
let mut buckets = HashMap::new();
let mut stats = HashMap::new();

relay_statsd::metric!(
Expand Down Expand Up @@ -570,7 +574,10 @@ impl Aggregator {
tags: key.tags.clone(),
};

buckets.entry(key.project_key).or_default().push(bucket);
buckets
.entry(key.project_key)
.or_insert_with(Vec::new)
.push(bucket);

false
} else {
Expand Down
2 changes: 1 addition & 1 deletion relay-server/src/actors/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ impl EncodeEnvelope {
}
}

/// Encodes metrics into an envelop ready to be sent upstream.
/// Encodes metrics into an envelope ready to be sent upstream.
#[derive(Debug)]
pub struct EncodeMetrics {
/// The metric buckets to encode.
Expand Down

0 comments on commit f7d7690

Please sign in to comment.