Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions sentry_sdk/tracing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading