traceloop / traceloop/openllmetry

๐Ÿ› 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.

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
  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

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.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.