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

ref(metrics): Create extracted metrics summary for sets with min/max/sum of 0 #3853

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions relay-server/src/metrics_extraction/metrics_summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ impl<'a> From<&'a SetValue> for MetricsSummaryBucketValue {
fn from(set: &'a SetValue) -> Self {
// For sets, we limit to counting the number of occurrences.
MetricsSummaryBucketValue {
min: None,
max: None,
sum: None,
min: Some(0.into()),
max: Some(0.into()),
sum: Some(0.into()),
Comment on lines +103 to +105
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we type these fields to be non-optional, if the consumer cannot handle them otherwise?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the Kafka schema, any of these is required. So technically it should work if we just send min: Some(0) but keep the others None ... Unfortunately this is quite hard to express in the typesystem.

count: set.len() as u64,
}
}
Expand Down Expand Up @@ -342,18 +342,18 @@ mod tests {
{
"s:custom/my_set@none": [
MetricSummary {
min: ~,
max: ~,
sum: ~,
min: 0.0,
max: 0.0,
sum: 0.0,
count: 2,
tags: {
"platform": "android",
},
},
MetricSummary {
min: ~,
max: ~,
sum: ~,
min: 0.0,
max: 0.0,
sum: 0.0,
count: 2,
tags: {
"platform": "ios",
Expand Down Expand Up @@ -458,9 +458,9 @@ mod tests {
],
"s:custom/my_set@none": [
MetricSummary {
min: ~,
max: ~,
sum: ~,
min: 0.0,
max: 0.0,
sum: 0.0,
count: 4,
tags: {
"platform": "ios",
Expand Down
Loading