[V1][Bugfix] Do not reset prefix caching metrics (#14235)

This commit is contained in:
Cody Yu 2025-03-04 20:39:13 -08:00 committed by GitHub
parent 0df25101d6
commit ade3f7d988
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,6 +34,9 @@ class LoggingStatLogger(StatLoggerBase):
def __init__(self):
self._reset(time.monotonic())
self.last_scheduler_stats = SchedulerStats()
# Prefix cache metrics. This cannot be reset.
# TODO: Make the interval configurable.
self.prefix_caching_metrics = PrefixCachingMetrics()
def _reset(self, now):
self.last_log_time = now
@ -42,9 +45,6 @@ class LoggingStatLogger(StatLoggerBase):
self.num_prompt_tokens: list[int] = []
self.num_generation_tokens: list[int] = []
# Prefix cache metrics. TODO: Make the interval configurable.
self.prefix_caching_metrics = PrefixCachingMetrics()
def _track_iteration_stats(self, iteration_stats: IterationStats):
# Save tracked stats for token counters.
self.num_prompt_tokens.append(iteration_stats.num_prompt_tokens)