Skip to content


You can setup tracing for your Python application. Check sample configuration on how to setup traces.


git clone

If you don't have Python3 installed, please install it and then follow below steps.

Open file from that repository. and make changes to the highlighted lines below

from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter

# Service name is required for most backends
resource = Resource(attributes={
    SERVICE_NAME: "python-service"

# create a tracer provider
tracer_provider = TracerProvider(resource=resource)

# create an OTLP trace exporter
url = 'HTTP_Endpoint'
headers = {"Authorization": "Authorization"}

exporter = OTLPSpanExporter(endpoint=url, headers=headers)

# create a span processor to send spans to the exporter
span_processor = BatchSpanProcessor(exporter)

# add the span processor to the tracer provider

# set the tracer provider as the global provider

Setup up credentials

You will get url and Authorization key here

Replace the url and Authorization key in the file

Setup Service/Application

Follow the steps given in the sample-tracing-python readme and then start server

The server is now running, navigate to

Refresh page couple of times to get more traces exported.

Traces Sample Configration

Traces are captured, you can check these captured traces here

Traces Page

Filter traces with your service name python-service

Filter traces with service name

Click on any trace to check trace data

Trace details

Trace can have multiple spans, each span represents single operation or task within that trace. Click on any span to check span details.

Trace details