8000 Respect parent_sampled decision in propagation_context sentry-trace header by sl0thentr0py · Pull Request #4356 · getsentry/sentry-python · GitHub
[go: up one dir, main page]

Skip to content

Respect parent_sampled decision in propagation_context sentry-trace header #4356

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

Merged
merged 2 commits into from
May 5, 2025

Conversation

sl0thentr0py
Copy link
Member
@sl0thentr0py sl0thentr0py commented May 2, 2025

Since we don't automatically have unsampled spans running, this caused a change in behavior when an upstream sampling decision needs to be propagated further downstream.

Explanation of problem

When an incoming trace has sampled set to 0 (trace_id-span_id-0),
in the past we would propagate this since we would have an active span/transaction running but just not sampled, so downstream would also receive trace_id-span_id-0 from that active span.
Now, we actually don't have an active span since we don't sample (just how otel works), so instead of sending the trace_id-span_id-0 as before, we would have sent trace_id-other_span_id from the propagation_context instead.
This would cause the downstream service to not receive the -0 flag and would thus sample independently, which is a regression.

@sl0thentr0py sl0thentr0py requested a review from a team as a code owner May 2, 2025 13:28
Copy link
codecov bot commented May 2, 2025

❌ 6 Tests Failed:

Tests completed Failed Passed Skipped
20348 6 20342 4395
View the top 3 failed test(s) by shortest run time
tests.integrations.redis.cluster.test_redis_cluster test_rediscluster_pipeline[False-expected_first_ten0]
Stack Traces | 0.099s run time
.../redis/cluster/test_redis_cluster.py:121: in test_rediscluster_pipeline
    pipeline = rc.pipeline()
.../redis/cluster/test_redis_cluster.py:16: in <lambda>
    redis.RedisCluster.pipeline = lambda *_, **__: pipeline_cls(None, None)
.tox/py3.12-redis-latest/lib/python3.12.../site-packages/redis/utils.py:188: in wrapper
    return func(*args, **kwargs)
.tox/py3.12-redis-latest/lib/python3.12.../site-packages/redis/cluster.py:2125: in __init__
    retries=self.cluster_error_retry_attempts,
E   AttributeError: 'ClusterPipeline' object has no attribute 'cluster_error_retry_attempts'
tests.integrations.redis.cluster.test_redis_cluster test_rediscluster_pipeline[True-expected_first_ten1]
Stack Traces | 0.101s run time
.../redis/cluster/test_redis_cluster.py:121: in test_rediscluster_pipeline
    pipeline = rc.pipeline()
.../redis/cluster/test_redis_cluster.py:16: in <lambda>
    redis.RedisCluster.pipeline = lambda *_, **__: pipeline_cls(None, None)
.tox/py3.12-redis-latest/lib/python3.12.../site-packages/redis/utils.py:188: in wrapper
    return func(*args, **kwargs)
.tox/py3.12-redis-latest/lib/python3.12.../site-packages/redis/cluster.py:2125: in __init__
    retries=self.cluster_error_retry_attempts,
E   AttributeError: 'ClusterPipeline' object has no attribute 'cluster_error_retry_attempts'
tests.integrations.redis.cluster.test_redis_cluster test_rediscluster_pipeline[False-expected_first_ten0]
Stack Traces | 0.104s run time
.../redis/cluster/test_redis_cluster.py:121: in test_rediscluster_pipeline
    pipeline = rc.pipeline()
.../redis/cluster/test_redis_cluster.py:16: in <lambda>
    redis.RedisCluster.pipeline = lambda *_, **__: pipeline_cls(None, None)
.tox/py3.13-redis-latest/lib/python3.13.../site-packages/redis/utils.py:188: in wrapper
    return func(*args, **kwargs)
.tox/py3.13-redis-latest/lib/python3.13.../site-packages/redis/cluster.py:2125: in __init__
    retries=self.cluster_error_retry_attempts,
E   AttributeError: 'ClusterPipeline' object has no attribute 'cluster_error_retry_attempts'

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

Copy link
Contributor
@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

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

lgtm

Base automatically changed from neel/sampler-debug-logger to potel-base May 5, 2025 11:41
@sl0thentr0py sl0thentr0py merged commit 8ee7dd4 into potel-base May 5, 2025
120 of 125 checks passed
@sl0thentr0py sl0thentr0py deleted the neel/fix-prop-context-traceparent branch May 5, 2025 11:42
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.

2 participants
0