-
Notifications
You must be signed in to change notification settings - Fork 798
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe your environment
OS: Debian bookworm, docker
Python version: 3.11
Package version: 0.49
What happened?
In PR #2909 HTTPXClientInstrumentor.instrument_client
was changed from a staticmethod
to an instance method. This breaks existing usage, as described in the docs:
import httpx
from opentelemetry.instrumentation.httpx import HTTPXClientInstrumentor
url = "https://some.url/get"
with httpx.Client(transport=telemetry_transport) as client:
HTTPXClientInstrumentor.instrument_client(client)
response = client.get(url)
Since this change, the code must use
with httpx.Client(transport=telemetry_transport) as client:
HTTPXClientInstrumentor().instrument_client(client)
Steps to Reproduce
import httpx
from opentelemetry.instrumentation.httpx import HTTPXClientInstrumentor
url = "http://example.com/get"
with httpx.Client() as client:
HTTPXClientInstrumentor.instrument_client(client)
response = client.get(url)
Expected Result
Expected that the client is instrumented with no errors.
Actual Result
TypeError: HTTPXClientInstrumentor.instrument_client() missing 1 required positional argument: 'client'
Additional context
This was called out as a breaking change in the changelog, but without a description of what to change.
I'll also note that uninstrument_client
is still a staticmethod, so there might be some confusion now that these are not symmetric.
Would you like to implement a fix?
None
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working