This library allows tracing HTTP requests made by the niquests library.
Niquests is a drop-in replacement for the requests library with
native async support, HTTP/2, and HTTP/3 capabilities. Both synchronous
and asynchronous interfaces are instrumented.
Lazy responses (e.g. Session(multiplexed=True)) receive a span and
connection-level attributes (IP, TLS) but status code and response headers
are not captured because they are not yet available.
Note
This is an independent, community-maintained package. It deliberately
mirrors the opentelemetry-python-contrib package layout (import path and
entry point) so that, should an equivalent instrumentation ever be adopted
upstream, switching over is straightforward.
pip install opentelemetry-instrumentation-niquests
To exclude certain URLs from being tracked, set the environment variable OTEL_PYTHON_NIQUESTS_EXCLUDED_URLS
(or OTEL_PYTHON_EXCLUDED_URLS as fallback) with comma delimited regexes representing which URLs to exclude.
For example,
export OTEL_PYTHON_NIQUESTS_EXCLUDED_URLS="client/.*/info,healthcheck"
will exclude requests such as https://site/client/123/info and https://site/xyz/healthcheck.