Describe your environment
OS: Rocky Linux 9.8
Python version: Python 3.14.7
Package version: opentelemetry-instrumentation-genai-openai 1.2b0.dev (main)
GenAI library (e.g. anthropic, openai) and version: openai 3.1.0
What happened?
AsyncAPIResponse.parse() is a coroutine, and it is the only response class
where that is true. RawResponseStreamProxy.parse() checks
isinstance(parsed, (Stream, AsyncStream)), so it rejects the coroutine, takes
its "not a stream we can drive" branch, and hands it back unwrapped. The caller
awaits an uninstrumented stream and no response telemetry is recorded.
Only the async client's with_streaming_response is affected; the sync client
and both with_raw_response paths return a stream synchronously and work.
This is the path the OpenAI Agents SDK takes for streamed runs
(agents/models/openai_responses.py resolves
responses.with_streaming_response.create, then awaits parse()), so every
Runner.run_streamed produces an empty chat span.
Steps to Reproduce
import asyncio
from openai import AsyncOpenAI
from opentelemetry.instrumentation.genai.openai import OpenAIInstrumentor
OpenAIInstrumentor().instrument()
async def main():
client = AsyncOpenAI()
async with client.responses.with_streaming_response.create(
model="gpt-4o-mini", input="Say this is a test.", stream=True
) as raw_response:
async for _event in await raw_response.parse():
pass
asyncio.run(main())
Then inspect the finished span. chat.completions.with_streaming_response
behaves the same.
Expected Result
The chat span carries the same response attributes as
responses.create(..., stream=True): gen_ai.output.messages,
gen_ai.usage.*, gen_ai.response.finish_reasons, gen_ai.response.id,
gen_ai.response.model.
Actual Result
None of them are set. The span carries request-side attributes only and ends
with status UNSET.
Additional context
No response
Would you like to implement a fix?
Yes
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Describe your environment
OS: Rocky Linux 9.8
Python version: Python 3.14.7
Package version: opentelemetry-instrumentation-genai-openai 1.2b0.dev (main)
GenAI library (e.g. anthropic, openai) and version: openai 3.1.0
What happened?
AsyncAPIResponse.parse()is a coroutine, and it is the only response classwhere that is true.
RawResponseStreamProxy.parse()checksisinstance(parsed, (Stream, AsyncStream)), so it rejects the coroutine, takesits "not a stream we can drive" branch, and hands it back unwrapped. The caller
awaits an uninstrumented stream and no response telemetry is recorded.
Only the async client's
with_streaming_responseis affected; the sync clientand both
with_raw_responsepaths return a stream synchronously and work.This is the path the OpenAI Agents SDK takes for streamed runs
(
agents/models/openai_responses.pyresolvesresponses.with_streaming_response.create, then awaitsparse()), so everyRunner.run_streamedproduces an emptychatspan.Steps to Reproduce
Then inspect the finished span.
chat.completions.with_streaming_responsebehaves the same.
Expected Result
The
chatspan carries the same response attributes asresponses.create(..., stream=True):gen_ai.output.messages,gen_ai.usage.*,gen_ai.response.finish_reasons,gen_ai.response.id,gen_ai.response.model.Actual Result
None of them are set. The span carries request-side attributes only and ends
with status
UNSET.Additional context
No response
Would you like to implement a fix?
Yes
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it. Learn more here.