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): Measure time in nanos #4495

Merged
merged 3 commits into from
Feb 12, 2025
Merged

fix(statsd): Measure time in nanos #4495

merged 3 commits into from
Feb 12, 2025

Conversation

jjbayer
Copy link
Member

@jjbayer jjbayer commented Feb 12, 2025

A lot of our instrumented code implicitly assumes sub-millisecond precision, but we round all timer metrics to milliseconds. This becomes a problem especially when computing the sum over a large number of sub-millisecond time frames (e.g. envelope buffer busy time).

ref: https://github.com/getsentry/team-ingest/issues/618

@jjbayer jjbayer marked this pull request as ready for review February 12, 2025 10:20
@jjbayer jjbayer requested a review from a team as a code owner February 12, 2025 10:20
$(.with_tag(stringify!($k), $v))*
)
});
$crate::metric!(timer($id) = now.elapsed() $(, $k = $v)*);
Copy link
Member

Choose a reason for hiding this comment

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

Is the duration here converted to ns?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, now.elapsed() is a Duration, and the macro call expands into the branch above.

Copy link
Member

@Dav1dde Dav1dde left a comment

Choose a reason for hiding this comment

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

Nice, clever to switch to floats in ms to not break existing widgets.

@jjbayer jjbayer merged commit e13fd30 into master Feb 12, 2025
26 checks passed
@jjbayer jjbayer deleted the fix/statsd-timers-float branch February 12, 2025 12:01
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