Name | opentelemetry-instrumentation-urllib JSON |
Version |
0.45b0
JSON |
| download |
home_page | None |
Summary | OpenTelemetry urllib instrumentation |
upload_time | 2024-03-28 19:31:35 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
OpenTelemetry urllib Instrumentation
====================================
|pypi|
.. |pypi| image:: https://badge.fury.io/py/opentelemetry-instrumentation-urllib.svg
:target: https://pypi.org/project/opentelemetry-instrumentation-urllib/
This library allows tracing HTTP requests made by the
`urllib <https://docs.python.org/3/library/urllib.html>`_ library.
Installation
------------
::
pip install opentelemetry-instrumentation-urllib
Configuration
-------------
Request/Response hooks
**********************
The urllib 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_obj` is an instance of urllib.request.Request
def request_hook(span, request_obj):
pass
# `request_obj` is an instance of urllib.request.Request
# `response` is an instance of http.client.HTTPResponse
def response_hook(span, request_obj, response)
pass
URLLibInstrumentor.instrument(
request_hook=request_hook, response_hook=response_hook)
)
Exclude lists
*************
To exclude certain URLs from being tracked, set the environment variable ``OTEL_PYTHON_URLLIB_EXCLUDED_URLS``
(or ``OTEL_PYTHON_EXCLUDED_URLS`` as fallback) with comma delimited regexes representing which URLs to exclude.
For example,
::
export OTEL_PYTHON_URLLIB_EXCLUDED_URLS="client/.*/info,healthcheck"
will exclude requests such as ``https://site/client/123/info`` and ``https://site/xyz/healthcheck``.
References
----------
* `OpenTelemetry urllib Instrumentation <https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/urllib/urllib.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-urllib",
"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/19/c3/6025b7e2763be625ab22d9caf3fe2eb299633cbf3b62b3fd99115c69c5d2/opentelemetry_instrumentation_urllib-0.45b0.tar.gz",
"platform": null,
"description": "OpenTelemetry urllib Instrumentation\n====================================\n\n|pypi|\n\n.. |pypi| image:: https://badge.fury.io/py/opentelemetry-instrumentation-urllib.svg\n :target: https://pypi.org/project/opentelemetry-instrumentation-urllib/\n\nThis library allows tracing HTTP requests made by the\n`urllib <https://docs.python.org/3/library/urllib.html>`_ library.\n\nInstallation\n------------\n\n::\n\n pip install opentelemetry-instrumentation-urllib\n\nConfiguration\n-------------\n\nRequest/Response hooks\n**********************\n\nThe urllib 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_obj` is an instance of urllib.request.Request\n def request_hook(span, request_obj):\n pass\n\n # `request_obj` is an instance of urllib.request.Request\n # `response` is an instance of http.client.HTTPResponse\n def response_hook(span, request_obj, response)\n pass\n\n URLLibInstrumentor.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_URLLIB_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_URLLIB_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 urllib Instrumentation <https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/urllib/urllib.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 urllib instrumentation",
"version": "0.45b0",
"project_urls": {
"Homepage": "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-urllib"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d6dbd0b6cc3dfda12c715b92b501237bbaba41771c1fa3414e67c27749ce146a",
"md5": "a54c3dc2d7265cccaef45ba5a593778e",
"sha256": "92b0843a2c087c6ab81d4ad37f2432884a7f9ec91bd21a77858805944ed13fbd"
},
"downloads": -1,
"filename": "opentelemetry_instrumentation_urllib-0.45b0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a54c3dc2d7265cccaef45ba5a593778e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 11525,
"upload_time": "2024-03-28T19:30:17",
"upload_time_iso_8601": "2024-03-28T19:30:17.703472Z",
"url": "https://files.pythonhosted.org/packages/d6/db/d0b6cc3dfda12c715b92b501237bbaba41771c1fa3414e67c27749ce146a/opentelemetry_instrumentation_urllib-0.45b0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "19c36025b7e2763be625ab22d9caf3fe2eb299633cbf3b62b3fd99115c69c5d2",
"md5": "0fa18dcdde61527bff10eeb681532a9d",
"sha256": "3effe2f1e10f77f5532a7f7f73f0719e5e5bf7e6c5e8557643f26f6749a82dc1"
},
"downloads": -1,
"filename": "opentelemetry_instrumentation_urllib-0.45b0.tar.gz",
"has_sig": false,
"md5_digest": "0fa18dcdde61527bff10eeb681532a9d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 12287,
"upload_time": "2024-03-28T19:31:35",
"upload_time_iso_8601": "2024-03-28T19:31:35.987382Z",
"url": "https://files.pythonhosted.org/packages/19/c3/6025b7e2763be625ab22d9caf3fe2eb299633cbf3b62b3fd99115c69c5d2/opentelemetry_instrumentation_urllib-0.45b0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-28 19:31:35",
"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-urllib"
}