traceloop / traceloop/openllmetry
๐ Bug Report: Anthropic instrumentation fails to instrument beta async streams
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.4k
- Forks
- 1.1k
- Avg merge
- 8d 14h
- Merged PRs (30d)
- 2
Description
Which component is this bug for?
Anthropic Instrumentation
๐ Description
Here, the instrumentor doesn't wrap a call using client.beta.messages.stream, because is_stream_manager only checks for AsyncMessageStreamManager and not BetaAsyncMessageStreamManager
๐ Reproduction steps
- Use
client.messages.streamto create an Anthropic API request - See it isn't instrumented
๐ Expected behavior
It should be instrumented
๐ Actual Behavior with Screenshots
๐ค Python Version
No response
๐ Provide any additional context for the Bug.
No response
๐ Have you spent some time to check if this bug has been raised before?
- I checked and didn't find similar issue
Are you willing to submit PR?
None
Contributor 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.
Research direction
Start in packages/opentelemetry-instrumentation-anthropic/opentelemetry/instrumentation/anthropic/init.py, especially is_stream_manager at lines 173-187 and the wrapping logic at lines 588-627. Compare the handling of AsyncMessageStreamManager with BetaAsyncMessageStreamManager, then verify that a client.beta.messages.stream call is instrumented as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100