Skip to content

Conversation

@k-fish
Copy link
Member

@k-fish k-fish commented Nov 5, 2025

Summary

This allows for a sample_rate (0, 1.0] to be sent on a per metric basis.

Refs LOGS-495

This allows for a sample_rate (0, 1.0] to be sent on a per metric basis.
@k-fish k-fish requested a review from a team as a code owner November 5, 2025 21:55
@codecov
Copy link

codecov bot commented Nov 5, 2025

❌ 15 Tests Failed:

Tests completed Failed Passed Skipped
28183 15 28168 2205
View the top 3 failed test(s) by shortest run time
tests.test_metrics::test_metrics_tracing_without_performance
Stack Traces | 0.077s run time
tests/test_metrics.py:165: in test_metrics_tracing_without_performance assert metrics[0]["trace_id"] == propagation_context.trace_id E AssertionError: assert '00000000-0000-0000-0000-000000000000' == '2a5c4118af4946a0b545731d9b1e0a88' E - 2a5c4118af4946a0b545731d9b1e0a88 E + 00000000-0000-0000-0000-000000000000
tests.test_metrics::test_metrics_tracing_without_performance
Stack Traces | 0.079s run time
tests/test_metrics.py:165: in test_metrics_tracing_without_performance assert metrics[0]["trace_id"] == propagation_context.trace_id E AssertionError: assert '00000000-0000-0000-0000-000000000000' == '45ad53a0ca1346019ee9703778ec752d' E - 45ad53a0ca1346019ee9703778ec752d E + 00000000-0000-0000-0000-000000000000
tests.test_metrics::test_metrics_tracing_without_performance
Stack Traces | 0.082s run time
tests/test_metrics.py:165: in test_metrics_tracing_without_performance assert metrics[0]["trace_id"] == propagation_context.trace_id E AssertionError: assert '00000000-0000-0000-0000-000000000000' == 'ab68943432db44539b597c0595673fab' E - ab68943432db44539b597c0595673fab E + 00000000-0000-0000-0000-000000000000
tests.test_metrics::test_metrics_tracing_without_performance
Stack Traces | 0.086s run time
tests/test_metrics.py:165: in test_metrics_tracing_without_performance assert metrics[0]["trace_id"] == propagation_context.trace_id E AssertionError: assert '00000000-0000-0000-0000-000000000000' == '76e978bd47b84bcd8ce2b60bf506e5bb' E E - 76e978bd47b84bcd8ce2b60bf506e5bb E + 00000000-0000-0000-0000-000000000000
tests.test_metrics::test_metrics_tracing_without_performance
Stack Traces | 0.088s run time
tests/test_metrics.py:165: in test_metrics_tracing_without_performance assert metrics[0]["trace_id"] == propagation_context.trace_id E AssertionError: assert '00000000-0000-0000-0000-000000000000' == '95e525a841f74707b15e79fee34ae5f5' E E - 95e525a841f74707b15e79fee34ae5f5 E + 00000000-0000-0000-0000-000000000000
tests.test_metrics::test_metrics_tracing_without_performance
Stack Traces | 0.089s run time
tests/test_metrics.py:165: in test_metrics_tracing_without_performance assert metrics[0]["trace_id"] == propagation_context.trace_id E AssertionError: assert '00000000-0000-0000-0000-000000000000' == '12ce452811e643dbb391412e26249ecd' E E - 12ce452811e643dbb391412e26249ecd E + 00000000-0000-0000-0000-000000000000
tests.test_metrics::test_metrics_tracing_without_performance
Stack Traces | 0.09s run time
tests/test_metrics.py:165: in test_metrics_tracing_without_performance assert metrics[0]["trace_id"] == propagation_context.trace_id E AssertionError: assert '00000000-0000-0000-0000-000000000000' == '29263d13de564ffaab5ca86dff93ddc5' E E - 29263d13de564ffaab5ca86dff93ddc5 E + 00000000-0000-0000-0000-000000000000
tests.test_metrics::test_metrics_tracing_without_performance
Stack Traces | 0.093s run time
tests/test_metrics.py:165: in test_metrics_tracing_without_performance assert metrics[0]["trace_id"] == propagation_context.trace_id E AssertionError: assert '00000000-0000-0000-0000-000000000000' == '27cc5998282d4bf3b66ccbe348ae5825' E E - 27cc5998282d4bf3b66ccbe348ae5825 E + 00000000-0000-0000-0000-000000000000
tests.test_metrics::test_metrics_tracing_without_performance
Stack Traces | 0.096s run time
tests/test_metrics.py:165: in test_metrics_tracing_without_performance assert metrics[0]["trace_id"] == propagation_context.trace_id E AssertionError: assert '00000000-0000-0000-0000-000000000000' == '3f58c26fce9445aaace9a4021bdaf7ee' E E - 3f58c26fce9445aaace9a4021bdaf7ee E + 00000000-0000-0000-0000-000000000000
tests.test_metrics::test_metrics_tracing_without_performance
Stack Traces | 0.098s run time
tests/test_metrics.py:165: in test_metrics_tracing_without_performance assert metrics[0]["trace_id"] == propagation_context.trace_id E AssertionError: assert '00000000-0000-0000-0000-000000000000' == 'cfa392aecce840a98b77b29e0e0b6799' E E - cfa392aecce840a98b77b29e0e0b6799 E + 00000000-0000-0000-0000-000000000000
tests.test_metrics::test_metrics_tracing_without_performance
Stack Traces | 0.103s run time
tests/test_metrics.py:165: in test_metrics_tracing_without_performance assert metrics[0]["trace_id"] == propagation_context.trace_id E AssertionError: assert '00000000-0000-0000-0000-000000000000' == '524a8ab1545247d89df32e1738efcd6b' E E - 524a8ab1545247d89df32e1738efcd6b E + 00000000-0000-0000-0000-000000000000
tests.test_metrics::test_metrics_tracing_without_performance
Stack Traces | 0.11s run time
tests/test_metrics.py:165: in test_metrics_tracing_without_performance assert metrics[0]["trace_id"] == propagation_context.trace_id E AssertionError: assert '00000000-0000-0000-0000-000000000000' == 'c061d9d86bf14921b33f8ddb232a30b2' E E - c061d9d86bf14921b33f8ddb232a30b2 E + 00000000-0000-0000-0000-000000000000
tests.test_metrics::test_metrics_tracing_without_performance
Stack Traces | 0.11s run time
tests/test_metrics.py:165: in test_metrics_tracing_without_performance assert metrics[0]["trace_id"] == propagation_context.trace_id E AssertionError: assert '00000000-0000-0000-0000-000000000000' == '9c5ecefb378949428099198578625532' E E - 9c5ecefb378949428099198578625532 E + 00000000-0000-0000-0000-000000000000
tests.test_metrics::test_metrics_tracing_without_performance
Stack Traces | 0.2s run time
tests/test_metrics.py:165: in test_metrics_tracing_without_performance assert metrics[0]["trace_id"] == propagation_context.trace_id E AssertionError: assert '00000000-0000-0000-0000-000000000000' == '86a7e96a1ec04669b8ce6e64df3f9ef0' E E - 86a7e96a1ec04669b8ce6e64df3f9ef0 E + 00000000-0000-0000-0000-000000000000
tests.test_metrics::test_metrics_tracing_without_performance
Stack Traces | 0.215s run time
tests/test_metrics.py:165: in test_metrics_tracing_without_performance assert metrics[0]["trace_id"] == propagation_context.trace_id E AssertionError: assert '00000000-0000-0000-0000-000000000000' == 'a413143ee51a4c9b80afef0e5ba1cff4' E E - a413143ee51a4c9b80afef0e5ba1cff4 E + 00000000-0000-0000-0000-000000000000

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

if release is not None and "sentry.release" not in metric["attributes"]:
metric["attributes"]["sentry.release"] = release

trace_context = current_scope.get_trace_context()
Copy link
Member

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:
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants