/metrics, including on a server that requires a bearer key for inference.
Enable metrics
Install themetrics extra alongside the model’s dependencies and pass --enable-metrics. For a Kokoro deployment:
/health reports ready, send an inference request and run curl -fsS http://localhost:8000/metrics. A disabled endpoint returns 404. Labeled series appear when first used.
Choose a measurement
Prometheus and Grafana
examples/observability/ runs Prometheus and Grafana in Docker Compose against an M* server on the host. From the repository root:
localhost:9090) scrapes /metrics every 5 seconds. Grafana (localhost:3000) has Prometheus as its default data source and loads any dashboard JSON placed in examples/observability/grafana/dashboards/. The example’s README covers how the containers reach the host on Linux, a server on another port, and the optional anonymous viewer. Stop the containers with docker compose -f examples/observability/docker-compose.yml down.
The M* serving dashboard there (mstar.json) has a panel for every family on this page, in one row per component: requests, request stages and output, data worker, conductor, engine workers, tensor transport and HTTP refusals. Its model variable picks the model_name values to show.
To scrape from an existing Prometheus, add a job for the server’s address:
mstar-server waits that long for the bridge before answering 503.
Example queries
These aggregate every matching series; add amodel_name selector to look at one model. A KV cache that two nodes share shows under each node, so read Engine workers before summing KV gauges over component.
Check freshness
The API server renders a single registry. Its own values are current at scrape time. The conductor reports every second. Worker updates pass through the conductor and can lag by roughly two seconds in a healthy deployment. Ifmstar_conductor_status_age_seconds rises, those values may be older. A Rust frontend that cannot obtain the registry from its backend can return 503.
Conventions
- Names use Prometheus base units (
_seconds,_bytes), and counters end in_total. Read counters and histograms withrate()orincrease(). - Every family has a
model_namelabel: the config’smodelkey (the registry name, e.g.kokoroorqwen3_omni). - Label values come from fixed sets or from the model and its config, never from requests, so the number of series is bounded:
outcome:success,error,abort,timeout.output_modalitiesandinput_modalities: the request’s modalities, sorted and comma-joined (audio,text), fromtext,image,audio,video,video_frame,action,scalar,tensor. In practice a model has a few combinations.modality: one of those modality names.state:waiting,running,draining.component: a graph node name from the config’snode_groups.graph_walk: a graph walk name of the model.resource: the key of a paged KV cache in the model.srcanddst: a graph node name, orapi_server.transport:SHM,TCP,RDMA.route: a route path as declared (/v1/chat/completions), orunmatched.status: an HTTP status code the frontend sent (a4xx, or503).term:prefix, the term of the config’srouting_weightsother thanload.
- A labeled series appears the first time it is used. For a new set of output modalities,
mstar_requests_totalexports all four outcomes at zero from that request on, and the data worker’s two families start together, so a later first error shows inrate().rate()andincrease()miss what was counted before the first scrape that saw a series: if a set’s first request fails, its error series starts at 1.
Account for warmup and failures
Request histograms, step counters and transfers begin after warmup. Gauges can reflect resources allocated at worker startup. Read request latency histograms together with success and failure counts, since a successful-request histogram excludes failed calls.Requests
mstar_requests_total{model_name, output_modalities, outcome} Counter. Requests that left the API server. Outcomes are
success, error, abort and timeout. An unread result discarded after its client disconnects is an abort.
mstar_requests_in_flight{model_name} Gauge. Requests submitted and still held by the API server at scrape time.
mstar_e2e_request_latency_seconds{model_name, output_modalities} Histogram. Successful requests, from submission after body read to the result leaving the API server. Excludes client network time.
mstar_time_to_first_output_seconds{model_name, output_modalities} Histogram. Successful requests, from submission to the first result chunk of any modality.
Request stages
These successful-request stages use clocks on the same host.mstar_request_preprocess_seconds{model_name, output_modalities} Histogram. Successful requests, from submission to handoff to the conductor. Includes time queued at the data worker.
mstar_request_queue_seconds{model_name, output_modalities} Histogram. Successful requests, from conductor intake to admission for dispatch. Zero when no admission wait occurred.
mstar_request_engine_seconds{model_name, output_modalities} Histogram. Successful requests, from conductor dispatch to completion on the conductor. Excludes admission wait.
mstar_request_delivery_seconds{model_name, output_modalities} Histogram. Successful requests, from conductor completion to the result leaving the API server. Includes postprocessing and pickup of the last result.
Output
mstar_output_chunks_total{model_name, modality} Counter. Result chunks across outcomes. Error chunks are excluded.
mstar_output_bytes_total{model_name, modality} Counter. Result payload bytes across outcomes.
mstar_output_audio_seconds_total{model_name} Counter. PCM16 audio duration using each chunk’s sample rate and channel count. Chunks missing a sample rate are excluded.
mstar_time_to_first_chunk_seconds{model_name, modality} Histogram. Successful requests, from submission to first chunk for each modality. Select
modality="audio" for time to first audio.
Preprocessing
Compare queue depth with active preprocess time to distinguish backlog from slow media decoding.mstar_data_worker_preprocess_seconds{model_name, input_modalities} Histogram. Time from dequeue to handoff to the conductor for requests that finish preprocessing. Excludes queue wait.
mstar_data_worker_preprocess_failures_total{model_name, input_modalities} Counter. Requests whose media loading, preprocessing or input handoff failed.
mstar_upload_size_bytes{model_name, modality} Histogram. Bytes per media file presented to preprocessing, after decoding inline uploads. Includes files from failed requests.
mstar_data_worker_queue_depth{model_name} Gauge. Submitted requests still waiting for the data worker. Excludes requests already being processed.
HTTP refusals
Exported by the API server, counted by whichever frontend serves the deployment.mstar_http_refusals_total{model_name, route, status} Counter. HTTP requests the frontend answered with an error without submitting them to the API server:
401 (missing or wrong API key), 413 (body over MSTAR_MAX_BODY_MB), 422 (body that fails validation), 400 (a bad form field or request), 409 (a request_id in flight), 404 (unknown route, or a model without the endpoint), 405 (wrong method), and 503 when the Rust frontend’s MSTAR_MAX_CONCURRENT_REQUESTS cap turns a request away. WebSocket handshakes are not counted. Unless --python-frontend is set, the values are the totals mstar-server sent with the latest /metrics request.
Conductor
mstar_conductor_requests{model_name, state} Gauge. Requests held by the conductor.
waiting counts queued requests, running counts dispatched requests and draining counts finished requests waiting for readers to release outputs. Draining requests still occupy a slot.
mstar_component_in_flight{model_name, component} Gauge. Running requests with an outstanding graph pass on this node. A decode loop counts once for the pass.
mstar_routing_predicted_saving_total{model_name, term} Counter. Unweighted routing credit on the chosen replica. For
term="prefix", each request adds the predicted cached share of its prompt. This differs from a token-weighted cache hit rate.
mstar_conductor_status_age_seconds{model_name} Gauge. Time since the latest conductor status message, or since enabling metrics if none has arrived. Read this before relying on worker and conductor gauges.
Engine workers
Workers report per graph node. Replicas sum across workers. TP, SP and CFG groups report once per instance. A physical cache shared by nodes appears under each node. Inspect individual resources before aggregating. Admission and preemptionmstar_kv_pages_used{model_name, component, resource} Gauge. Pages held by requests or the prefix cache. Query by
component and resource. A shared cache can appear under more than one node.
mstar_kv_pages_total{model_name, component, resource} Gauge. Device KV pages available to requests in this cache.
mstar_kv_pages_cached{model_name, component, resource} Gauge. Pages referenced by the prefix cache, including some also held by active requests. Pages held solely by the cache can be evicted.
mstar_kv_pages_lent{model_name, component, resource} Gauge. Reserved pages lent by guaranteed requests and currently occupied.
mstar_rebuild_host_bytes_used{model_name, component} Gauge. Bytes of a worker’s rebuild host pool that hold kept prompt ids and host copies, which a request dropped from the KV cache is rebuilt from.
mstar_rebuild_host_bytes_total{model_name, component} Gauge. Bytes of a worker’s rebuild host pool (the serving config’s rebuild_host_mb).
mstar_step_seconds{model_name, component, graph_walk} Histogram. Worker time per completed step, from handoff to the GPU thread or the previous completion, whichever is later, through postprocess. Overlapped work counts once.
mstar_batch_size{model_name, component, graph_walk} Histogram. Engine steps: rows the step’s forward ran.
mstar_prefix_cache_query_tokens_total{model_name, component} Counter. Tokens looked up in the prefix cache, once per eligible request. In a tensor-parallel instance only the lead rank counts.
mstar_prefix_cache_hit_tokens_total{model_name, component} Counter. Tokens found in the KV prefix cache at lookup time. A recurrent-state snapshot can shorten the usable prefix afterwards.
mstar_kv_preemptions_total{model_name, component} Counter. Requests selected for host offload or drop when pages are needed.
mstar_kv_drops_total{model_name, component} Counter. Preempted requests whose KV was discarded for later reconstruction.
mstar_kv_rebuild_tokens_total{model_name, component} Counter. Tokens of kept history the rebuild rows prefilled, cache hits included.
mstar_kv_rebuild_cached_pages_total{model_name, component} Counter. Pages a rebuild row found in the prefix cache.
mstar_kv_preempted_again_total{model_name, component} Counter. Requests preempted a second time. Sustained growth suggests pressure on the KV pool.
mstar_kv_returns_preempted_total{model_name, component} Counter. Requests with a rebuild log that were preempted again before they sampled another token.
mstar_kv_take_backs_total{model_name, component} Counter. Preemptions to reclaim lent pages. Also included in
mstar_kv_preemptions_total.
mstar_kv_take_back_waits_total{model_name, component} Counter. Times a guaranteed request waited to reclaim lent pages because no borrower could move.
mstar_component_pending_steps{model_name, component} Gauge. Requests with inputs ready for this node, waiting for room in a batch or for the scheduler to select the node. For a token-weighted prefix hit rate over five minutes, divide
sum(rate(mstar_prefix_cache_hit_tokens_total[5m])) by sum(rate(mstar_prefix_cache_query_tokens_total[5m])). Use matching selectors for model and component.
Tensor transport
The consumer records each edge read.src and dst are nodes or api_server. A tensor already at its destination requires no transfer. Multiple ranks reading the same edge each count their own read.
mstar_transfer_bytes_total{model_name, src, dst, transport} Counter. Tensor bytes the consumer read from the producer over this edge.
mstar_transfers_total{model_name, src, dst, transport} Counter. Tensors read over this edge by the consumer.
mstar_transfer_seconds{model_name, src, dst, transport} Histogram. Consumer-side duration per edge read. The producer’s write or registration is measured separately in request profiles. A GPU consumer may only have enqueued its H2D copy when the timing ends.
Histogram buckets
Upper bounds, without+Inf:
- E2E (
mstar_e2e_request_latency_seconds,mstar_request_engine_seconds): 0.05, 0.1, 0.25, 0.5, 0.75, 1, 1.5, 2, 3, 5, 7.5, 10, 15, 20, 30, 60, 120, 300, 600, 1200 s. - First output (
mstar_time_to_first_output_seconds,mstar_time_to_first_chunk_seconds): 0.01, 0.025, 0.05, 0.075, 0.1, 0.15, 0.2, 0.3, 0.5, 0.75, 1, 1.5, 2, 3, 5, 7.5, 10, 20, 30, 60, 120, 300, 600 s. - Stage (
mstar_request_preprocess_seconds,mstar_request_delivery_seconds,mstar_data_worker_preprocess_seconds): 0.0005, 0.001, 0.0025, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 30, 60, 120, 300, 600 s. - Queue (
mstar_request_queue_seconds): 0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 30, 60, 120, 300, 600 s. - Upload size (
mstar_upload_size_bytes): 1, 4, 16, 32, 64, 128, 256, 512 KiB, then 1, 2, 4, 8, 16, 32, 64, 128, 256, 1024 MiB. - Step (
mstar_step_seconds): 0.0005, 0.001, 0.002, 0.003, 0.005, 0.0075, 0.01, 0.015, 0.02, 0.03, 0.05, 0.075, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 30 s. - Batch (
mstar_batch_size): 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 rows. - Transfer (
mstar_transfer_seconds): 10, 25, 50, 100, 250, 500 µs, then 1, 2.5, 5, 10, 25, 50, 100, 250, 500 ms, then 1, 2.5, 5, 10 s.