Skip to content

Commit

Permalink
♻️ refactor for using StatLoggerBase
Browse files Browse the repository at this point in the history
Signed-off-by: Prashant Gupta <[email protected]>
  • Loading branch information
prashantgupta24 committed Jul 1, 2024
1 parent 6b136ae commit 595a317
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/vllm_tgis_adapter/grpc/grpc_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ async def post_init(self) -> None:
assert hasattr(self.engine.engine, "stat_logger")
assert self.engine.engine.stat_logger

vllm_stat_logger = self.engine.engine.stat_logger
vllm_stat_logger = self.engine.engine.stat_loggers["prometheus"]
tgis_stats_logger = TGISStatLogger(
vllm_stat_logger=vllm_stat_logger,
max_sequence_len=self.config.max_model_len,
Expand Down
8 changes: 4 additions & 4 deletions src/vllm_tgis_adapter/tgis_utils/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from prometheus_client import Counter, Gauge, Histogram
from vllm import RequestOutput
from vllm.engine.metrics import StatLogger, Stats
from vllm.engine.metrics import StatLoggerBase, Stats

from vllm_tgis_adapter.grpc.pb.generation_pb2 import (
BatchedTokenizeRequest,
Expand Down Expand Up @@ -102,10 +102,10 @@ def observe_generation_success(self, start_time: float) -> None:
self.tgi_request_duration.observe(duration)


class TGISStatLogger(StatLogger):
"""Wraps the vLLM StatLogger to report TGIS metric names for compatibility."""
class TGISStatLogger(StatLoggerBase):
"""Wraps the vLLM StatLoggerBase to report TGIS metric names for compatibility."""

def __init__(self, vllm_stat_logger: StatLogger, max_sequence_len: int):
def __init__(self, vllm_stat_logger: StatLoggerBase, max_sequence_len: int):
# Not calling super-init because we're wrapping and delegating to
# vllm_stat_logger
self._vllm_stat_logger = vllm_stat_logger
Expand Down

0 comments on commit 595a317

Please sign in to comment.