fix: cast usage run filter JSON values to Float instead of Integer (#574)

The duration and tokenUsage numberRange filters cast the JSON text value
to INTEGER, but some rows store call_duration_seconds as a JSON float
(0.0, written by get_call_duration when the pipeline never recorded a
start time). Postgres cannot cast the text '0.0' to integer, so any
duration filter on /organizations/usage/runs failed with
InvalidTextRepresentationError. Cast to FLOAT instead, matching the
duration sort clause, and make get_call_duration return an int so new
rows are written as integers.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Abhishek 2026-07-23 16:58:41 +05:30 committed by GitHub
parent eae30b3b21
commit cd20607628
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 11 deletions

View file

@ -113,10 +113,10 @@ class PipelineMetricsAggregator(FrameProcessor):
"""Get the aggregated STT usage metrics grouped by processor|||model."""
return self._stt_usage_metrics
def get_call_duration(self) -> float:
def get_call_duration(self) -> int:
"""Get call duration"""
if self._start_time is None:
return 0.0
return 0
if self._stop_time is None:
call_duration = time.time() - self._start_time