-
Notifications
You must be signed in to change notification settings - Fork 47
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
Zipkin 706 prevent intermediate services to override a sample rate when doing zipkin_attrs override #137
Conversation
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.
Can you add a PR description?
tests/zipkin_test.py
Outdated
@@ -215,6 +213,17 @@ def test_init_span_storage_wrong_type(self): | |||
): | |||
pass | |||
|
|||
def test_error_when_sample_rate_and_attrs_override(self): | |||
with pytest.raises(ZipkinError): |
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.
catch the exception with as e
and then assert that the message contains sample_rate should not be set when zipkin_attrs are provided
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.
done
@@ -241,6 +241,10 @@ def __init__( | |||
"use the timestamp and duration parameters." | |||
) | |||
|
|||
if self.zipkin_attrs_override and self.sample_rate is not None: | |||
raise ZipkinError( | |||
'sample_rate should not be set when zipkin_attrs are provided') |
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.
Also add a section in DEPRECATIONS.rst on how to do the resampling now that this is gone.
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.
done
with zipkin_attrs override the sample_rate is defaulted to 100 percent if no explicit sample_rate is provided. While creating zipkin_span though there is an option to additionally provide a sample_rate. This change throughs a ZipkinError if both zipkin_attr override and sample_rate were specified at the same time. The sample_rate override should be part of the zipkin_attr creation.