mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-08 22:21:35 +00:00
Fix dry-run summary alignment, token logging, and upload error handling
- Align dry-run summary to use pre-transform columns (spend, total_tokens, team_id, model) matching FocusExportEngine internals - Reduce token exposure in debug logs to first 4 chars - Wrap raise_for_status in try/except to log httpx errors before re-raising Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d35abfb55f
commit
9200b28078
3 changed files with 16 additions and 7 deletions
|
|
@ -88,7 +88,15 @@ class FocusVantageDestination(FocusDestination):
|
|||
headers=headers,
|
||||
files={"file": (filename, csv_bytes, "text/csv")},
|
||||
)
|
||||
response.raise_for_status()
|
||||
try:
|
||||
response.raise_for_status()
|
||||
except httpx.HTTPStatusError as e:
|
||||
verbose_logger.error(
|
||||
"Vantage destination: upload failed for %s — %s",
|
||||
filename,
|
||||
e,
|
||||
)
|
||||
raise
|
||||
|
||||
verbose_logger.debug(
|
||||
"Vantage destination: uploaded %d bytes (%s)",
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class VantageLogger(FocusLogger):
|
|||
|
||||
verbose_logger.debug(
|
||||
"VantageLogger initialized (integration_token=%s)",
|
||||
resolved_token[:8] + "..." if resolved_token else "None",
|
||||
resolved_token[:4] + "***" if resolved_token and len(resolved_token) > 4 else "***",
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
|
|
@ -392,13 +392,14 @@ async def vantage_dry_run_export(
|
|||
usage_sample = data.head(min(50, len(data))).to_dicts() if not data.is_empty() else []
|
||||
normalized_sample = normalized.head(min(50, len(normalized))).to_dicts() if not normalized.is_empty() else []
|
||||
|
||||
# Compute summary from the FOCUS-normalized DataFrame.
|
||||
# These use post-transform column names specific to this endpoint.
|
||||
# Use the same pre-transform column names as
|
||||
# FocusExportEngine.dry_run_export_usage_data for consistency.
|
||||
summary = {
|
||||
"total_records": len(normalized),
|
||||
"total_spend": FocusExportEngine._sum_column(normalized, "BilledCost"),
|
||||
"unique_teams": FocusExportEngine._count_unique(normalized, "SubAccountId"),
|
||||
"unique_models": FocusExportEngine._count_unique(normalized, "ResourceType"),
|
||||
"total_spend": FocusExportEngine._sum_column(data, "spend"),
|
||||
"total_tokens": FocusExportEngine._sum_column(data, "total_tokens"),
|
||||
"unique_teams": FocusExportEngine._count_unique(data, "team_id"),
|
||||
"unique_models": FocusExportEngine._count_unique(data, "model"),
|
||||
}
|
||||
|
||||
dry_run_result = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue