vllm.v1.metrics.stats ¶
BaseCacheStats dataclass
¶
Stores cache hit statistics.
Source code in vllm/v1/metrics/stats.py
CachingMetrics ¶
Metrics for caching with a hit rate of the most recent N requests. Args: interval: The number of the most recent requests to aggregate. Defaults to 1000.
Source code in vllm/v1/metrics/stats.py
__init__ ¶
__init__(max_recent_requests: int = 1000) -> None
Source code in vllm/v1/metrics/stats.py
observe ¶
observe(stats: BaseCacheStats)
Observe the prefix caching for a set of requests.
This function is called with information gathered when new requests are being scheduled and are looking for computed blocks.
When there are more than max_recent_requests
requests, the oldest set of requests are removed from the metrics.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stats | BaseCacheStats | The prefix cache stats. | required |
Source code in vllm/v1/metrics/stats.py
FinishedRequestStats dataclass
¶
Stats associated with a finished request.
Source code in vllm/v1/metrics/stats.py
mean_time_per_output_token class-attribute
instance-attribute
¶
mean_time_per_output_token: float = 0.0
__init__ ¶
__init__(
finish_reason: FinishReason,
e2e_latency: float = 0.0,
num_prompt_tokens: int = 0,
num_generation_tokens: int = 0,
max_tokens_param: Optional[int] = None,
queued_time: float = 0.0,
prefill_time: float = 0.0,
inference_time: float = 0.0,
decode_time: float = 0.0,
mean_time_per_output_token: float = 0.0,
) -> None
IterationStats ¶
Stats associated with a single set of EngineCoreOutputs.
Source code in vllm/v1/metrics/stats.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
|
__init__ ¶
Source code in vllm/v1/metrics/stats.py
_time_since ¶
update_from_events ¶
update_from_events(
req_id: str,
events: list[EngineCoreEvent],
is_prefilling: bool,
req_stats: RequestStateStats,
lora_stats: Optional[LoRAStats],
)
Source code in vllm/v1/metrics/stats.py
update_from_finished_request ¶
update_from_finished_request(
finish_reason: FinishReason,
num_prompt_tokens: int,
max_tokens_param: Optional[int],
req_stats: RequestStateStats,
)
Source code in vllm/v1/metrics/stats.py
update_from_output ¶
update_from_output(
output: EngineCoreOutput,
engine_core_timestamp: float,
is_prefilling: bool,
prompt_len: int,
req_stats: RequestStateStats,
lora_stats: Optional[LoRAStats],
)
Source code in vllm/v1/metrics/stats.py
LoRARequestStates ¶
Per-LoRA request state stats.
Source code in vllm/v1/metrics/stats.py
__init__ ¶
add_request ¶
add_request(req_state: RequestState)
finish_request ¶
finish_request(req_state: RequestState)
get_stats ¶
get_stats(req_state: RequestState) -> Optional[LoRAStats]
Source code in vllm/v1/metrics/stats.py
preempted_request staticmethod
¶
scheduled_request staticmethod
¶
update_iteration_stats ¶
update_iteration_stats(
iteration_stats: Optional[IterationStats],
)
Source code in vllm/v1/metrics/stats.py
LoRAStats dataclass
¶
MultiModalCacheStats dataclass
¶
Bases: BaseCacheStats
Stores multi-modal cache hit statistics. - reset
: Whether reset_mm_cache
was invoked. - queries
: Refers to the number of multi-modal data items that were queried.
Source code in vllm/v1/metrics/stats.py
PrefixCacheStats dataclass
¶
Bases: BaseCacheStats
Stores prefix cache hit statistics. - reset
: Whether reset_prefix_cache
was invoked. - queries
: Refers to the number of tokens that were queried.
Source code in vllm/v1/metrics/stats.py
preempted_hits class-attribute
instance-attribute
¶
preempted_hits: int = 0
The hits
number for preempted requests.
preempted_queries class-attribute
instance-attribute
¶
preempted_queries: int = 0
The queries
number for preempted requests.
RequestStateStats dataclass
¶
Stats that need to be tracked across delta updates.
Source code in vllm/v1/metrics/stats.py
SchedulerStats dataclass
¶
Stats associated with the scheduler.
Source code in vllm/v1/metrics/stats.py
kv_connector_stats class-attribute
instance-attribute
¶
prefix_cache_stats class-attribute
instance-attribute
¶
prefix_cache_stats: PrefixCacheStats = field(
default_factory=PrefixCacheStats
)
spec_decoding_stats class-attribute
instance-attribute
¶
spec_decoding_stats: Optional[SpecDecodingStats] = None
__init__ ¶
__init__(
num_running_reqs: int = 0,
num_waiting_reqs: int = 0,
step_counter: int = 0,
current_wave: int = 0,
kv_cache_usage: float = 0.0,
prefix_cache_stats: PrefixCacheStats = PrefixCacheStats(),
spec_decoding_stats: Optional[SpecDecodingStats] = None,
kv_connector_stats: Optional[dict[str, Any]] = None,
num_corrupted_reqs: int = 0,
) -> None