---
id: opentelemetry-instrumentation-httpx
version: "0.65b0"
license: Apache-2.0
license_treatment: permissive
maintenance: active
---
# opentelemetry-instrumentation-httpx — OpenTelemetry HTTPX Instrumentation
License: permissive · Maintenance: active · Popularity: top 1,000 on PyPI
## Install
pip install opentelemetry-instrumentation-httpx
uv add opentelemetry-instrumentation-httpx
poetry add opentelemetry-instrumentation-httpx
## Description
OpenTelemetry HTTPX Instrumentation
===================================
|pypi|
.. |pypi| image:: https://badge.fury.io/py/opentelemetry-instrumentation-httpx.svg
:target: https://pypi.org/project/opentelemetry-instrumentation-httpx/
This library allows tracing HTTP requests made by the
`httpx `_ and
`httpx2 `_ libraries.
If both libraries are installed, use ``HTTPXClientInstrumentor`` for
``httpx`` clients and ``HTTPX2ClientInstrumentor`` for ``httpx2`` clients.
The instrumentors can be enabled independently.
Installation
------------
::
pip install opentelemetry-instrumentation-httpx
Usage
-----
Instrumenting all clients
*************************
When using the instrumentor, all clients will automatically trace requests.
.. code-block:: python
import httpx
import asyncio
from opentelemetry.instrumentation.httpx import HTTPXClientInstrumentor
url = "https://example.com"
HTTPXClientInstrumentor().instrument()
with httpx.Client() as client:
response = client.get(url)
async def get(url):
async with httpx.AsyncClient() as client:
response =...
## AI interpretation — verify before relying
Automatically traces HTTP requests made by httpx and httpx2 clients, integrating them into OpenTelemetry observability pipelines for distributed tracing.
Verdict: A well-maintained, actively developed instrumentation library for adding distributed tracing to HTTP clients. No known vulnerabilities, permissive licensing, and low install friction make it a straightforward choice for teams adopting OpenTelemetry observability.
[View on SkillFed](https://skillfed.io/packages/opentelemetry-instrumentation-httpx) · [View on PyPI](https://pypi.org/project/opentelemetry-instrumentation-httpx/)