Add httpx support#47953
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds httpx to the set of libraries automatically instrumented by the Azure Monitor OpenTelemetry Distro. It wires httpx into the distro's supported-instrumentation list, adds the opentelemetry-instrumentation-httpx dependency, provides a sample and a smoke test, and registers httpx in the exporter's statsbeat tracking lists. This extends existing HTTP client instrumentation (requests, urllib, urllib3) to also cover httpx.
Changes:
- Add
httpxto the distro's_FULLY_SUPPORTED_INSTRUMENTED_LIBRARIESand theopentelemetry-instrumentation-httpxpackage dependency, plus docs/sample/test coverage. - Register httpx in the exporter's statsbeat instrumentation lists (introduces a duplicate entry — see review comment).
- Update configuration tests to expect httpx enabled by default.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
azure-monitor-opentelemetry/azure/monitor/opentelemetry/_constants.py |
Adds httpx to fully-supported instrumentations (alphabetically placed — correct). |
azure-monitor-opentelemetry/setup.py |
Adds opentelemetry-instrumentation-httpx dependency. |
azure-monitor-opentelemetry/dev_requirements.txt |
Adds httpx dev dependency for tests/samples. |
azure-monitor-opentelemetry/README.md |
Documents the httpx instrumentation and links. |
azure-monitor-opentelemetry/samples/README.md |
Lists the new httpx sample. |
azure-monitor-opentelemetry/samples/tracing/http_httpx.py |
New sample instrumenting httpx. |
azure-monitor-opentelemetry/samples/tracing/instrumentation_options.py |
Adds httpx to the instrumentation options sample. |
azure-monitor-opentelemetry/tests/instrumentation/test_httpx.py |
New smoke test for HTTPXClientInstrumentor. |
azure-monitor-opentelemetry/tests/utils/test_configurations.py |
Updates expected config to include httpx enabled. |
azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_constants.py |
Adds httpx to statsbeat lists; introduces a duplicate httpx in _INSTRUMENTATIONS_LIST. |
Additional note (not attachable to a changed line): neither azure-monitor-opentelemetry/CHANGELOG.md nor azure-monitor-opentelemetry-exporter/CHANGELOG.md has an entry under the Unreleased ### Features Added section for this new httpx support, and the PR checklist flags CHANGELOG as not updated. Consider adding a changelog entry before release.
b0b7f29 to
5819f08
Compare
JacksonWeber
left a comment
There was a problem hiding this comment.
LGTM apart from the copilot comment.
@JacksonWeber I have addressed the copilot feedback and removed the duplicate declaration. |
ffdf52f to
9e5e4ad
Compare
9e5e4ad to
6996d89
Compare
Description
Add support for httpx instrumentation. Fixes - #46286
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines