Python OpenTelemetry APM

OpenTelemetry Python consists of two main packages: API and SDK. Both are available as part of PyPI.

Complete these tasks to properly integrate OpenTelemetry APM in Python:

Install API and SDK Packages

Run these install commands to install both packages:

pip install opentelemetry-api
pip install opentelemetry-sdk

Set Up Instrumentation

OpenTelemetry documentation for Traces clearly describes the basic steps for initializing a tracer and creating spans.

While New Relic supports automatic instrumentation of functions through the config file using Python agent configuration, OpenTelemetry does not have such support. However, you can easily create function spans with minimal code using function decorators.

Instrumentation Libraries

We recommend that you review the available OpenTelemetry instrumentation libraries to automatically instrument standard Python packages.

See the list and code for available instrumentation libraries on GitHub.

Examples

Common code scenarios and some example applications have been instrumented using OpenTelemetry, and shared in the OpenTelemetry documentation stack. See Examples and Cookbook.