Skip to content

Commit

Permalink
add check to prevent exception from negative counter
Browse files Browse the repository at this point in the history
Signed-off-by: Travis Johnson <[email protected]>
  • Loading branch information
tjohnson31415 committed Nov 18, 2024
1 parent 781b874 commit 4102ffd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vllm/engine/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,10 @@ def _log_gauge(self, gauge, data: Union[int, float]) -> None:

def _log_counter(self, counter, data: Union[int, float]) -> None:
# Convenience function for logging to counter.
# Prevent ValueError from negative increment
if data < 0:
logger.warning("Skipping negative increment to %s", counter)
return
counter.labels(**self.labels).inc(data)

def _log_counter_labels(self, counter, data: CollectionsCounter,
Expand Down

0 comments on commit 4102ffd

Please sign in to comment.