🐛 Bug Report: Anthropic instrumentation fails to instrument beta async streams

Open Beginner friendly
#4,388 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
observability

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.

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
  1. Use client.messages.stream to create an Anthropic API request
  2. 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

Dominant language
Python
Stars
7.4k
Forks
1.1k
Avg merge
8d 14h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from traceloop/openllmetry

All issues in traceloop/openllmetry

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.