A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 16, 09:30 UTC
[MISC] Set label value to timestamp over 0, to keep track of recent history (#9777)
Signed-off-by: Kunjan Patel <kunjanp@google.com>
Kunjan committed
Oct 29, 2024 at 12:52 UTC
0ad216f5750742115c686723bf38698372d483fd
1 file changed
+6
-1
vllm/engine/metrics.py
+6
-1
@@ -1,3 +1,4 @@
1
+import time
2
from typing import TYPE_CHECKING
3
from typing import Counter as CollectionsCounter
4
from typing import Dict, List, Optional, Type, Union, cast
@@ -253,6 +254,10 @@ class _RayGaugeWrapper:
254
def set(self, value: Union[int, float]):
255
return self._gauge.set(value)
256
257
+ def set_to_current_time(self):
258
+ # ray metrics doesn't have set_to_current time, https://docs.ray.io/en/latest/_modules/ray/util/metrics.html
259
+ return self._gauge.set(time.time())
260
+
261
262
class _RayCounterWrapper:
263
"""Wraps around ray.util.metrics.Counter to provide same API as
@@ -479,7 +484,7 @@ class PrometheusStatLogger(StatLoggerBase):
484
histogram.labels(**self.labels).observe(datum)
485
486
def _log_gauge_string(self, gauge, data: Dict[str, str]) -> None:
482
- gauge.labels(**data).set(1)
487
+ gauge.labels(**data).set_to_current_time()
488
489
def _log_prometheus(self, stats: Stats) -> None:
490
# System state data