mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
Include time window in export filename to prevent Vantage overwrites
Vantage deduplicates by filename — uploading the same filename overwrites previous data. Changed _build_filename to include the time window (e.g. usage_20240102T050000Z_20240102T060000Z.csv) so each hourly/daily export has a unique filename. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e878941da5
commit
118d8114f8
1 changed files with 7 additions and 3 deletions
|
|
@ -101,13 +101,17 @@ class FocusExportEngine:
|
|||
await self._destination.deliver(
|
||||
content=payload,
|
||||
time_window=window,
|
||||
filename=self._build_filename(),
|
||||
filename=self._build_filename(window),
|
||||
)
|
||||
|
||||
def _build_filename(self) -> str:
|
||||
def _build_filename(self, window: FocusTimeWindow) -> str:
|
||||
if not self._serializer.extension:
|
||||
raise ValueError("Serializer must declare a file extension")
|
||||
return f"usage.{self._serializer.extension}"
|
||||
# Include time window in filename so Vantage (which deduplicates
|
||||
# by filename) doesn't overwrite previous uploads.
|
||||
start_str = window.start_time.strftime("%Y%m%dT%H%M%SZ")
|
||||
end_str = window.end_time.strftime("%Y%m%dT%H%M%SZ")
|
||||
return f"usage_{start_str}_{end_str}.{self._serializer.extension}"
|
||||
|
||||
@staticmethod
|
||||
def _sum_column(frame: pl.DataFrame, column: str) -> float:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue