- Notifications
You must be signed in to change notification settings - Fork 568
feat(tracemetrics): Add sample_rate to metrics api calls #5070
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
base: master
Are you sure you want to change the base?
Conversation
This allows for a sample_rate (0, 1.0] to be sent on a per metric basis.
❌ 15 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
| if release is not None and "sentry.release" not in metric["attributes"]: | ||
| metric["attributes"]["sentry.release"] = release | ||
| | ||
| trace_context = current_scope.get_trace_context() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please do not revert this and use the underlying get_trace_context as a source of the trace_id, span_id, this is intentional to centralize getting the active trace and span for other features.
| if sample_rate < 1.0: | ||
| sample_rand = _generate_sample_rand(trace_id) | ||
| if sample_rand >= sample_rate: | ||
| if self.transport is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would also add a debug log.
Summary
This allows for a sample_rate (0, 1.0] to be sent on a per metric basis.
Refs LOGS-495