[V1][Metrics] Preserve prefix-cache stats on zero-output steps (#48668)
Signed-off-by: Rishi Puri <riship@nvidia.com> Signed-off-by: Rishi Puri <puririshi98@berkeley.edu> Signed-off-by: Nick Hill <nickhill123@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Nick Hill <nickhill123@gmail.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
Nick Hill
parent
cb1a52aee3
commit
dedbf6be8b
@@ -307,7 +307,9 @@ class LLMEngine:
|
||||
|
||||
# 2) Process EngineCoreOutputs.
|
||||
with record_function_or_nullcontext("llm_engine step: process_outputs"):
|
||||
iteration_stats = IterationStats() if self.log_stats else None
|
||||
iteration_stats = (
|
||||
IterationStats() if self.log_stats and outputs.outputs else None
|
||||
)
|
||||
processed_outputs = self.output_processor.process_outputs(
|
||||
outputs.outputs,
|
||||
engine_core_timestamp=outputs.timestamp,
|
||||
@@ -321,17 +323,15 @@ class LLMEngine:
|
||||
|
||||
# 4) Record stats
|
||||
with record_function_or_nullcontext("llm_engine step: record_stats"):
|
||||
if (
|
||||
self.logger_manager is not None
|
||||
and outputs.scheduler_stats is not None
|
||||
and len(outputs.outputs) > 0
|
||||
):
|
||||
if self.logger_manager is not None and outputs.scheduler_stats is not None:
|
||||
# Record even when this step produced no request outputs.
|
||||
self.logger_manager.record(
|
||||
scheduler_stats=outputs.scheduler_stats,
|
||||
iteration_stats=iteration_stats,
|
||||
mm_cache_stats=self.renderer.stat_mm_cache(),
|
||||
)
|
||||
self.do_log_stats_with_interval()
|
||||
if outputs.outputs:
|
||||
self.do_log_stats_with_interval()
|
||||
|
||||
return processed_outputs.request_outputs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user