Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

pypi

Installation

pip install opentelemetry-instrumentation

This package provides commands that help automatically instrument a program:

opentelemetry-bootstrap

opentelemetry-bootstrap [-a |--action=][install|requirements]

This command install default instrumentation packages and detects active Python site-packages to figure out which instrumentation packages the user might want to install. By default, it prints out a list of the default and detected instrumentation packages that can be added to a requirements.txt file. It also supports installing the packages when run with --action=install or -a install flag. All default and detectable instrumentation packages are defined here <https://github.com/flands/opentelemetry-python-contrib/blob/main/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py>.

opentelemetry-instrument

opentelemetry-instrument python program.py

The instrument command will try to automatically detect packages used by your python program and when possible, apply automatic tracing instrumentation on them. This means your program will get automatic distributed tracing without having to make any code changes. This will also configure a global tracer and tracing exporter as well as a meter and meter exporter. By default, the instrument command will use the OTLP exporter but this can be overridden.

The command supports the following configuration options as CLI arguments and environment variables:

  • --traces_exporter or OTEL_TRACES_EXPORTER

  • --metrics_exporter or OTEL_METRICS_EXPORTER

  • --distro or OTEL_PYTHON_DISTRO

  • --configurator or OTEL_PYTHON_CONFIGURATOR

The exporter options define what exporter destination to use and can be set to one or more exporter names (see below). You can pass multiple values to configure multiple exporters (e.g., zipkin_json,otlp).

  • Defaults to otlp.

  • Can be set to none to disable automatic tracer initialization.

  • Can be set to ‘console` to display JSON results locally.

Trace exporter names:

  • jaeger_proto

  • jaeger_thrift

  • opencensus

  • otlp

  • otlp_proto_grpc (deprecated)

  • otlp_proto_http (deprecated)

  • zipkin_json

  • zipkin_proto

Metric exporter names:

  • otlp

  • otlp_proto_grpc (deprecated)

  • prometheus

Note: The default transport protocol for otlp is gRPC.

  • --id-generator or OTEL_PYTHON_ID_GENERATOR

Used to specify which IDs Generator to use for the global Tracer Provider. By default, it will use the random IDs generator.

The code in program.py needs to use one of the packages for which there is an OpenTelemetry integration. For a list of the available integrations please check here

  • OTEL_PYTHON_DISABLED_INSTRUMENTATIONS

If set by the user, opentelemetry-instrument will read this environment variable to disable specific instrumentations. e.g OTEL_PYTHON_DISABLED_INSTRUMENTATIONS = “requests,django”

Examples

opentelemetry-instrument --traces_exporter console flask run --port=3000

The above command will pass --traces_exporter console to the instrument command and --port=3000 to flask run.

opentelemetry-instrument --traces_exporter zipkin_json,otlp celery -A tasks worker --loglevel=info

The above command will configure global trace provider, attach zipkin and otlp exporters to it and then start celery with the rest of the arguments.

opentelemetry-instrument --id_generator random flask run --port=3000

The above command will configure the global trace provider to use the Random IDs Generator, and then pass --port=3000 to flask run.

References

Release files for opentelemetry-instrumentation 0.44b0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opentelemetry-instrumentation 0.44b0
File Size Uploaded
opentelemetry_instrumentation-0.44b0.tar.gz 23.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for opentelemetry-instrumentation 0.44b0
File Interpreter ABI Platform
opentelemetry_instrumentation-0.44b0-py3-none-any.whl Python 3 none any Details

Total release size: 51.8 kB

Release files / opentelemetry_instrumentation-0.44b0.tar.gz

Download URL opentelemetry_instrumentation-0.44b0.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8213d02d8c0987b9b26386ae3e091e0477d6331673123df736479322e1a50b48
BLAKE2b-256 checksum
How to use checksums
075b783fb2d3a1f9d6c826af3ee2f255ca7675a1d050478699ddc636945a30c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.18

Release files / opentelemetry_instrumentation-0.44b0-py3-none-any.whl

Download URL opentelemetry_instrumentation-0.44b0-py3-none-any.whl
Size 28.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79560f386425176bcc60c59190064597096114c4a8e5154f1cb281bb4e47d2fc
BLAKE2b-256 checksum
How to use checksums
bfe3b2a8260862d278ac2505c8cb61d11185349f5ea537946220f5c7d738de2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.18

Release history Release notifications | RSS feed

This release

0.44b0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page