Skip to content

UCM Metrics Observability

UCM exports metrics through the vLLM connector and reuses vLLM's Prometheus /metrics endpoint. No separate exporter, export mode, or service port is required.

We recommend using Prometheus to scrape vLLM metrics and Grafana to visualize the collected data.

Use a scrape and dashboard refresh interval of at least 5 seconds for UCM metrics. The Prometheus and Metrics-view examples in this guide both use 5 seconds. A shorter interval usually does not make UCM metrics update faster.

The effective refresh frequency also depends on vLLM. UCM first accumulates metrics internally. New data is synchronized to the Prometheus metrics exposed by vLLM only after vLLM processes a request and calls the connector's get_kv_connector_stats() method. When there are no inference requests, vLLM does not call this method and UCM metrics do not update.

Enable or Disable Metrics

Use the Built-in Configuration

UCM metrics are enabled by default. When metrics_config_path is omitted, UCM uses the complete built-in metric set. Metrics can also be enabled explicitly:

enable_metrics: true

To disable all UCM metrics:

enable_metrics: false

Use a Custom Configuration

To restrict the exported metric set or customize Histogram buckets, set the following top-level UCM options:

enable_metrics: true
metrics_config_path: "/workspace/unified-cache-management/examples/metrics/metrics_configs.yaml"

Once metrics_config_path is set, the file becomes the metric enable-list. Only metrics defined in that file are registered.

The metrics file must exist and be readable by the vLLM process. Otherwise, UCM metrics are not exposed.

Access Metrics

Start vLLM with the UCM connector and send at least one inference request. Then verify that UCM metrics are available:

curl http://<vllm-ip>:<vllm-port>/metrics | grep -E '^(ucm|kv):'

Most UCM metrics appear only after their corresponding code path has run. When there is no external-storage hit, only a small subset of metrics may be present.

UCM Metric Labels

Each metric exported through the vLLM connector carries these labels:

Label Meaning Example
model_name Model name served by vLLM, taken from the vLLM model configuration Qwen3-32B
engine vLLM engine that produced the metric; distinguishes DP instances in the same service engine-0
worker_rank UCM process that produced the metric, corresponding to a TP instance; workers use their distributed rank and the scheduler uses scheduler 0, 1, scheduler

Some metrics also carry a metric-specific label. ucm:drampool_buffer_pool_usage_ratio adds slot_size (the KV cache block size in bytes). A configured block size starts being reported as its own series once its pool has served at least one allocation, and keeps being reported for the rest of the process lifetime (including after the pool drains back to zero); configured sizes that have never been used do not appear. Each series can be filtered or broken out in Grafana.

For example:

ucm:cache_load_bytes_total{model_name="Qwen3-32B",engine="engine-0",worker_rank="0"} 1.048576e+08

Prometheus and Grafana Integration

Prometheus and Grafana are the recommended combination for observing UCM. Prometheus periodically scrapes the vLLM metrics endpoint, stores historical time-series data, and provides a query interface. Grafana queries Prometheus and displays the metrics as dashboards.

Configure Prometheus

If Prometheus already scrapes vLLM's /metrics endpoint, no additional scrape job is needed for UCM because both vLLM and UCM metrics are exposed through the same endpoint.

Create prometheus.yml and configure Prometheus to scrape the vLLM service:

global:
  scrape_interval: 5s
  evaluation_interval: 30s

scrape_configs:
  - job_name: vllm
    metrics_path: /metrics
    static_configs:
      - targets:
          - "<vllm-ip>:8000"

Set the scrape target to an engine address and port reachable from the Prometheus container, such as the quickstart host's actual IP and port 7800. Do not use the Prometheus container's own 127.0.0.1.

From the host directory containing prometheus.yml, create the network and persistent volume, then start Prometheus:

docker network create ucm-monitoring
docker volume create prometheus-data

docker run -d \
  --name prometheus \
  --restart unless-stopped \
  --network ucm-monitoring \
  -p 9090:9090 \
  -v "$PWD/prometheus.yml:/etc/prometheus/prometheus.yml:ro" \
  -v prometheus-data:/prometheus \
  prom/prometheus

Open http://<prometheus-host>:9090/targets, confirm the vllm target is UP, then query ucm: metrics and, when KVClient operations run, kv: metrics. Reuse ucm-monitoring when the network already exists.

Install Grafana

Create a persistent volume and start Grafana:

docker volume create grafana-data

docker run -d \
  --name grafana \
  --restart unless-stopped \
  --network ucm-monitoring \
  -p 3000:3000 \
  -v grafana-data:/var/lib/grafana \
  grafana/grafana

Open http://<grafana-ip>:3000. On the first login, use admin for both the username and password, then change the password when prompted.

Add the Prometheus Data Source

In Grafana, go to Connections → Add new connection, search for Prometheus, and configure:

  • Prometheus server URL: http://prometheus:9090
  • Authentication: No authentication for an unauthenticated local deployment
  • Select Save & test and verify that Grafana can query Prometheus

The shared ucm-monitoring network resolves the hostname prometheus. For Grafana running elsewhere, use a Prometheus address reachable from that environment.

Import UCM Dashboards

Go to Dashboards → New → Import, upload the required dashboard JSON file, select the Prometheus data source, and click Import.

UCM provides these dashboards:

File Purpose
examples/metrics/grafana_vllm.json vLLM request latency, token throughput, scheduler state, and cache state
examples/metrics/grafana_store.json Store lookup, load, dump, bandwidth, and cache activity
examples/metrics/grafana_connector.json Connector Lookup/Load/Save request counts, block counts, durations, throughput, and errors

Inspect metrics from a terminal

You can inspect the engine endpoint without Prometheus/Grafana. From the UCM checkout root in a terminal that can reach the endpoint, run:

python3 -m pip install -e toolkit
ucm-toolkit run metrics-view list-configs
ucm-toolkit run metrics-view check \
  --url http://127.0.0.1:7800/metrics \
  --config store

This inspects the current snapshot. See metrics-view operations for background collection, time-window queries and MLA TP parameters.

Metric export names

The configuration name is the internal collection key. Optional prometheus_name sets the public name for both vLLM and multiproc consumers. Names containing : are preserved; otherwise the consumer prefix is added (default ucm:). An explicit vllm_connector_name overrides the public name only for vLLM. Export naming does not change values, units, buckets, or labels.

KVClient metrics (kv:)

KVClient and its transport layer use the kv: namespace. The default configuration sets their public names explicitly:

  • kv:kv_client_*: KVClient API counters and task duration histograms.
  • kv:kv_transport_*: transport error counters and task duration histograms.

For example, the internal key kv_client_query_requests_total is exported as kv:kv_client_query_requests_total. Both the vLLM and multiproc consumers use these configured names. Other default UCM metrics continue to use ucm:.

Custom YAML and inline configurations replace the defaults. Include the prometheus_name fields for KV metrics when using a custom configuration. To update the repository's example YAML and Python defaults, run python kv_semantics/metrics/tools/generate_kv_metrics.py --sync-ucm. Existing queries for ucm:kv_* must be updated to kv:kv_*.

Reference