Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(statsd): Add new metric_type tag to existing metrics [INGEST-954] #1199

Merged
merged 4 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
**Internal**:

- Spread out metric aggregation over the aggregation window to avoid concentrated waves of metrics requests to the upstream every 10 seconds. Relay now applies jitter to `initial_delay` to spread out requests more evenly over time. ([#1185](https://github.com/getsentry/relay/pull/1185))
- Add new statsd metrics for bucketing efficiency ([#1199](https://github.com/getsentry/relay/pull/1199), [#1192](https://github.com/getsentry/relay/pull/1192))

## 22.2.0

Expand Down
15 changes: 8 additions & 7 deletions relay-metrics/src/aggregation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,6 @@ impl Aggregator {
relay_statsd::metric!(
counter(MetricCounters::InsertMetric) += 1,
metric_type = metric.value.ty().as_str(),
metric_name = &metric.name
);
let key = BucketKey {
project_key,
Expand Down Expand Up @@ -1178,10 +1177,10 @@ impl Aggregator {
);
total_bucket_count += bucket_count;

let mut sizes: Vec<usize> = Vec::new();
project_buckets
let mut size_statsd_metrics: Vec<_> = project_buckets
jan-auer marked this conversation as resolved.
Show resolved Hide resolved
.iter()
.for_each(|bucket| sizes.push(bucket.value.relative_size()));
.map(|bucket| (bucket.value.ty(), bucket.value.relative_size()))
.collect();

self.receiver
.send(FlushBuckets::new(project_key, project_buckets))
Expand All @@ -1205,11 +1204,13 @@ impl Aggregator {
);
}
} else {
sizes.iter().for_each(|rel_size| {
for (bucket_type, bucket_relative_size) in size_statsd_metrics {
relay_statsd::metric!(
histogram(MetricHistograms::BucketRelativeSize) = *rel_size as u64
histogram(MetricHistograms::BucketRelativeSize) =
bucket_relative_size as u64,
metric_type = bucket_type.as_str(),
);
});
}
}
fut::ok(())
})
Expand Down