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/open-telemetry/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.

Programmatic Auto-instrumentation

from opentelemetry.instrumentation import auto_instrumentation
auto_instrumentation.initialize()

If you are in an environment where you cannot use opentelemetry-instrument to inject auto-instrumentation you can do so programmatically with the code above. Please note that some instrumentations may require the initialize() method to be called before the library they instrument is imported.

References

Metadata

Release files for tapm-instrumentation 0.55b2.post10

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

Source distribution (sdist)

Source distribution for tapm-instrumentation 0.55b2.post10
File Size Uploaded
tapm_instrumentation-0.55b2.post10.tar.gz 28.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tapm-instrumentation 0.55b2.post10
File Interpreter ABI Platform
tapm_instrumentation-0.55b2.post10-py3-none-any.whl Python 3 none any Details

Total release size: 60.0 kB

Release files / tapm_instrumentation-0.55b2.post10.tar.gz

Download URL tapm_instrumentation-0.55b2.post10.tar.gz
Size 28.7 kB
Tags Source
SHA-256 checksum
How to use checksums
93f9559c4c34c79007fb5ef8288ee373f4befde8fe8800cfafc86dd1ed0f7892
BLAKE2b-256 checksum
How to use checksums
54c880d46f3cb839a4352f35202b08c26ff5f4ba20eb37e148a6754508668b34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.4

Release files / tapm_instrumentation-0.55b2.post10-py3-none-any.whl

Download URL tapm_instrumentation-0.55b2.post10-py3-none-any.whl
Size 31.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e3b9f64ba9a6fe85b8cca133a75f2d5fa3f4c90b2fa107114a39e4ebdfbff4e
BLAKE2b-256 checksum
How to use checksums
1947fe2e2b0c0e83bce86a960db2b91785bd3d6144a14e80e6ad3c58a20da746
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.4

Release history Release notifications | RSS feed

0.55.20

1 release file

0.55.9

2 release files

0.55.5

1 release file

0.55.4

1 release file

0.55.3

1 release file

0.55.2

1 release file

0.55.1

1 release file

This release

0.55b2.post10 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