Skip to content

fix: Instrument httpx2 requests in the otel extra - #2213

Open
vdusek wants to merge 4 commits into
masterfrom
fix/httpx2-otel-instrumentation-floor
Open

vdusek wants to merge 4 commits into
masterfrom
fix/httpx2-otel-instrumentation-floor

Conversation

@vdusek

@vdusek vdusek commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

HttpxHttpClient runs on httpx2, and opentelemetry-instrumentation-httpx only gained HTTPX2ClientInstrumentor in 0.65b0, so requests through it produced no spans. Every OpenTelemetry floor in the otel extra now sits on that release line.

package before after
opentelemetry-api >=1.34.1 >=1.44.0
opentelemetry-distro[otlp] >=0.54 >=0.65b0
opentelemetry-instrumentation >=0.54 >=0.65b0
opentelemetry-instrumentation-httpx >=0.54 >=0.65b0
opentelemetry-sdk >=1.34.1 >=1.44.0
opentelemetry-semantic-conventions >=0.54 >=0.65b0

Verified against the wheels: 0.64b0 registers a single httpx entry point, while 0.65b0 adds the class and an httpx2 entry point. With an in-memory exporter, HTTPX2ClientInstrumentor emits a span for an HttpxHttpClient request; HTTPXClientInstrumentor emits none.

The whole group moves together because these packages release in lockstep and pin each other with ==. opentelemetry-instrumentation-httpx==0.65b0 requires opentelemetry-instrumentation==0.65b0 and opentelemetry-semantic-conventions==0.65b0, and the latter requires opentelemetry-api==1.44.0; opentelemetry-sdk pins api to its own version, so it lands on 1.44.0 as well. uv pip compile --resolution lowest-direct against the old specifiers resolves to exactly the "after" column, so the previous floors only looked permissive.

Every release of the 0.x packages is a beta, so the floors name the prerelease explicitly. >=0.65 matches no published version at all, since PEP 440 orders 0.65b0 < 0.65. uv.lock had already resolved 0.65b0 and 1.44.0, so only its requires-dist specifiers moved.

The web form example corrections that used to ride along here moved to #2237.

✍️ Drafted by Claude Code

@vdusek vdusek added t-tooling Issues with this label are in the ownership of the tooling team. adhoc Ad-hoc unplanned task added during the sprint. labels Sep 7, 2026
@vdusek vdusek self-assigned this Sep 7, 2026
@github-actions github-actions Bot added this to the 149th sprint - Tooling team milestone Sep 7, 2026
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.74%. Comparing base (dd5c5e6) to head (dd50835).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2213   +/-   ##
=======================================
  Coverage   93.74%   93.74%           
=======================================
  Files         181      181           
  Lines       12865    12877   +12     
=======================================
+ Hits        12060    12072   +12     
  Misses        805      805           
Flag Coverage Δ
unit 93.74% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek vdusek changed the title fix: Require opentelemetry-instrumentation-httpx 0.65b0 for httpx2 instrumentation fix: Require opentelemetry-instrumentation-httpx 0.65b0 and correct the web form example Sep 7, 2026
@vdusek
vdusek marked this pull request as ready for review September 16, 2026 08:45
@vdusek vdusek changed the title fix: Require opentelemetry-instrumentation-httpx 0.65b0 and correct the web form example fix: OpenTelemetry httpx2 instrumentation and the web form example Sep 16, 2026
@vdusek
vdusek force-pushed the fix/httpx2-otel-instrumentation-floor branch from 8dcdd20 to 18a51db Compare September 16, 2026 09:04
@vdusek vdusek changed the title fix: OpenTelemetry httpx2 instrumentation and the web form example fix: Instrument httpx2 requests in the otel extra Sep 16, 2026
@vdusek
vdusek requested a review from Pijukatel September 16, 2026 09:07
@Mantisus

Copy link
Copy Markdown
Collaborator

If I'm not mistaken, opentelemetry-instrumentation-httpx was added as a dependency when HttpxHttpClient was the default client. Maybe we can remove that?

Comment thread pyproject.toml Outdated
"opentelemetry-distro[otlp]>=0.54",
"opentelemetry-instrumentation>=0.54",
"opentelemetry-instrumentation-httpx>=0.54",
"opentelemetry-distro[otlp]>=0.54b0",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should bump all the instrumentation-related 0.54b0 to 0.65b0.

For unrelated Python packages, this would not be needed, but those instrumentation packages are always bumped all together.

So, for example, this gives the illusion of flexibility

opentelemetry-semantic-conventions>=0.54b0
opentelemetry-instrumentation-httpx>=0.65b0

, but in reality it resolves as

opentelemetry-semantic-conventions>=0.65b0
opentelemetry-instrumentation-httpx>=0.65b0

@vdusek

vdusek commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator Author

If I'm not mistaken, opentelemetry-instrumentation-httpx was added as a dependency when HttpxHttpClient was the default client. Maybe we can remove that?

cc @Pijukatel

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

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants