Skip to content

feat: add httpx2 instrumentation - #2706

Open
HosseinNejatiJavaremi wants to merge 2 commits into
elastic:mainfrom
HosseinNejatiJavaremi:feat/support-httpx2-instrumentation
Open

feat: add httpx2 instrumentation#2706
HosseinNejatiJavaremi wants to merge 2 commits into
elastic:mainfrom
HosseinNejatiJavaremi:feat/support-httpx2-instrumentation

Conversation

@HosseinNejatiJavaremi

Copy link
Copy Markdown
Contributor

Summary

  • Add httpx2 instrumentation mirroring existing httpx support
  • Instrument httpx2.Client.send and httpx2.AsyncClient.send for external HTTP spans
  • Instrument httpcore2 for distributed tracing header propagation
  • Gate registration to Python 3.10+ (httpx2 requirement)
  • Add tests, CI matrix entry, and supported-technologies docs

Closes #2696

Test plan

  • pytest -m httpx2 tests/instrumentation/httpx2_tests.py tests/instrumentation/asyncio_tests/httpx2_tests.py (18 passed)

Made with Cursor

Closes elastic#2696

Mirror httpx/httpcore instrumentation for httpx2/httpcore2 with
sync/async Client.send spans, distributed tracing header injection,
tests, docs, and CI (Python 3.10+).
@HosseinNejatiJavaremi
HosseinNejatiJavaremi requested a review from a team as a code owner July 14, 2026 13:22
@cla-checker-service

cla-checker-service Bot commented Jul 14, 2026

Copy link
Copy Markdown

❌ Author of the following commits did not sign a Contributor Agreement:
4767cc0, 2a4c68b

Please, read and sign the above mentioned agreement if you want to contribute to this project

@github-actions

Copy link
Copy Markdown

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@github-actions github-actions Bot added community Issues opened by the community triage Issues awaiting triage labels Jul 14, 2026
@HosseinNejatiJavaremi

Copy link
Copy Markdown
Contributor Author

CLA check is still failing on my side even after re-signing the Contributor Agreement with GitHub user HosseinNejatiJavaremi and email hosseinnejati14@gmail.com (same email as my merged PR #2682). Happy to re-sign or provide any extra info if needed.

Thanks for the review.

@xrmx

xrmx commented Jul 14, 2026

Copy link
Copy Markdown
Member

@HosseinNejatiJavaremi as I said already please wait for feedback on the issue before opening PRs.

@HosseinNejatiJavaremi

Copy link
Copy Markdown
Contributor Author

@xrmx Thanks for the feedback. I waited ~3 weeks on #2696 before opening the PR — httpx2 adoption is picking up and I wanted to help move it forward.

Happy to close the PR and follow your process on the issue.

If the supported path is now OpenTelemetry / EDOT for Python, I’d prefer to migrate there rather than invest more in this repo. If apm-agent-python is still the right place for httpx2, I’m happy to contribute — just need clarity on direction.

Thanks.

@xrmx

xrmx commented Aug 10, 2026

Copy link
Copy Markdown
Member

@xrmx Thanks for the feedback. I waited ~3 weeks on #2696 before opening the PR — httpx2 adoption is picking up and I wanted to help move it forward.

Happy to close the PR and follow your process on the issue.

If the supported path is now OpenTelemetry / EDOT for Python, I’d prefer to migrate there rather than invest more in this repo. If apm-agent-python is still the right place for httpx2, I’m happy to contribute — just need clarity on direction.

Yeah, OpenTelemetry is the way forward and latest upstream release already supports httpx2 instrumentation. Next EDOT release rebased on top of that will also supports that. My suggestion is that if you can migrate please do since more work on newer instrumentations will go into OpenTelemetry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-python community Issues opened by the community triage Issues awaiting triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support httpx2 instrumentation

2 participants