🐛 Bug Report: OpenAI instrumentation drops gen_ai.input.messages on image requests when no uploader is configured
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- python
- Domain
- backend-api-design, observability
Research direction
Start with openai/__init__.py:20-22 and shared/chat_wrappers.py:441,448; trace how the default uploader is checked and awaited, then inspect the existing tests for base64 image chat messages. Confirm that requests without an uploader still set gen_ai.input.messages with the image inline, and check the other instrumentor defaults mentioned in the issue. An open pull request already addresses this issue.
Written by the indexing model from the issue text.
Description
Which component is this bug for?
OpenAI Instrumentation
📜 Description
The default upload_base64_image in OpenAIInstrumentor.__init__ is a sync lambda, lambda *args: "" (openai/__init__.py:20-22), but it is awaited in shared/chat_wrappers.py:441:
url = await Config.upload_base64_image(str(trace_id), str(span_id), image_name, base64_string)
Because the default is truthy, _set_prompts always goes into the image path (chat_wrappers.py:448). That raises TypeError: object str can't be used in 'await' expression, @dont_throw swallows it, and _set_input_messages never runs. So gen_ai.input.messages is missing on every chat request that contains a base64 image.
This hits anyone using the instrumentation without Traceloop.init() (zero-code opentelemetry-instrument, or OpenAIInstrumentor().instrument() directly), since only the SDK passes an async uploader.
👟 Reproduction steps
OpenAIInstrumentor().instrument()on a plainTracerProvider(no traceloop-sdk)- Call
client.chat.completions.create(...)with a message that has animage_urlpart with adata:image/png;base64,...URL
👍 Expected behavior
gen_ai.input.messages is set, with the image kept inline (or as a URI if an uploader is configured).
👎 Actual Behavior with Screenshots
The span has gen_ai.output.messages but no gen_ai.input.messages.
🤖 Python Version
3.12
📃 Provide any additional context for the Bug.
Workaround: OpenAIInstrumentor(upload_base64_image=None).instrument(). With None the image is kept inline as a blob part. Suggested fix: default to None, or make the default an async def. Also worth checking the anthropic, google-generativeai and vertexai defaults (None): anthropic then writes the raw base64 into span attributes (anthropic/span_utils.py:39-45), which can be very large.
- Dominant language
- Python
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from traceloop/openllmetry
-
bug python
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
traceloop/openllmetry#4717 ·
Maintainers usually reply within 1 day
-
🐛 Bug Report: Incomplete cache token migration after #4243 breaks Bedrock and Groq instrumentationPossibly taken @Quantum-Enigma-dot claimed this 21 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
traceloop/openllmetry#4665 · 1 comment ·
Maintainers usually reply within 1 day
-
🐛 Bug Report: OpenAI instrumentation drops gen_ai.usage.reasoning_tokens on streamed chat completionsPossibly taken @jayfeng7 claimed this 23 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
traceloop/openllmetry#4660 · 1 comment ·
Maintainers usually reply within 1 day
-
Bug Report: Failed dataset deletes still remove local rows and columnsPossibly taken @inchang-ing claimed this 32 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
traceloop/openllmetry#4630 ·
Maintainers usually reply within 1 day
-
🐛 Bug Report: LiteLLM instrumentation does not record seed, stop, frequency_penalty, presence_penaltyPossibly taken @shantam77 claimed this 38 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
traceloop/openllmetry#4598 · 2 comments ·
Maintainers usually reply within 1 day
All issues in traceloop/openllmetry
Similar issues
-
opensubtitlescom: provider rejects pt-PT even though its own converter maps itPossibly taken @paulo-0308 claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Diaoul/subliminal#1405 ·
-
Internal ErrorOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
frappe/frappe_docker#2071 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
The-Pocket/PocketFlow#161 ·
-
comp/desktop P2 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NousResearch/hermes-agent#157702 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
zai-org/zcode-plugins#202 ·
Maintainers usually reply within 1 day