# opentelemetry-instrumentation

> Instrumentation Tools & Auto Instrumentation for OpenTelemetry Python

- **URL**: https://www.freshcrate.ai/projects/opentelemetry-instrumentation
- **Author**: pypi
- **Category**: Developer Tools
- **Latest version**: `v0.63b1` (2026-05-21)
- **License**: Unknown
- **Source**: https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/opentelemetry-instrumentation
- **Homepage**: https://pypi.org/project/opentelemetry-instrumentation/
- **Language**: Python
- **GitHub**: 1,031 stars, 932 forks
- **Registry**: pypi (`opentelemetry-instrumentation`)
- **Tags**: `pypi`

## Description

OpenTelemetry Instrumentation
=============================

|pypi|

.. |pypi| image:: https://badge.fury.io/py/opentelemetry-instrumentation.svg
   :target: https://pypi.org/project/opentelemetry-instrumentation/

Installation
------------

::

    pip install opentelemetry-instrumentation


This package provides commands that help automatically instrument a program:

.. note::
    You need to install a distro package to get auto instrumentation working. The ``opentelemetry-distro``
    package contains the default distro and configurator and automatically configures some of the common options for users.
    For more info about ``opentelemetry-distro`` check `here <https://opentelemetry-python.readthedocs.io/en/latest/examples/distro/README.html>`__
    ::

        pip install "opentelemetry-distro[otlp]"

    When creating a custom distro and/or configurator, be sure to add entry points for each under `opentelemetry_distro` and `opentelemetry_configurator` respectfully.
    If you have entry points for multiple distros or configurators present in your environment, you should specify the entry point name of the distro and configurator you want to be used via the `OTEL_PYTHON_DISTRO` and `OTEL_PYTHON_CONFIGURATOR` environment variables.


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
:code:`--action=install` or :code:`-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 <https://opentelemetry-python.readthedocs.io/en/stable/index.html#integrations>`_

* ``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"

If the variables contains ``*`` as member no instrumentation will be enabled.

* ``OTEL_PYTHON_AUTO_INSTRUMENTATION_EXPERIMENTAL_GEVENT_PATCH``

If set by the user to `patch_all` , opentelemetry instrument will call the gevent monkeypatching method ``patch_all``.
This is considered experimental but can be useful to instrument gevent applications.
e.g OTEL_PYTHON_AUTO_INSTRUMENTATION_EXPERIMENTAL_GEVENT_PATCH=patch_all


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 wor

## Recent releases

| Version | Date | Urgency | Changes |
| --- | --- | --- | --- |
| `v0.63b1` | 2026-05-21 | High | This is a patch release on the previous 1.42.0/0.63b0 release, fixing the issue(s) below. |
| `opentelemetry-instrumentation-google-genai==0.7b1` | 2026-05-19 | High | This is a patch release on the previous 0.7b0 release, fixing the issue(s) below. |
| `opentelemetry-instrumentation-openai-v2==2.4b0` | 2026-05-01 | High | - Migrate experimental path from deprecated `LLMInvocation` to `InferenceInvocation`, using `handler.start_inference()` and `invocation.stop()`/`invocation.fail()` directly ([#4502](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4502)) - Use `create_duration_histogram` and `create_token_histogram` from `opentelemetry-util-genai` instead of defining bucket boundaries locally ([#4501](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4501)) - Import `OTEL_I |
| `v0.62b1` | 2026-04-24 | High | This is a patch release on the previous 1.41.0/0.62b0 release, fixing the issue(s) below.   ### Fixed  - `opentelemetry-instrumentation-pika` Use `ObjectProxy` instead of `BaseObjectProxy` for `ReadyMessagesDequeProxy` to restore iterability with wrapt 2.x ([#4461](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4461)) - `opentelemetry-instrumentation-dbapi` Use `ObjectProxy` instead of `BaseObjectProxy` for `TracedCursorProxy` to restore iterability with wrapt 2.x ([#4427](h |
| `0.62b0` | 2026-04-21 | Low | Imported from PyPI (0.62b0) |
| `v0.62b0` | 2026-04-09 | Medium | ### Added  - `opentelemetry-instrumentation-asgi`: Respect `suppress_http_instrumentation` context in ASGI middleware to skip server span creation when HTTP instrumentation is suppressed ([#4375](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4375)) - `opentelemetry-instrumentation-confluent-kafka`: Loosen confluent-kafka upper bound to <3.0.0 ([#4289](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4289)) - `opentelemetry-instrumentation`: Add support |
| `v0.62b0` | 2026-04-09 | Medium | ### Added  - `opentelemetry-instrumentation-asgi`: Respect `suppress_http_instrumentation` context in ASGI middleware to skip server span creation when HTTP instrumentation is suppressed ([#4375](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4375)) - `opentelemetry-instrumentation-confluent-kafka`: Loosen confluent-kafka upper bound to <3.0.0 ([#4289](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4289)) - `opentelemetry-instrumentation`: Add support |
| `v0.62b0` | 2026-04-09 | Medium | ### Added  - `opentelemetry-instrumentation-asgi`: Respect `suppress_http_instrumentation` context in ASGI middleware to skip server span creation when HTTP instrumentation is suppressed ([#4375](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4375)) - `opentelemetry-instrumentation-confluent-kafka`: Loosen confluent-kafka upper bound to <3.0.0 ([#4289](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4289)) - `opentelemetry-instrumentation`: Add support |
| `opentelemetry-opamp-client==0.2b0` | 2026-04-01 | Medium | - Breaking change: callback class `Callbacks` renamed to `OpAMPCallbacks` ([#4355](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4355)) |
| `opentelemetry-opamp-client==0.1b0` | 2026-03-23 | Medium | - Initial implementation ([#3635](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3635)) - Update client to have additional callback methods ([#4322](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4322)) |

## Citation

- HTML: https://www.freshcrate.ai/projects/opentelemetry-instrumentation
- Markdown: https://www.freshcrate.ai/projects/opentelemetry-instrumentation.md
- Dependencies JSON: https://www.freshcrate.ai/api/projects/opentelemetry-instrumentation/deps

_Generated by freshcrate.ai. Indexes pypi releases for AI-agent ecosystem packages._
