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

Zipkin 706 prevent intermediate services to override a sample rate when doing zipkin_attrs override #137

Closed
wants to merge 4 commits into from

Conversation

acer618
Copy link
Contributor

@acer618 acer618 commented Oct 14, 2019

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.

@acer618 acer618 requested a review from drolando October 14, 2019 22:41
@coveralls
Copy link

coveralls commented Oct 14, 2019

Coverage Status

Coverage remained the same at ?% when pulling 543b581 on ZIPKIN-706-sample-rate-set-twice into 502a800 on master.

Copy link
Contributor

@drolando drolando left a 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?

@@ -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):
Copy link
Contributor

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

Copy link
Contributor Author

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')
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@drolando drolando closed this Oct 15, 2019
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.

None yet

3 participants