OpenTelemetry urllib3 Instrumentation
======================================
|pypi|
.. |pypi| image:: https://badge.fury.io/py/opentelemetry-instrumentation-urllib3.svg
:target: https://pypi.org/project/opentelemetry-instrumentation-urllib3/
This library allows tracing HTTP requests made by the
`urllib3 <https://urllib3.readthedocs.io/>`_ library.
Installation
------------
::
pip install opentelemetry-instrumentation-urllib3
Configuration
-------------
Request/Response hooks
**********************
The urllib3 instrumentation supports extending tracing behavior with the help of
request and response hooks. These are functions that are called back by the instrumentation
right after a Span is created for a request and right before the span is finished processing a response respectively.
The hooks can be configured as follows:
.. code:: python
# `request` is an instance of urllib3.connectionpool.HTTPConnectionPool
def request_hook(span, request):
pass
# `request` is an instance of urllib3.connectionpool.HTTPConnectionPool
# `response` is an instance of urllib3.response.HTTPResponse
def response_hook(span, request, response):
pass
URLLib3Instrumentor().instrument(
request_hook=request_hook, response_hook=response_hook
)
Exclude lists
*************
To exclude certain URLs from being tracked, set the environment variable ``OTEL_PYTHON_URLLIB3_EXCLUDED_URLS``
(or ``OTEL_PYTHON_EXCLUDED_URLS`` as fallback) with comma delimited regexes representing which URLs to exclude.
For example,
::
export OTEL_PYTHON_URLLIB3_EXCLUDED_URLS="client/.*/info,healthcheck"
will exclude requests such as ``https://site/client/123/info`` and ``https://site/xyz/healthcheck``.
References
----------
* `OpenTelemetry urllib3 Instrumentation <https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/urllib3/urllib3.html>`_
* `OpenTelemetry Project <https://opentelemetry.io/>`_
* `OpenTelemetry Python Examples <https://github.com/open-telemetry/opentelemetry-python/tree/main/docs/examples>`_
Raw data
{
"_id": null,
"home_page": null,
"name": "opentelemetry-instrumentation-urllib3",
"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/4f/7a/20f69cf9222c42021e3d219ee47e65884488f8259f8577080f963b796048/opentelemetry_instrumentation_urllib3-0.45b0.tar.gz",
"platform": null,
"description": "OpenTelemetry urllib3 Instrumentation\n======================================\n\n|pypi|\n\n.. |pypi| image:: https://badge.fury.io/py/opentelemetry-instrumentation-urllib3.svg\n :target: https://pypi.org/project/opentelemetry-instrumentation-urllib3/\n\nThis library allows tracing HTTP requests made by the\n`urllib3 <https://urllib3.readthedocs.io/>`_ library.\n\nInstallation\n------------\n\n::\n\n pip install opentelemetry-instrumentation-urllib3\n\nConfiguration\n-------------\n\nRequest/Response hooks\n**********************\n\nThe urllib3 instrumentation supports extending tracing behavior with the help of\nrequest and response hooks. These are functions that are called back by the instrumentation\nright after a Span is created for a request and right before the span is finished processing a response respectively.\nThe hooks can be configured as follows:\n\n.. code:: python\n\n # `request` is an instance of urllib3.connectionpool.HTTPConnectionPool\n def request_hook(span, request):\n pass\n\n # `request` is an instance of urllib3.connectionpool.HTTPConnectionPool\n # `response` is an instance of urllib3.response.HTTPResponse\n def response_hook(span, request, response):\n pass\n\n URLLib3Instrumentor().instrument(\n request_hook=request_hook, response_hook=response_hook\n )\n\nExclude lists\n*************\n\nTo exclude certain URLs from being tracked, set the environment variable ``OTEL_PYTHON_URLLIB3_EXCLUDED_URLS``\n(or ``OTEL_PYTHON_EXCLUDED_URLS`` as fallback) with comma delimited regexes representing which URLs to exclude.\n\nFor example,\n\n::\n\n export OTEL_PYTHON_URLLIB3_EXCLUDED_URLS=\"client/.*/info,healthcheck\"\n\nwill exclude requests such as ``https://site/client/123/info`` and ``https://site/xyz/healthcheck``.\n\nReferences\n----------\n\n* `OpenTelemetry urllib3 Instrumentation <https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/urllib3/urllib3.html>`_\n* `OpenTelemetry Project <https://opentelemetry.io/>`_\n* `OpenTelemetry Python Examples <https://github.com/open-telemetry/opentelemetry-python/tree/main/docs/examples>`_\n",
"bugtrack_url": null,
"license": null,
"summary": "OpenTelemetry urllib3 instrumentation",
"version": "0.45b0",
"project_urls": {
"Homepage": "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-urllib3"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "123fd7f6b0f3c2a0e13bcf4d92fce8d654915344a5455106c55c346e5fbbd159",
"md5": "cf44af2f07aa14fe51fec535ef3876a9",
"sha256": "9d4b2d046723479fa6a9e7eda43003abb152bc3546b0845be58ae13c54e6f71d"
},
"downloads": -1,
"filename": "opentelemetry_instrumentation_urllib3-0.45b0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cf44af2f07aa14fe51fec535ef3876a9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 11699,
"upload_time": "2024-03-28T19:30:19",
"upload_time_iso_8601": "2024-03-28T19:30:19.060422Z",
"url": "https://files.pythonhosted.org/packages/12/3f/d7f6b0f3c2a0e13bcf4d92fce8d654915344a5455106c55c346e5fbbd159/opentelemetry_instrumentation_urllib3-0.45b0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4f7a20f69cf9222c42021e3d219ee47e65884488f8259f8577080f963b796048",
"md5": "42b2aa39c102fd0863ae23025a89b106",
"sha256": "7e6654423615c0099ab436e9f1f54900a6675da568492e04f1f26169f59bceda"
},
"downloads": -1,
"filename": "opentelemetry_instrumentation_urllib3-0.45b0.tar.gz",
"has_sig": false,
"md5_digest": "42b2aa39c102fd0863ae23025a89b106",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 12816,
"upload_time": "2024-03-28T19:31:36",
"upload_time_iso_8601": "2024-03-28T19:31:36.926345Z",
"url": "https://files.pythonhosted.org/packages/4f/7a/20f69cf9222c42021e3d219ee47e65884488f8259f8577080f963b796048/opentelemetry_instrumentation_urllib3-0.45b0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-28 19:31:36",
"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-urllib3"
}