File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
tests/integrations/anthropic Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -2261,6 +2261,10 @@ def test_cache_tokens_nonstreaming(sentry_init, capture_events):
22612261 )
22622262
22632263 (span ,) = events [0 ]["spans" ]
2264+ # input_tokens normalized: 100 + 80 (cache_read) + 20 (cache_write) = 200
2265+ assert span ["data" ][SPANDATA .GEN_AI_USAGE_INPUT_TOKENS ] == 200
2266+ assert span ["data" ][SPANDATA .GEN_AI_USAGE_OUTPUT_TOKENS ] == 50
2267+ assert span ["data" ][SPANDATA .GEN_AI_USAGE_TOTAL_TOKENS ] == 250
22642268 assert span ["data" ][SPANDATA .GEN_AI_USAGE_INPUT_TOKENS_CACHED ] == 80
22652269 assert span ["data" ][SPANDATA .GEN_AI_USAGE_INPUT_TOKENS_CACHE_WRITE ] == 20
22662270
@@ -2495,5 +2499,9 @@ def test_cache_tokens_streaming(sentry_init, capture_events):
24952499 pass
24962500
24972501 (span ,) = events [0 ]["spans" ]
2502+ # input_tokens normalized: 100 + 80 (cache_read) + 20 (cache_write) = 200
2503+ assert span ["data" ][SPANDATA .GEN_AI_USAGE_INPUT_TOKENS ] == 200
2504+ assert span ["data" ][SPANDATA .GEN_AI_USAGE_OUTPUT_TOKENS ] == 10
2505+ assert span ["data" ][SPANDATA .GEN_AI_USAGE_TOTAL_TOKENS ] == 210
24982506 assert span ["data" ][SPANDATA .GEN_AI_USAGE_INPUT_TOKENS_CACHED ] == 80
24992507 assert span ["data" ][SPANDATA .GEN_AI_USAGE_INPUT_TOKENS_CACHE_WRITE ] == 20
You can’t perform that action at this time.
0 commit comments