How to output zipkin tracing results to a file in python?

269 views Asked by At

I am using py_zipkin in my code. And I can see the tracing result on the Zipkin UI. But I don't know how to output the tracing results to a file with specified format, like a log file. Here is a example of my code:

def fun1(self, param):
    with zipkin_span(
        service_name = 'my_code',
        span_name = 'fun1',
        transport_handler = http_transport,
        port = 8080,
        sample_rate = 100,
    ) as zipkin_context:
        run_some_func(param)
        zipkin_context.update_binary_annotations(param)

def http_transport(encoder_span):
    zipkin_url = 'http://127.0.0.1:9411/api/spans'
    requests.post(
        zipkin_url,
        data = encoded_span,
        headers = {'Content-Type': 'application/x-thrift'}
    )
0

There are 0 answers