Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
with self.mux:
return self.spans[:]
class Sampler(six.with_metaclass(ABCMeta, object)):
"""Sampler determines the sampling status of a span given its trace_id.
Sampler.sampled() is expected to return a boolean.
"""
@abstractmethod
def sampled(self, trace_id):
pass
class DefaultSampler(Sampler):
"""DefaultSampler determines the sampling status via ID % rate == 0.
"""
def __init__(self, rate):
self.rate = rate
def sampled(self, trace_id):
return trace_id % self.rate == 0