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.


To obtain an endpoint of Jaeger or Zipkin, perform the following steps:
  1. Log on to the Tracing Analysis console. In the top navigation bar, select a region.
  2. In the left-side navigation pane, click Cluster Configurations. Then, click the Access point information tab.
  3. In the Cluster Information section of the Access point information tab, turn on Show Token.
  4. In the Client section, click Jaeger or Zipkin.

    Obtain an endpoint of Jaeger or Zipkin in the Related Information column of the table in the lower part.

    Endpoint of Jaeger or Zipkin
    • If your application is deployed in an Alibaba Cloud production environment, use a private endpoint. Otherwise, use a public endpoint. Generally, use the endpoint of v2 for Zipkin. Use the endpoint of v1 only if you know Zipkin well.

Background information

How is data reported?
  • The following figure shows how to report data without using the Jaeger agent. Report data without using the Jaeger agent
  • The following figure shows how to report data by using the Jaeger agent. Use the Jaeger agent to report data


  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.
    Important Replace <endpoint> with the endpoint of the region where the client resides. You can obtain the endppoint on the Overview page in the Tracing Analysis console. For more information, see the Prerequisites topic.
    // The parameter specifies an endpoint. The endpoint varies based on the region.  Examples:
    $ 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={})