This release is a pre-release and may not be stable for production use.
Installation
pip install opentelemetry-instrumentation
This package provides a couple of commands that help automatically instruments a program:
opentelemetry-bootstrap
opentelemetry-bootstrap --action=install|requirements
This commands inspects the active Python site-packages and figures out which
instrumentation packages the user might want to install. By default it prints out
a list of the suggested instrumentation packages which can be added to a requirements.txt
file. It also supports installing the suggested packages when run with --action=install
flag.
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 for free without having to make any code changes at all. This will also configure a global tracer and tracing exporter without you having to make any code changes. By default, the instrument command will use the OTLP exporter but this can be overridden when needed.
The command supports the following configuration options as CLI arguments and environment vars:
--traces_exporter or OTEL_TRACES_EXPORTER
--metrics_exporter or OTEL_METRICS_EXPORTER
--distro or OTEL_PYTHON_DISTRO
--configurator or OTEL_PYTHON_CONFIGURATOR
Used to specify which trace exporter to use. Can be set to one or more of the well-known exporter names (see below).
Defaults to otlp.
Can be set to none to disable automatic tracer initialization.
You can pass multiple values to configure multiple exporters e.g, zipkin,prometheus
Well known trace exporter names:
jaeger_proto
jaeger_thrift
opencensus
zipkin_json
zipkin_proto
otlp
otlp_proto_grpc (deprecated)
otlp_proto_http (deprecated)
Note: The default transport protocol for otlp is gRPC. HTTP is currently supported for traces only, and should be set using OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf
--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 otlp flask run --port=3000
The above command will pass --traces_exporter otlp 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
Metadata
Release files for opentelemetry-instrumentation 0.41b0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| opentelemetry_instrumentation-0.41b0.tar.gz | 21.6 kB | Without provenance | Details for opentelemetry_instrumentation-0.41b0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| opentelemetry_instrumentation-0.41b0-py3-none-any.whl | Python 3 | none | any | Details for opentelemetry_instrumentation-0.41b0-py3-none-any.whl |
Total release size: 47.5 kB
Release files / opentelemetry_instrumentation-0.41b0.tar.gz
| Download URL | opentelemetry_instrumentation-0.41b0.tar.gz |
|---|---|
| Size | 21.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
214382ba10dfd29d4e24898a4c7ef18b7368178a6277a1aec95cdb75cabf4612
|
|
BLAKE2b-256 checksum How to use checksums |
15d0772e619dda9aadfe9641db06c555c8dd84a00ae1ea5cf8639ba1f9da61b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.17
|
Release files / opentelemetry_instrumentation-0.41b0-py3-none-any.whl
| Download URL | opentelemetry_instrumentation-0.41b0-py3-none-any.whl |
|---|---|
| Size | 25.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ef9e5705ceca0205992a4a845ae4251ce6ec15a1206ca07c2b00afb0c5bd386
|
|
BLAKE2b-256 checksum How to use checksums |
cac609f554c655bc93b37e54915257236d2462a120d12b01cf4699e178a5f612
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.17
|
Security for opentelemetry-instrumentation 0.41b0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.