| 4054 | |
| 4055 | @dataclass |
| 4056 | class SchedulerMetrics: |
| 4057 | started_at: float = field(default_factory=time.time) |
| 4058 | requests_submitted_total: int = 0 |
| 4059 | requests_admitted_total: int = 0 |
| 4060 | requests_completed_total: int = 0 |
| 4061 | requests_cancelled_total: int = 0 |
| 4062 | requests_failed_total: int = 0 |
| 4063 | prompt_tokens_total: int = 0 |
| 4064 | prompt_seconds_total: float = 0.0 |
| 4065 | tokens_predicted_total: int = 0 |
| 4066 | tokens_predicted_seconds_total: float = 0.0 |
| 4067 | scheduler_step_seconds_total: float = 0.0 |
| 4068 | process_batch_seconds_total: float = 0.0 |
| 4069 | sample_seconds_total: float = 0.0 |
| 4070 | draft_seconds_total: float = 0.0 |
| 4071 | draft_process_seconds_total: float = 0.0 |
| 4072 | draft_generate_seconds_total: float = 0.0 |
| 4073 | draft_sampled_batch_seconds_total: float = 0.0 |
| 4074 | draft_process_calls_total: int = 0 |
| 4075 | draft_generate_calls_total: int = 0 |
| 4076 | draft_sampled_batch_calls_total: int = 0 |
| 4077 | draft_batches_verified_total: int = 0 |
| 4078 | draft_target_tokens_verified_total: int = 0 |
| 4079 | draft_target_tokens_wasted_total: int = 0 |
| 4080 | draft_tokens_reused_as_pending_total: int = 0 |
| 4081 | n_decode_total: int = 0 |
| 4082 | scheduler_step_calls_total: int = 0 |
| 4083 | process_batch_calls_total: int = 0 |
| 4084 | sample_calls_total: int = 0 |
| 4085 | n_tokens_max: int = 0 |
| 4086 | n_busy_slots_total: int = 0 |
| 4087 | checkpoint_hits_total: int = 0 |
| 4088 | checkpoint_saves_total: int = 0 |
| 4089 | checkpoint_evictions_total: int = 0 |
| 4090 | sequence_cache_hits_total: int = 0 |
| 4091 | sequence_cache_save_requests_total: int = 0 |
| 4092 | sequence_cache_lookup_failures_total: int = 0 |
| 4093 | sequence_cache_load_failures_total: int = 0 |
| 4094 | sequence_cache_save_failures_total: int = 0 |
| 4095 | sequence_cache_tokens_loaded_total: int = 0 |
| 4096 | |
| 4097 | def observe_decode( |
| 4098 | self, |
| 4099 | items: Sequence[Any], |
| 4100 | elapsed_seconds: float, |
| 4101 | ) -> None: |
| 4102 | if not items: |
| 4103 | return |
| 4104 | total_tokens = sum( |
| 4105 | item.batch_token_count |
| 4106 | for item in items |
| 4107 | ) |
| 4108 | if total_tokens <= 0: |
| 4109 | return |
| 4110 | prompt_tokens = sum( |
| 4111 | item.batch_token_count |
| 4112 | for item in items |
| 4113 | if getattr(item, "kind", None) == "prefill" |
no outgoing calls
no test coverage detected
searching dependent graphs…