Skip to content

Commit 6942d8e

Browse files
use non-deprecated attribute
1 parent 3981f4c commit 6942d8e

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎sentry_sdk/consts.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,12 @@ class SPANDATA:
646646
Example: [{"role": "assistant", "parts": [{"type": "text", "content": "The weather in Paris is currently rainy with a temperature of 57°F."}], "finish_reason": "stop"}]
647647
"""
648648

649+
GEN_AI_RESPONSE_TIME_TO_FIRST_CHUNK = "gen_ai.response.time_to_first_chunk"
650+
"""
651+
Time in seconds when the first response content chunk arrived in streaming responses.
652+
Example: 0.6853435
653+
"""
654+
649655
GEN_AI_RESPONSE_TIME_TO_FIRST_TOKEN = "gen_ai.response.time_to_first_token"
650656
"""
651657
The time it took to receive the first token from the model.

‎sentry_sdk/integrations/boto3/_services/bedrock.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def sentry_patched_iter(
142142

143143
if start_time is not None and "contentBlockDelta" in event:
144144
set_on_span(
145-
SPANDATA.GEN_AI_RESPONSE_TIME_TO_FIRST_TOKEN,
145+
SPANDATA.GEN_AI_RESPONSE_TIME_TO_FIRST_CHUNK,
146146
time.perf_counter() - start_time,
147147
)
148148
start_time = None

‎tests/integrations/boto3/test_bedrock.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ def test_converse_stream(
995995
assert span["attributes"][SPANDATA.GEN_AI_RESPONSE_FINISH_REASONS] == [
996996
"end_turn"
997997
]
998-
assert span["attributes"][SPANDATA.GEN_AI_RESPONSE_TIME_TO_FIRST_TOKEN] > 0
998+
assert span["attributes"][SPANDATA.GEN_AI_RESPONSE_TIME_TO_FIRST_CHUNK] > 0
999999

10001000
assert span["attributes"][SPANDATA.GEN_AI_USAGE_OUTPUT_TOKENS] == 20
10011001
assert span["attributes"][SPANDATA.GEN_AI_USAGE_TOTAL_TOKENS] == 30
@@ -1036,7 +1036,7 @@ def test_converse_stream(
10361036
assert span["data"][SPANDATA.GEN_AI_REQUEST_TEMPERATURE] == 0.7
10371037
assert span["data"][SPANDATA.GEN_AI_REQUEST_TOP_P] == 0.9
10381038
assert span["data"][SPANDATA.GEN_AI_RESPONSE_FINISH_REASONS] == ["end_turn"]
1039-
assert span["data"][SPANDATA.GEN_AI_RESPONSE_TIME_TO_FIRST_TOKEN] > 0
1039+
assert span["data"][SPANDATA.GEN_AI_RESPONSE_TIME_TO_FIRST_CHUNK] > 0
10401040

10411041
assert span["data"][SPANDATA.GEN_AI_USAGE_OUTPUT_TOKENS] == 20
10421042
assert span["data"][SPANDATA.GEN_AI_USAGE_TOTAL_TOKENS] == 30

0 commit comments

Comments
 (0)