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(metrics): Extract set span metrics from numeric values #3897

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

Dav1dde
Copy link
Member

@Dav1dde Dav1dde commented Aug 5, 2024

Numbers in the data couldn't be used as sets. This came up as an issue when configuring metric extraction rules, especially since setting a number as a tag would implicitly convert the value to a string and make the set work. Adds the extraction for numbers as well, but convert them to a string first, this allows for consistent sets across tags and data as well better behaviour for users.

@Dav1dde Dav1dde requested a review from a team as a code owner August 5, 2024 12:20
@Dav1dde Dav1dde requested a review from vgrozdanic August 5, 2024 12:20
@Dav1dde Dav1dde self-assigned this Aug 5, 2024
Comment on lines +170 to +175
MetricType::Set => BucketValue::set_from_str(&match instance.get_value(field?)? {
Val::I64(num) => Cow::Owned(num.to_string()),
Val::U64(num) => Cow::Owned(num.to_string()),
Val::String(s) => Cow::Borrowed(s),
_ => return None,
}),
Copy link
Member

Choose a reason for hiding this comment

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

Such an elegant solution

@Dav1dde Dav1dde merged commit ffd218f into master Aug 5, 2024
25 checks passed
@Dav1dde Dav1dde deleted the dav1d/extract-set-from-nums branch August 5, 2024 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants