Repository navigation
fix(server-utils): Use the client's provider name for Anthropic platform clients - #26119
Draft
sentry-junior[bot] wants to merge 1 commit into
Draft
sentry-junior[bot] wants to merge 1 commit into
sentry-junior[bot] wants to merge 1 commit into
Conversation
…orm clients `AnthropicBedrock` and the SDK's other platform clients reuse the `@anthropic-ai/sdk` `Messages` resource, so their calls already get gen_ai spans, but the spans said `gen_ai.provider.name: anthropic`. The SDK stores the platform name on the client as `_genAIProviderName` (`aws.bedrock` for Bedrock), so read it from the resource's client. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
Contributor
size-limit report 📦Compared: 379cd82 (PR test merge using develop at 88a5e3b) Against: 88a5e3b (develop) · base run #65049 ✅ Baseline matches: this diff contains only this PR's changes.
|
Contributor
Optional E2E testsSome optional checks were not successful. They do not block the merge. 4 not successful, 50 successful. See the run.
Successful checks
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why:
AnthropicBedrock(@anthropic-ai/bedrock-sdk) extendsBaseAnthropicand builds itsmessagesfrom@anthropic-ai/sdk's ownMessagesclass. Our orchestrion hooks on that file already trace it, with prompts, responses, and usage, and with no duplicate native OTel span. I checked this against the real@anthropic-ai/bedrock-sdk@1.1.1. The one gap was that the spans saidgen_ai.provider.name: anthropic. The SDK stores the platform on the client as_genAIProviderName(aws.bedrockon Bedrock). This reads that value from the resource's client and falls back toanthropic.How to review: The change is in
getProviderNameand its two call sites. The integration scenario subclassesAnthropicand sets_genAIProviderNamethe same wayAnthropicBedrockdoes, so no new dev dependency is needed.Unsure about:
_genAIProviderNameis marked@internalin the SDK. bedrock-sdk sets it from 0.35.0 on; 0.34.4 and earlier keep reportinganthropic. Only the Bedrock clients (AnthropicBedrock,AnthropicBedrockMantle→aws.bedrock) and Vertex (gcp.vertex_ai) set it.AnthropicFoundryandAnthropicAwsdon't, so they still reportanthropic.Closes #19154
via @sergical.
--
View Session [Sentry]