-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(aws-serverless)!: Use GenAI span ops for Bedrock inference #22761
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,9 @@ import { | |
| GEN_AI_SYSTEM, | ||
| GEN_AI_USAGE_INPUT_TOKENS, | ||
| GEN_AI_USAGE_OUTPUT_TOKENS, | ||
| SENTRY_OP, | ||
| } from '@sentry/conventions/attributes'; | ||
| import { GEN_AI_CHAT_SPAN_OP } from '@sentry/conventions/op'; | ||
| import { | ||
| ATTR_GEN_AI_REQUEST_STOP_SEQUENCES, | ||
| GEN_AI_OPERATION_NAME_VALUE_CHAT, | ||
|
|
@@ -41,6 +43,8 @@ interface ConverseStreamOutput { | |
| [key: string]: any; | ||
| } | ||
|
|
||
| const GEN_AI_GENERATE_CONTENT_SPAN_OP = 'generate_content'; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. q: Do we have a task to add this to sentry conventions? |
||
|
|
||
| export class BedrockRuntimeServiceExtension implements ServiceExtension { | ||
| private _diag: DiagLogger = diag; | ||
|
|
||
|
|
@@ -76,6 +80,7 @@ export class BedrockRuntimeServiceExtension implements ServiceExtension { | |
| // oxlint-disable-next-line typescript/no-deprecated | ||
| [GEN_AI_SYSTEM]: GEN_AI_SYSTEM_VALUE_AWS_BEDROCK, | ||
| [GEN_AI_OPERATION_NAME]: GEN_AI_OPERATION_NAME_VALUE_CHAT, | ||
| [SENTRY_OP]: GEN_AI_CHAT_SPAN_OP, | ||
| }; | ||
|
|
||
| const modelId = request.commandInput.modelId; | ||
|
|
@@ -120,6 +125,7 @@ export class BedrockRuntimeServiceExtension implements ServiceExtension { | |
| const spanAttributes: Attributes = { | ||
| // oxlint-disable-next-line typescript/no-deprecated | ||
| [GEN_AI_SYSTEM]: GEN_AI_SYSTEM_VALUE_AWS_BEDROCK, | ||
| [SENTRY_OP]: GEN_AI_GENERATE_CONTENT_SPAN_OP, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GenAI span ops missing prefixHigh Severity Bedrock spans set Additional Locations (2)Reviewed by Cursor Bugbot for commit 36653f4. Configure here. |
||
| // add operation name for InvokeModel API | ||
| }; | ||
|
|
||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m: Hm, we typically prefix these with
gen_ai., I don't know enough about bedrock but maybe we can align here with the other ai instrumentations?