This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 96
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sampler was not adhering to the configured propability when not ALWAYS or NEVER. Issue was that the Sampler was using Number.MAX_VALUE, which uses 1024-bits. There were two issues with this approach: 1. The MAX_VALUE is NOT considered a "safe integer" and thus there are side effects during manipulation. 2. The `shouldSample` method was only comparing the idUpperBound (based on 1024-bits of data) to the lower 16 characters (64-bits) of a trace, which was resulting in the configured probabilty not being respected. We now us a 52-bit number, which falls within the "safe integer" range (53-bits) and is able to be fully represented by a 13-diget hex value. This allows the value to: 1. Be safely algorithmically manipulated without side effects. 2. Be easily compared to the lower 52-bits (13 characters) of a traceId. The tests have been updated to perform validation of traceIds that should and should not be sampled given a probability.
The zpages tests were relying on the fact that the sampler was broken, they have now been configured to always sample to make sure the tests pass.
kjin
approved these changes
Aug 23, 2018
@justindsmith Thanks! |
kjin
pushed a commit
to kjin/opencensus-node
that referenced
this pull request
Aug 24, 2018
Sampler was not adhering to the configured propability when not ALWAYS or NEVER. Issue was that the Sampler was using Number.MAX_VALUE, which uses 1024-bits. There were two issues with this approach: 1. The MAX_VALUE is NOT considered a "safe integer" and thus there are side effects during manipulation. 2. The `shouldSample` method was only comparing the idUpperBound (based on 1024-bits of data) to the lower 16 characters (64-bits) of a trace, which was resulting in the configured probabilty not being respected. We now us a 52-bit number, which falls within the "safe integer" range (53-bits) and is able to be fully represented by a 13-diget hex value. This allows the value to: 1. Be safely algorithmically manipulated without side effects. 2. Be easily compared to the lower 52-bits (13 characters) of a traceId. The tests have been updated to perform validation of traceIds that should and should not be sampled given a probability.
kjin
pushed a commit
to kjin/opencensus-node
that referenced
this pull request
Aug 24, 2018
Sampler was not adhering to the configured propability when not ALWAYS or NEVER. Issue was that the Sampler was using Number.MAX_VALUE, which uses 1024-bits. There were two issues with this approach: 1. The MAX_VALUE is NOT considered a "safe integer" and thus there are side effects during manipulation. 2. The `shouldSample` method was only comparing the idUpperBound (based on 1024-bits of data) to the lower 16 characters (64-bits) of a trace, which was resulting in the configured probabilty not being respected. We now us a 52-bit number, which falls within the "safe integer" range (53-bits) and is able to be fully represented by a 13-diget hex value. This allows the value to: 1. Be safely algorithmically manipulated without side effects. 2. Be easily compared to the lower 52-bits (13 characters) of a traceId. The tests have been updated to perform validation of traceIds that should and should not be sampled given a probability.
kjin
pushed a commit
to kjin/opencensus-node
that referenced
this pull request
Aug 24, 2018
Sampler was not adhering to the configured propability when not ALWAYS or NEVER. Issue was that the Sampler was using Number.MAX_VALUE, which uses 1024-bits. There were two issues with this approach: 1. The MAX_VALUE is NOT considered a "safe integer" and thus there are side effects during manipulation. 2. The `shouldSample` method was only comparing the idUpperBound (based on 1024-bits of data) to the lower 16 characters (64-bits) of a trace, which was resulting in the configured probabilty not being respected. We now us a 52-bit number, which falls within the "safe integer" range (53-bits) and is able to be fully represented by a 13-diget hex value. This allows the value to: 1. Be safely algorithmically manipulated without side effects. 2. Be easily compared to the lower 52-bits (13 characters) of a traceId. The tests have been updated to perform validation of traceIds that should and should not be sampled given a probability.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sampler was not adhering to the configured propability when not ALWAYS or
NEVER. Issue was that the Sampler was using Number.MAX_VALUE, which uses
1024-bits. There were two issues with this approach:
effects during manipulation.
shouldSample
method was only comparing the idUpperBound (based on1024-bits of data) to the lower 16 characters (64-bits) of a trace, which
was resulting in the configured probabilty not being respected.
We now us a 52-bit number, which falls within the "safe integer" range (53-bits)
and is able to be fully represented by a 13-diget hex value. This allows the
value to:
The tests have been updated to perform validation of traceIds that should and
should not be sampled given a probability.
fixes #99