opentelemetry-instrumentation


Nameopentelemetry-instrumentation JSON
Version 0.45b0 PyPI version JSON
download
home_pageNone
SummaryInstrumentation Tools & Auto Instrumentation for OpenTelemetry Python
upload_time2024-03-28 19:30:32
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            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/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 <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"


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
----------

* `OpenTelemetry Project <https://opentelemetry.io/>`_

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "opentelemetry-instrumentation",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "OpenTelemetry Authors <cncf-opentelemetry-contributors@lists.cncf.io>",
    "download_url": "https://files.pythonhosted.org/packages/b2/bd/dcf2c4c1132c580b60b548b17c4d115f1a2224961eac0a0138bf5f84d751/opentelemetry_instrumentation-0.45b0.tar.gz",
    "platform": null,
    "description": "OpenTelemetry Instrumentation\n=============================\n\n|pypi|\n\n.. |pypi| image:: https://badge.fury.io/py/opentelemetry-instrumentation.svg\n   :target: https://pypi.org/project/opentelemetry-instrumentation/\n\nInstallation\n------------\n\n::\n\n    pip install opentelemetry-instrumentation\n\n\nThis package provides commands that help automatically instrument a program:\n\n.. note::\n    You need to install a distro package to get auto instrumentation working. The ``opentelemetry-distro``\n    package contains the default distro and configurator and automatically configures some of the common options for users.\n    For more info about ``opentelemetry-distro`` check `here <https://opentelemetry-python.readthedocs.io/en/latest/examples/distro/README.html>`__\n    ::\n\n        pip install \"opentelemetry-distro[otlp]\"\n\n    When creating a custom distro and/or configurator, be sure to add entry points for each under `opentelemetry_distro` and `opentelemetry_configurator` respectfully.\n    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.\n\n\nopentelemetry-bootstrap\n-----------------------\n\n::\n\n    opentelemetry-bootstrap [-a |--action=][install|requirements]\n\nThis command install default instrumentation packages and detects active Python site-packages\nto figure out which instrumentation packages the user might want to install. By default, it\nprints out a list of the default and detected instrumentation packages that can be added to a\nrequirements.txt file. It also supports installing the packages when run with\n:code:`--action=install` or :code:`-a install` flag. All default and detectable\ninstrumentation packages are defined `here <https://github.com/flands/opentelemetry-python-contrib/blob/main/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py>`.\n\n\nopentelemetry-instrument\n------------------------\n\n::\n\n    opentelemetry-instrument python program.py\n\nThe instrument command will try to automatically detect packages used by your python program\nand when possible, apply automatic tracing instrumentation on them. This means your program\nwill get automatic distributed tracing without having to make any code changes. This will\nalso configure a global tracer and tracing exporter as well as a meter and meter exporter.\nBy default, the instrument command will use the OTLP exporter but this can be overridden.\n\nThe command supports the following configuration options as CLI arguments and environment\nvariables:\n\n\n* ``--traces_exporter`` or ``OTEL_TRACES_EXPORTER``\n* ``--metrics_exporter`` or ``OTEL_METRICS_EXPORTER``\n* ``--distro`` or ``OTEL_PYTHON_DISTRO``\n* ``--configurator`` or ``OTEL_PYTHON_CONFIGURATOR``\n\nThe exporter options define what exporter destination to use and can be set to one or more\nexporter names (see below). You can pass multiple values to configure multiple exporters\n(e.g., ``zipkin_json,otlp``).\n\n    - Defaults to `otlp`.\n    - Can be set to `none` to disable automatic tracer initialization.\n    - Can be set to 'console` to display JSON results locally.\n\nTrace exporter names:\n\n    - jaeger_proto\n    - jaeger_thrift\n    - opencensus\n    - otlp\n    - otlp_proto_grpc (`deprecated`)\n    - otlp_proto_http (`deprecated`)\n    - zipkin_json\n    - zipkin_proto\n\nMetric exporter names:\n\n    - otlp\n    - otlp_proto_grpc (`deprecated`)\n    - prometheus\n\nNote: The default transport protocol for ``otlp`` is gRPC.\n\n* ``--id-generator`` or ``OTEL_PYTHON_ID_GENERATOR``\n\nUsed to specify which IDs Generator to use for the global Tracer Provider. By default, it\nwill use the random IDs generator.\n\nThe code in ``program.py`` needs to use one of the packages for which there is\nan OpenTelemetry integration. For a list of the available integrations please\ncheck `here <https://opentelemetry-python.readthedocs.io/en/stable/index.html#integrations>`_\n\n* ``OTEL_PYTHON_DISABLED_INSTRUMENTATIONS``\n\nIf set by the user, opentelemetry-instrument will read this environment variable to disable specific instrumentations.\ne.g OTEL_PYTHON_DISABLED_INSTRUMENTATIONS = \"requests,django\"\n\n\nExamples\n^^^^^^^^\n\n::\n\n    opentelemetry-instrument --traces_exporter console flask run --port=3000\n\nThe above command will pass ``--traces_exporter console`` to the instrument command and ``--port=3000`` to ``flask run``.\n\n::\n\n    opentelemetry-instrument --traces_exporter zipkin_json,otlp celery -A tasks worker --loglevel=info\n\nThe above command will configure global trace provider, attach zipkin and otlp exporters to it and then\nstart celery with the rest of the arguments.\n\n::\n\n    opentelemetry-instrument --id_generator random flask run --port=3000\n\nThe above command will configure the global trace provider to use the Random IDs Generator, and then\npass ``--port=3000`` to ``flask run``.\n\nReferences\n----------\n\n* `OpenTelemetry Project <https://opentelemetry.io/>`_\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Instrumentation Tools & Auto Instrumentation for OpenTelemetry Python",
    "version": "0.45b0",
    "project_urls": {
        "Homepage": "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/opentelemetry-instrumentation"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fee5cb0cfa596fa18d09f458058d6e55e2fc82300a45ae57c457c197949fd4a6",
                "md5": "3bf6c3ac8172563f0434886ed3d2fa2d",
                "sha256": "06c02e2c952c1b076e8eaedf1b82f715e2937ba7eeacab55913dd434fbcec258"
            },
            "downloads": -1,
            "filename": "opentelemetry_instrumentation-0.45b0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3bf6c3ac8172563f0434886ed3d2fa2d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 28402,
            "upload_time": "2024-03-28T19:28:53",
            "upload_time_iso_8601": "2024-03-28T19:28:53.487462Z",
            "url": "https://files.pythonhosted.org/packages/fe/e5/cb0cfa596fa18d09f458058d6e55e2fc82300a45ae57c457c197949fd4a6/opentelemetry_instrumentation-0.45b0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b2bddcf2c4c1132c580b60b548b17c4d115f1a2224961eac0a0138bf5f84d751",
                "md5": "8d22daceec7b6a9f4a1f0eb5c74149b3",
                "sha256": "6c47120a7970bbeb458e6a73686ee9ba84b106329a79e4a4a66761f933709c7e"
            },
            "downloads": -1,
            "filename": "opentelemetry_instrumentation-0.45b0.tar.gz",
            "has_sig": false,
            "md5_digest": "8d22daceec7b6a9f4a1f0eb5c74149b3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 23377,
            "upload_time": "2024-03-28T19:30:32",
            "upload_time_iso_8601": "2024-03-28T19:30:32.377005Z",
            "url": "https://files.pythonhosted.org/packages/b2/bd/dcf2c4c1132c580b60b548b17c4d115f1a2224961eac0a0138bf5f84d751/opentelemetry_instrumentation-0.45b0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-28 19:30:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "open-telemetry",
    "github_project": "opentelemetry-python-contrib",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "opentelemetry-instrumentation"
}
        
Elapsed time: 0.21397s