Skip to main content

kvtop

A small, read-only Rust CLI for inspecting KV-cache metrics from Prometheus text snapshots.

Version 0.1.0 reads a UTF-8 file or stdin, selects KV-related metrics, and emits a terminal table or JSON. It is useful with a serving engine's existing metrics endpoint; it does not attach to CUDA or modify a running engine. The Rust executable has no third-party crate dependencies.

Use

curl -fsS http://localhost:8000/metrics | kvtop
kvtop --file snapshot.prom
kvtop --file snapshot.prom --json
kvtop --file snapshot.prom --match prefix_cache

Default name filters cover kv_cache, prefix_cache, kv_block, kv_transfer, cached_tokens, prompt_tokens_cached, and prefill_kv_computed. --match replaces those filters and can be repeated. The input limit is 16 MiB. Empty or missing measurements return an error instead of zero.

Values retain the producer's units and labels. In particular, vLLM's kv_cache_usage_perc uses 1 for 100%, and prefix-cache counters count tokens, not requests. Samples from different workers are kept separate. This tool does not infer physical bytes from generic GPU usage, derive interval hit rates from cumulative counters, or claim a causal performance saving.

JSON has schema_version: 1 and a samples array. Each sample contains name, a raw Prometheus labels string, value, and raw_value. Nonfinite values have JSON null plus their explicit raw_value; very large numeric values may lose precision in value, so use raw_value when exact representation matters. Timestamps and exemplars are not included in this first version. This is a metric-snapshot inspector, not a general Prometheus validator.

Build and test

cargo test
cargo build --release
cargo run -- --file examples/vllm.prom --json

The fixture is synthetic. An actual engine integration and real GPU performance measurements have not been validated by this release preparation.

Distribution

The package is configured for Cargo and for a Python wheel containing the same Rust executable, using Maturin's bin mode. Publishing preparation is not evidence that either registry currently hosts this project. See PUBLISH.md in the source delivery for the commands and publication status.

Existing command with the same name

This is an independent project, unaffiliated with ovg-project/kvcached, which already distributes a Python command named kvtop. Their command inspects kvcached shared-memory records; this program reads Prometheus snapshots. Installing both commands into one environment may overwrite or shadow one entrypoint. Use a separate virtual environment or an explicit executable path. This project does not replace, patch, or depend on kvcached.

License

MIT.

Release files for kvtop 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kvtop 0.1.0
File Size Uploaded
kvtop-0.1.0.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kvtop 0.1.0
File Interpreter ABI Platform
kvtop-0.1.0-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details

Total release size: 216.4 kB

Release files / kvtop-0.1.0.tar.gz

Download URL kvtop-0.1.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b38a8d2506a474541329ea5a7d478b04db4632b8fb8f15477e487b49d3ea6b31
BLAKE2b-256 checksum
How to use checksums
9dd7ddfc5853d9c7240207823905a9bbef0eaf6a3260afc72ef97bc2d6a2fc4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / kvtop-0.1.0-py3-none-manylinux_2_34_x86_64.whl

Download URL kvtop-0.1.0-py3-none-manylinux_2_34_x86_64.whl
Size 209.2 kB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
45cc88f4056080ce8366fa16bb388591805466600e1565b976bba183f30c89c8
BLAKE2b-256 checksum
How to use checksums
15f3ad307355fc6ba72e8a1344bc3fc721bfca5a322e3002eee326297c3e9c23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page