xray: fix the default sampling rate for AWS X-Ray tracer#15958
xray: fix the default sampling rate for AWS X-Ray tracer#15958asraa merged 9 commits intoenvoyproxy:mainfrom
Conversation
and test for the same if no localized sampling rule is applied. Update the release ntoes with the bug fix information Signed-off-by: Sunil Narasimhamurthy <sunnrs@amazon.com>
| /** | ||
| * @return the default manifest. Mainly for unit testing purposes. | ||
| */ | ||
| LocalizedSamplingManifest& defaultManifest() { return default_manifest_; } |
There was a problem hiding this comment.
Since this is just used for validation in tests, can you make this a const LocalizedSamplingManifest& defaultManifest() const.
There was a problem hiding this comment.
Thanks for the tip. I made this change.
| * tls: fix issue where OCSP was inadvertently removed from SSL response in multi-context scenarios. | ||
| * upstream: fix handling of moving endpoints between priorities when active health checks are enabled. Previously moving to a higher numbered priority was a NOOP, and moving to a lower numbered priority caused an abort. | ||
| * upstream: retry budgets will now set default values for xDS configurations. | ||
| * xray: fix the default sampling 'rate' for AWS X-Ray tracer extension to be 5%. |
There was a problem hiding this comment.
Is there a reason this is under "bug fixes" and not "minor behavioral changes"?
There was a problem hiding this comment.
As per the design proposal #5644 and documented behavior, the default sampling rate for AWS X-Ray tracer is expected to be 5%. It was a typo/bug in the code that the DefaultRate value was 0.5 (50%) and not 0.05 (5%). Which will be addressed by this PR.
There was a problem hiding this comment.
Consider appending something like "as opposed to 50%" so it's clear that was the bug.
|
/wait-any |
unit testing to be a const and add a small code comment Signed-off-by: Sunil Narasimhamurthy <sunnrs@amazon.com>
|
Hi @tonya11en due to the release v1.18 that went today there was a merge conflict in docs/root/version_history/current.rst file which I just resolved. Can you please review the changes again and approve? Thank you for your time. |
tonya11en
left a comment
There was a problem hiding this comment.
Thanks for updating! This mostly LGTM, I just had questions/suggestions.
/wait-any
| * tls: fix issue where OCSP was inadvertently removed from SSL response in multi-context scenarios. | ||
| * upstream: fix handling of moving endpoints between priorities when active health checks are enabled. Previously moving to a higher numbered priority was a NOOP, and moving to a lower numbered priority caused an abort. | ||
| * upstream: retry budgets will now set default values for xDS configurations. | ||
| * xray: fix the default sampling 'rate' for AWS X-Ray tracer extension to be 5%. |
There was a problem hiding this comment.
Consider appending something like "as opposed to 50%" so it's clear that was the bug.
| namespace XRay { | ||
|
|
||
| constexpr double DefaultRate = 0.5; | ||
| // DefaultRate=0.05 corresponds to 5% sampling rate when no custom rules are applied |
There was a problem hiding this comment.
nit: End with a period.
You also can just start with // Corresponds to....
It's not clear why only this variable gets an explanation, but the others do not. The JSON keys are obvious, but DefaultFixedTarget and SamplingFileVersion may as well get an explanation too.
There was a problem hiding this comment.
Added the comments (explanation) for the other two variables as well. 👍
And for the previous review comment > Consider appending something like ... I made the change in the latest commit. For some reason I was not able to directly reply to that review comment.
| /** | ||
| * @return default sampling rule's sampling rate. Mainly for unit testing purposes. | ||
| */ | ||
| double defaultRuleRate() const { return default_rule_.rate(); } | ||
|
|
There was a problem hiding this comment.
Is this necessary? Why can't you just call defaultRule().rate()?
There was a problem hiding this comment.
From earlier suggestion in this PR, the function LocalizedSamplingStrategy::defaultManifest() function was made a const.
const LocalizedSamplingManifest& defaultManifest() const.
So the return type is a const reference of LocalizedSamplingManifest object. To make a call strategy.defaultManifest().defaultRule().rate() in the UnitTest code, the function LocalizedSamplingManifest::defaultRule() was not expected to be called by a const reference of LocalizedSamplingManifest object.
Instead of making defaultRule function as const like this ->LocalizedSamplingManifest::defaultRule const() which in turn needed multiple changes where defaultRule function is called within the source code, I opted to creating a new function double defaultRuleRate() const {} which seemed like a less code change.
There was a problem hiding this comment.
Can you not just make a copy of the default rule in the unit test from the cost ref?
There was a problem hiding this comment.
Is this necessary? Why can't you just call
defaultRule().rate()?
It is not necessary. In the new commit, got rid of this function (defaultRuleRate) and instead making a copy of the default_manifest_ from the const ref
Signed-off-by: Sunil Narasimhamurthy <sunnrs@amazon.com>
…d make a copy of const object for the unit testing purpose Signed-off-by: Sunil Narasimhamurthy <sunnrs@amazon.com>
Signed-off-by: Sunil Narasimhamurthy <sunnrs@amazon.com>
tonya11en
left a comment
There was a problem hiding this comment.
Thanks! It's left in a better state than it was found, too!
LGTM assuming CI passes and all that.
|
Once again thanks for the review and suggestions, especially the hints for making it more readable. |
|
Hi @tonya11en, I resolved a new merge conflict in docs/root/version_history/current.rst file. Can you please approve once again? |
tonya11en
left a comment
There was a problem hiding this comment.
Looks like there's another conflict :(. There's a lot of churn right now in the release notes because we're setting up the new versions. Thanks for being patient.
I'll ping a maintainer once that's all fixed.
| * xray: fix the default sampling 'rate' for AWS X-Ray tracer extension to be 5% as opposed to 50%. | ||
| * zipkin: fix timestamp serializaiton in annotations. A prior bug fix exposed an issue with timestamps being serialized as strings. | ||
|
|
||
|
|
There was a problem hiding this comment.
Removed this extra line and resolved the merge conflict.
Signed-off-by: Sunil Narasimhamurthy <sunnrs@amazon.com>
|
Sure! Changes LGTM, would like to get an xray extension codeowner to check @abaptiste |
|
@asraa @tonya11en LGTM |
|
thanks @abaptiste @asraa @tonya11en for your time. |
…15958) * Fix the default sampling rate for AWS X-Ray tracer extension to 5% and test for the same if no localized sampling rule is applied. Update the release notes with the bug fix information Signed-off-by: Sunil Narasimhamurthy <sunnrs@amazon.com> Signed-off-by: Gokul Nair <gnair@twitter.com>
Signed-off-by: Sunil Narasimhamurthy sunnrs@amazon.com
Commit Message: fix the default sampling rate for AWS X-Ray tracer extension to 5%
Additional Description:
Risk Level: Low
Testing: unit test the LocalizedSamplingStrategy to check if the default sampling rate is 0.05 if no other localized rule is applied via configuration
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A