def __init__(self, tchannel=None, dst=None, sample_rate=None): """Log zipkin style trace. :param tchannel: The tchannel instance to send zipkin trace spans :param dst: The destination to output trace information :param sample_rate: The sample_rate determines the probability that the trace span been sampled. The rate of sampling is in the range [0, 1] with 0.01 precision. By default it takes 100% sampling. """ if tchannel: # TChannelZipkinTracer generates Base64-encoded span # and uploads to zipkin server self.tracer = TChannelZipkinTracer(tchannel) else: # DebugTracer generates json style span info and writes # to dst. By default it writes to stdout self.tracer = DebugTracer(dst) if sample_rate is None: sample_rate = self.DEFAULT_RATE assert 0 <= sample_rate <= 1 self.rate = sample_rate self._check_point = self.rate * (1 << 64)
def __init__(self, tchannel=None, dst=None): """Log zipkin style trace. :param tchannel: The tchannel instance to send zipkin trace spans :param dst: The destination to output trace information """ if tchannel: # TChannelZipkinTracer generates Base64-encoded span # and uploads to zipkin server self.tracer = TChannelZipkinTracer(tchannel) else: # DebugTracer generates json style span info and writes # to dst. By default it writes to stdout self.tracer = DebugTracer(dst)