I instrumented httpx after some httpx clients being initialized, and then isinstance(client, Client) failed.
I admit that instrumenting code should ideally be placed before any other code, but I hope that even if it is not done this way, it will result in no errors if possible.
Describe your environment
OS: Windows-10-10.0.22631-SP0 Python version: Python 3.12.3 Package version: opentelemetry-instrumentation-httpx="0.46b0"
What happened?
I instrumented httpx after some httpx clients being initialized, and then
isinstance(client, Client)
failed.I admit that instrumenting code should ideally be placed before any other code, but I hope that even if it is not done this way, it will result in no errors if possible.
Related to https://github.com/pydantic/logfire/issues/264
Steps to Reproduce
Expected Result
True
Actual Result
False
Additional context
Maybe we can use an non-subclassing approach, like patching methods on the original class.
Would you like to implement a fix?
Being open to