vllm.v1.metrics.loggers
StatLoggerFactory module-attribute
¶
StatLoggerFactory = Callable[
[VllmConfig, int], "StatLoggerBase"
]
LoggingStatLogger ¶
Bases: StatLoggerBase
Source code in vllm/v1/metrics/loggers.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|
__init__ ¶
__init__(vllm_config: VllmConfig, engine_index: int = 0)
Source code in vllm/v1/metrics/loggers.py
_get_throughput ¶
_reset ¶
_track_iteration_stats ¶
_track_iteration_stats(iteration_stats: IterationStats)
log ¶
Source code in vllm/v1/metrics/loggers.py
log_engine_initialized ¶
Source code in vllm/v1/metrics/loggers.py
record ¶
record(
scheduler_stats: Optional[SchedulerStats],
iteration_stats: Optional[IterationStats],
engine_idx: int = 0,
)
Log Stats to standard output.
Source code in vllm/v1/metrics/loggers.py
PrometheusStatLogger ¶
Bases: StatLoggerBase
Source code in vllm/v1/metrics/loggers.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 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 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 |
|
counter_generation_tokens instance-attribute
¶
counter_generation_tokens = make_per_engine(
counter_generation_tokens, engine_indexes, model_name
)
counter_gpu_prefix_cache_hits instance-attribute
¶
counter_gpu_prefix_cache_hits = make_per_engine(
counter_gpu_prefix_cache_hits,
engine_indexes,
model_name,
)
counter_gpu_prefix_cache_queries instance-attribute
¶
counter_gpu_prefix_cache_queries = make_per_engine(
counter_gpu_prefix_cache_queries,
engine_indexes,
model_name,
)
counter_num_preempted_reqs instance-attribute
¶
counter_num_preempted_reqs = make_per_engine(
counter_num_preempted_reqs, engine_indexes, model_name
)
counter_prefix_cache_hits instance-attribute
¶
counter_prefix_cache_hits = make_per_engine(
counter_prefix_cache_hits, engine_indexes, model_name
)
counter_prefix_cache_queries instance-attribute
¶
counter_prefix_cache_queries = make_per_engine(
counter_prefix_cache_queries, engine_indexes, model_name
)
counter_prompt_tokens instance-attribute
¶
counter_prompt_tokens = make_per_engine(
counter_prompt_tokens, engine_indexes, model_name
)
counter_request_success instance-attribute
¶
counter_request_success: dict[
FinishReason, dict[int, Counter]
] = {}
gauge_gpu_cache_usage instance-attribute
¶
gauge_gpu_cache_usage = make_per_engine(
gauge_gpu_cache_usage, engine_indexes, model_name
)
gauge_kv_cache_usage instance-attribute
¶
gauge_kv_cache_usage = make_per_engine(
gauge_kv_cache_usage, engine_indexes, model_name
)
gauge_scheduler_running instance-attribute
¶
gauge_scheduler_running = make_per_engine(
gauge_scheduler_running, engine_indexes, model_name
)
gauge_scheduler_waiting instance-attribute
¶
gauge_scheduler_waiting = make_per_engine(
gauge_scheduler_waiting, engine_indexes, model_name
)
histogram_decode_time_request instance-attribute
¶
histogram_decode_time_request = make_per_engine(
histogram_decode_time_request,
engine_indexes,
model_name,
)
histogram_e2e_time_request instance-attribute
¶
histogram_e2e_time_request = make_per_engine(
histogram_e2e_time_request, engine_indexes, model_name
)
histogram_inference_time_request instance-attribute
¶
histogram_inference_time_request = make_per_engine(
histogram_inference_time_request,
engine_indexes,
model_name,
)
histogram_iteration_tokens instance-attribute
¶
histogram_iteration_tokens = make_per_engine(
histogram_iteration_tokens, engine_indexes, model_name
)
histogram_max_num_generation_tokens_request instance-attribute
¶
histogram_max_num_generation_tokens_request = (
make_per_engine(
histogram_max_num_generation_tokens_request,
engine_indexes,
model_name,
)
)
histogram_max_tokens_request instance-attribute
¶
histogram_max_tokens_request = make_per_engine(
histogram_max_tokens_request, engine_indexes, model_name
)
histogram_n_request instance-attribute
¶
histogram_n_request = make_per_engine(
histogram_n_request, engine_indexes, model_name
)
histogram_num_generation_tokens_request instance-attribute
¶
histogram_num_generation_tokens_request = make_per_engine(
histogram_num_generation_tokens_request,
engine_indexes,
model_name,
)
histogram_num_prompt_tokens_request instance-attribute
¶
histogram_num_prompt_tokens_request = make_per_engine(
histogram_num_prompt_tokens_request,
engine_indexes,
model_name,
)
histogram_prefill_time_request instance-attribute
¶
histogram_prefill_time_request = make_per_engine(
histogram_prefill_time_request,
engine_indexes,
model_name,
)
histogram_queue_time_request instance-attribute
¶
histogram_queue_time_request = make_per_engine(
histogram_queue_time_request, engine_indexes, model_name
)
histogram_time_per_output_token instance-attribute
¶
histogram_time_per_output_token = make_per_engine(
histogram_time_per_output_token,
engine_indexes,
model_name,
)
histogram_time_to_first_token instance-attribute
¶
histogram_time_to_first_token = make_per_engine(
histogram_time_to_first_token,
engine_indexes,
model_name,
)
labelname_running_lora_adapters instance-attribute
¶
labelname_waiting_lora_adapters instance-attribute
¶
spec_decoding_prom instance-attribute
¶
__init__ ¶
__init__(
vllm_config: VllmConfig,
engine_indexes: Optional[list[int]] = None,
)
Source code in vllm/v1/metrics/loggers.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 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 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
|
log_engine_initialized ¶
log_metrics_info ¶
log_metrics_info(
type: str, config_obj: SupportsMetricsInfo
)
Source code in vllm/v1/metrics/loggers.py
record ¶
record(
scheduler_stats: Optional[SchedulerStats],
iteration_stats: Optional[IterationStats],
engine_idx: int = 0,
)
Log to prometheus.
Source code in vllm/v1/metrics/loggers.py
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
|
StatLoggerBase ¶
Bases: ABC
Interface for logging metrics.
API users may define custom loggers that implement this interface. However, note that the SchedulerStats
and IterationStats
classes are not considered stable interfaces and may change in future versions.
Source code in vllm/v1/metrics/loggers.py
__init__ abstractmethod
¶
__init__(vllm_config: VllmConfig, engine_index: int = 0)
log_engine_initialized abstractmethod
¶
record abstractmethod
¶
record(
scheduler_stats: Optional[SchedulerStats],
iteration_stats: Optional[IterationStats],
engine_idx: int = 0,
)
StatLoggerManager ¶
StatLoggerManager
Logging happens at the level of the EngineCore (per scheduler). * DP: >1 EngineCore per AsyncLLM - loggers for each EngineCore. * With Local Logger, just make N copies for N EngineCores. * With Prometheus, we need a single logger with N "labels"
This class abstracts away this implementation detail from the AsyncLLM, allowing the AsyncLLM to just call .record() and .log() to a simple interface.
Source code in vllm/v1/metrics/loggers.py
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 |
|
per_engine_logger_dict instance-attribute
¶
per_engine_logger_dict: dict[int, list[StatLoggerBase]] = {}
prometheus_logger instance-attribute
¶
__init__ ¶
__init__(
vllm_config: VllmConfig,
engine_idxs: Optional[list[int]] = None,
custom_stat_loggers: Optional[
list[StatLoggerFactory]
] = None,
)
Source code in vllm/v1/metrics/loggers.py
log ¶
log_engine_initialized ¶
record ¶
record(
scheduler_stats: Optional[SchedulerStats],
iteration_stats: Optional[IterationStats],
engine_idx: Optional[int] = None,
)
Source code in vllm/v1/metrics/loggers.py
build_1_2_5_buckets ¶
build_buckets ¶
Builds a list of buckets with increasing powers of 10 multiplied by mantissa values until the value exceeds the specified maximum.
Source code in vllm/v1/metrics/loggers.py
make_per_engine ¶
make_per_engine(
metric: PromMetric,
engine_idxs: list[int],
model_name: str,
) -> dict[int, PromMetric]