Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ refactor for using StatLoggerBase #22

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/vllm_tgis_adapter/grpc/grpc_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ async def post_init(self) -> None:
assert self.tokenizer is not None

# Swap in the special TGIS stats logger
assert hasattr(self.engine.engine, "stat_logger")
assert self.engine.engine.stat_logger
assert hasattr(self.engine.engine, "stat_loggers")
assert self.engine.engine.stat_loggers

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
Loading