Before you can view the trace data of your application in the Tracing Analysis console, you must use a client to report the trace data to Tracing Analysis. This topic shows you how to use Jaeger to report Python application data.


  1. Log on to the Tracing Analysis console. In the left-side navigation pane, click Cluster Configurations.
  2. On the Cluster Configurations tab, click the Access point information tab. Then, turn on Show Token for the Cluster Information parameter.
  3. Set the Client parameter to the client that you want to use to collect trace data.
  4. In the Related Information column of the table in the lower part, click the copy icon next to the endpoint that you want to use.

Tracing Analysis Endpoint Section

Note: If you deploy your application in an Alibaba Cloud production environment, select a Virtual Private Cloud (VPC) endpoint. Otherwise, select a public endpoint. Generally, use the endpoint of v2 for Zipkin. Use the endpoint of v1 only if you know Zipkin well.

Background information

The following figure shows how to report data without using the Jaeger agent.

Report Tracing Data Directly

The following figure shows how to report data by using the Jaeger agent.

Report Tracing Data By Jaeger Agent


  1. Run the following command to install Jaeger:
    pip install jaeger-client
  2. Create a Tracer object. Then, use the Tracer object to create spans to trace workflows.
    import logging
    import time
    from jaeger_client import Config
    if __name__ == "__main__":
        log_level = logging.DEBUG
        logging.getLogger('').handlers = []
        logging.basicConfig(format='%(asctime)s %(message)s', level=log_level)
        config = Config(
            config={ # usually read from some yaml config
                'sampler': {
                    'type': 'const',
                    'param': 1,
                'logging': True,
        # this call also sets opentracing.tracer
        tracer = config.initialize_tracer()
        with tracer.start_span('TestSpan') as span:
            span.log_kv({'event': 'test message', 'life': 42})
            with tracer.start_span('ChildSpan', child_of=span) as child_span:
                span.log_kv({'event': 'down below'})
        time.sleep(2)   # yield to IOLoop to flush the spans -
        tracer.close()  # flush any buffered spans
  3. Download the native Jaeger agent jaeger-agent and set the parameter to start the agent. This way, data can be reported to Tracing Analysis.
    Notice Replace <endpoint> with the corresponding endpoint in the corresponding region that is displayed on the Overview page. For more information about how to obtain access point information, see Obtain access point information.
    // Reporter. grpc. host-port is used to set the gateway. The Gateway varies according to the region. Example:
    $ nohup. /jaeger-agent --jaeger.tags=<endpoint>

Use of Jaeger

  • Create a Tracer object

    from jaeger_client import Config
    def init_jaeger_tracer(service_name='your-app-name'):
        config = Config(config={}, service_name=service_name)
        return config.initialize_tracer()
  • Create and finish a span

    // Start a span that does not have a parent span.
    // Start a span that has a parent span.
    tracer.start_span('ChildSpan', child_of=span)
    // Finish the span.
  • Pass a SpanContext

    // Serialization: Inject a SpanContext and pass it to the next span.
            span_context=span.context, format=Format.TEXT_MAP, carrier=carrier
    // Deserialization: Extract a SpanContext that is passed.
    span_ctx = tracer.extract(format=Format.TEXT_MAP, carrier={})