-
Notifications
You must be signed in to change notification settings - Fork 1
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
Adds a provisioning api #25
Conversation
TODO: add rationale section for ignoring redundant. Based on a conversation earlier, this allows consitent processing without having implementations need to deal with merge rules for a non-use case |
@@ -42,23 +45,35 @@ | |||
String maybeValue = getter.get(request, samplingKey); | |||
if (maybeValue == null) return result; | |||
|
|||
SecondarySampling.Extra extra = EXTRA_FACTORY.create(); | |||
boolean sampledLocal = false; | |||
SampledLocalMap initial = new SampledLocalMap(); |
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.
Nicely abstracted! So same api is used for both provisioning and participation.
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.
yep in order to save bytecode and thinking. thx!
ok picking this up again |
brave/src/test/java/brave/secondary_sampling/integration/SecondarySamplingIntegratedTest.java
Outdated
Show resolved
Hide resolved
This is a work in progress until unit and integration tests exist. Fixes #10
09f7490
to
dd3699a
Compare
@@ -65,12 +65,14 @@ public String samplingKey() { | |||
|
|||
/** Retrieves the current TTL of this {@link #samplingKey()} or zero if there is none. */ | |||
public int ttl() { | |||
// TODO: add a limit to TTL, like 255 and make this and below super more efficient |
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.
raised #28
} | ||
|
||
static final class Extra extends MapPropagationFields<SecondarySamplingState, Boolean> { | ||
Extra() { | ||
} | ||
|
||
// avoids copy-on-write for each keys on initial construction | ||
Extra(Map<SecondarySamplingState, Boolean> initial) { |
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.
TODO: we need benchmarks as this whole codebase can add a lot of overhead if we aren't careful.
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.
feedback welcome post merge |
This adds
SecondaryProvisioner
which can add one or more sampling keys, and optionally sample locally if the same node is participating.Fixes #10