Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(instrumentation-anthropic): Support for OpenTelemetry metrics for Anthropic #764

Merged
merged 19 commits into from
Apr 9, 2024

Conversation

hanchchch
Copy link
Contributor

@hanchchch hanchchch commented Apr 8, 2024

relates to #251

Hi,

I referred a lot to #369 while working on this.

I added

  • token_counter
  • choice_counter
  • duration_histogram
  • exception_counter

metrics for all

  • sync / async
  • completion / messages / streaming messages

methods.

There are a few TODOs, I'd appreciate it if you check it out.

  • One is about adding choice_counter of streaming response, I just added length of events bc each of it has finish_reason, but I'm still not sure if it's appropriate. (opentelemetry/instrumentation/anthropic/streaming.py).
  • The others are about testing exception_metric of streaming responses. I think I should add mocks and trigger exception in the middle of yielding, but I'm just wondering if there's better way. (tests/test_completion.py)

Any comments and discussions will be appreciated!


  • I have added tests that cover my changes.
  • If adding a new instrumentation or changing an existing one, I've added screenshots from some observability platform showing the change.
  • PR name follows conventional commits format: feat(instrumentation): ... or fix(instrumentation): ....
  • (If applicable) I have updated the documentation accordingly.

Copy link
Member

@nirga nirga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hanchchch! Great work! Looks good.
Note that you need to rebase your PR. Once you do that I can merge :)

@hanchchch hanchchch requested a review from nirga April 9, 2024 03:00
@nirga nirga merged commit eed9a48 into traceloop:main Apr 9, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants