Skip to content

Specifying http_client in openai client options causing TypeError with instrument_httpx #264

@CNSeniorious000

Description

@CNSeniorious000

Description

If I use instrument_httpx(), and then construct an OpenAI client with a custom httpx client, openai will raise an TypeError:

TypeError: Invalid `http_client` argument; Expected an instance of `httpx.AsyncClient` but got <class 'httpx.AsyncClient'>

Python, Logfire & OS Versions, related packages (not required)

logfire="0.42.0"
platform="Windows-10-10.0.22631-SP0"
python="3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]"
[related_packages]
requests="2.32.3"
pydantic="2.7.4"
openai="1.34.0"
protobuf="4.25.3"
rich="13.7.1"
executing="2.0.1"
opentelemetry-api="1.25.0"
opentelemetry-exporter-otlp-proto-common="1.25.0"
opentelemetry-exporter-otlp-proto-http="1.25.0"
opentelemetry-instrumentation="0.46b0"
opentelemetry-instrumentation-asgi="0.46b0"
opentelemetry-instrumentation-fastapi="0.46b0"
opentelemetry-instrumentation-httpx="0.46b0"
opentelemetry-instrumentation-system-metrics="0.46b0"
opentelemetry-proto="1.25.0"
opentelemetry-sdk="1.25.0"
opentelemetry-semantic-conventions="0.46b0"
opentelemetry-util-http="0.46b0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    OTel IssuebugBug related to the Logfire Python SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions