From 8aeb2a23c4a93f1250dab34eb9553a1389f8340e Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Thu, 29 Oct 2026 11:57:46 +0000 Subject: [PATCH] ref(tracing): Remove unused _get_usage_attributes Co-Authored-By: Ivana Kellyer --- sentry_sdk/tracing_utils.py | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/sentry_sdk/tracing_utils.py b/sentry_sdk/tracing_utils.py index e9f1667536..0945985da6 100644 --- a/sentry_sdk/tracing_utils.py +++ b/sentry_sdk/tracing_utils.py @@ -1042,34 +1042,6 @@ def _get_value(source: "Any", key: str) -> "Optional[Any]": return value -def _get_usage_attributes(usage: "Any") -> "dict[str, Any]": - """ - Get usage attributes. - """ - attributes = {} - - def _set_from_keys(attribute: str, keys: "tuple[str, ...]") -> None: - for key in keys: - value = _get_value(usage, key) - if value is not None and isinstance(value, int): - attributes[attribute] = value - - _set_from_keys( - SPANDATA.GEN_AI_USAGE_INPUT_TOKENS, - ("prompt_tokens", "input_tokens"), - ) - _set_from_keys( - SPANDATA.GEN_AI_USAGE_OUTPUT_TOKENS, - ("completion_tokens", "output_tokens"), - ) - _set_from_keys( - SPANDATA.GEN_AI_USAGE_TOTAL_TOKENS, - ("total_tokens",), - ) - - return attributes - - def _should_continue_trace(baggage: "Optional[Baggage]") -> bool: """ Check if we should continue the incoming trace according to the strict_trace_continuation spec.