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

Implement simple hash based sampler (sample request based on hash value of trace_id) #2

Open
jettify opened this issue Oct 2, 2017 · 0 comments

Comments

@jettify
Copy link
Member

jettify commented Oct 2, 2017

  1. Create abstract base class SamplerAbc
  2. Make current class subclass of SamplerAbc
  3. Implement one more sampler class base and hash idea from brave

class Sampler:
def __init__(self, *, sample_rate=1.0, seed=None):
self._sample_rate = sample_rate
self._rng = Random(seed)
def is_sampled(self, trace_id):
if self._sample_rate == 0.0:
sampled = False
else:
sampled = self._rng.random() <= self._sample_rate
return sampled

But sampling logic ported from here:
https://github.com/openzipkin/brave/blob/967e48507f6267c07e3238b8f30575c683690ef6/brave/src/main/java/brave/sampler/BoundarySampler.java#L43-L47

@jettify jettify changed the title Implement hash based sampler Implement simple hash based sampler (sample request based on hash value of trace_id) Nov 18, 2017
@jettify jettify added help wanted and removed easy labels Apr 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant