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

Adds a provisioning api #25

Merged
merged 7 commits into from
Oct 29, 2019
Merged

Adds a provisioning api #25

merged 7 commits into from
Oct 29, 2019

Conversation

codefromthecrypt
Copy link
Contributor

@codefromthecrypt codefromthecrypt commented Oct 9, 2019

This adds SecondaryProvisioner which can add one or more sampling keys, and optionally sample locally if the same node is participating.

Fixes #10

@codefromthecrypt
Copy link
Contributor Author

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();
Copy link
Collaborator

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.

Copy link
Contributor Author

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!

@codefromthecrypt
Copy link
Contributor Author

ok picking this up again

Adrian Cole and others added 4 commits October 28, 2019 07:53
@codefromthecrypt
Copy link
Contributor Author

OK I backfilled the tests. I'd like @jeqo and/or @anuraaga to comment even if this might not be the best first pull request to dive into.

@narayaruna if any questions come up, can you try to field them? It will be good practice.

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

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#29

@codefromthecrypt codefromthecrypt merged commit 8b3d910 into master Oct 29, 2019
@codefromthecrypt codefromthecrypt deleted the provisioner branch October 29, 2019 10:01
@codefromthecrypt
Copy link
Contributor Author

feedback welcome post merge

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.

Create an api to provision sampling keys
2 participants