Deploy this integration to enable automatic instrumentation of your Python application using OpenTelemetry.

Architecture overview

This integration includes:

  • Installing the OpenTelemetry Python instrumentation packages on your application host
  • Installing the OpenTelemetry collector with exporter
  • Running your Python application in conjunction with the OpenTelemetry instrumentation

On deployment, the Python instrumentation automatically captures spans from your application and forwards them to the collector, which exports the data to your account.

Setup auto-instrumentation for your locally hosted Python application and send traces to

Before you begin, you’ll need:

  • A Python application without instrumentation
  • An active account with
  • Port 4317 available on your host system
  • A name defined for your tracing service
Install general Python OpenTelemetry instrumentation components

Run the following commands:

pip3 install opentelemetry-distro
pip3 install opentelemetry-instrumentation
opentelemetry-bootstrap --action=install
pip3 install opentelemetry-exporter-otlp
set environment variables

After installation, configure the exporter by running the following command:


Replace <YOUR-SERVICE-NAME> with the name of your tracing service defined earlier.

Download and configure OpenTelemetry collector

Known Issue, June 2021: OpenTelemetry collector version 0.24 and above does not function as expected when deployed with the exporter. To remediate this issue, if you’re currently using version 0.24 or above, replace your OpenTelemetry collector with version 0.23 or lower. The resolution for this issue is in development and is expected later this year.

Create a dedicated directory on the host of your Python application and download the OpenTelemetry collector that is relevant to the operating system of your host.

After downloading the collector, create a configuration file config.yaml with the parameters below.

  • Replace <<TRACING-SHIPPING-TOKEN>> with the token of the account you want to ship to.

If your account is hosted in any region other than us, replace LOGZIO_ACCOUNT_REGION_CODE> with the applicable region code.


    account_token: "<<TRACING-SHIPPING-TOKEN>>"
    #region: "<<LOGZIO_ACCOUNT_REGION_CODE>>" - (Optional): Your account region code. Defaults to "us". Required only if your region is different than US East.


    endpoint: :1777
    endpoint: :55679

  extensions: [health_check, pprof, zpages]
      receivers: [otlp]
      processors: [batch]
      exporters: [logzio]
Start the collector

Run the following command:

<path/to>/otelcontribcol_<VERSION-NAME> --config ./config.yaml
  • Replace <path/to> with the path to the directory where you downloaded the collector.
  • Replace <VERSION-NAME> with the version name of the collector applicable to your system, e.g. otelcontribcol_darwin_amd64.
Run the OpenTelemetry instrumentation in conjunction with your Python application

Run the following command from the directory of your Python application script:

opentelemetry-instrument python3 <YOUR-APPLICATION-SCRIPT>.py

Replace <YOUR-APPLICATION-SCRIPT> with the name of your Python application script.

Check for your traces

Give your traces some time to get from your system to ours, and then open Tracing.