Repository navigation
feat(bedrock): Add extension skeleton #8226
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
base: master
Are you sure you want to change the base?
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 |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| from typing import TYPE_CHECKING | ||
|
|
||
| from sentry_sdk.consts import OP, SPANDATA | ||
| from sentry_sdk.integrations.boto3._services.base import _ServiceExtension | ||
|
|
||
| if TYPE_CHECKING: | ||
| from typing import Any, Optional | ||
|
|
||
| from sentry_sdk._types import Attributes | ||
| from sentry_sdk.integrations.boto3._context import AwsCallContext | ||
|
|
||
|
|
||
| class _BedrockExtension(_ServiceExtension): | ||
| __slots__ = () | ||
| skip_if_no_active_span = False | ||
|
|
||
| def get_span_op(self, ctx: "AwsCallContext") -> "Optional[str]": | ||
| if ctx.operation_name == "Converse" and ctx.operation_name == "ConverseStream": | ||
| return None | ||
| return OP.GEN_AI_CHAT | ||
|
Check failure on line 20 in sentry_sdk/integrations/boto3/_services/bedrock.py
|
||
|
alexander-alderman-webb marked this conversation as resolved.
Resolved
|
||
|
|
||
| def get_span_origin(self, ctx: "AwsCallContext") -> "Optional[str]": | ||
| if ctx.operation_name != "Converse" and ctx.operation_name != "ConverseStream": | ||
| return None | ||
| return "auto.ai.boto3" | ||
|
|
||
| def get_request_attributes(self, ctx: "AwsCallContext") -> "Attributes": | ||
| if ctx.operation_name != "Converse" and ctx.operation_name != "ConverseStream": | ||
| return {} | ||
|
|
||
| return { | ||
| SPANDATA.GEN_AI_PROVIDER_NAME: "aws.bedrock", | ||
| SPANDATA.GEN_AI_OPERATION_NAME: "chat", | ||
| SPANDATA.GEN_AI_RESPONSE_STREAMING: ctx.operation_name == "ConverseStream", | ||
| } | ||
|
|
||
| def get_response_attributes( | ||
| self, | ||
| ctx: "AwsCallContext", | ||
| response: "Any", | ||
| ) -> "Attributes": | ||
| return {} | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.