- KV-cache pressure
- running and waiting requests
- request preemptions
- time to first token
- inter-token latency
- prompt and generation lengths
- completion finish reasons
- llama.cpp token throughput
Engine metrics describe the inference backend.They are separate from Hivenet Router’s universal request metrics and the host-level GPU, CPU, and memory metrics collected by the agent.
How engine metrics flow
For a supported engine, the agent:- requests the backend’s
/metricsendpoint - extracts the metrics Hivenet Router understands
- caches the latest successful snapshot
- sends that snapshot through routing signals and heartbeats
- continues serving requests when a metrics scrape fails
- stores the current engine snapshot
- exposes scalar values through
/admin/routing-table - publishes Prometheus gauges, counters, and histograms
- makes supported scalar fields available to routing-policy gates
Collection interval
The default engine scrape interval is:Scrape failures and stale values
Engine metric failures do not stop inference routing. If a scrape fails:- the agent keeps the previous successful snapshot
- routing signals continue carrying that cached data
- the agent logs one warning when scraping changes from working to failing
- it logs a recovery message after a later successful scrape
- request forwarding continues
Engine support
The current implementation collects engine metrics from:- vLLM
- SGLang
- llama.cpp
- Ollama
- Infinity
- custom engines
Metric availability
SGLang and llama.cpp expose histogram data that Hivenet Router uses to calculate their local average and P90 scalar values.In the current implementation, raw histogram snapshots are re-exported through Prometheus only for vLLM.
Enable backend metrics
- vLLM
- SGLang
- llama.cpp
vLLM exposes its Prometheus endpoint without an additional Hivenet Router-specific flag.Check it:
Prometheus labels
Engine metrics use:- agent
- model
- engine
- organization
- machine
View the current engine snapshot
Use the administration routing table:engine object is omitted when the router has not received an engine snapshot for that agent.
The routing table currently exposes scalar engine values. Raw histograms, finish-reason counters, and llama.cpp throughput gauges are available through Prometheus.
KV-cache utilization
View current cache use:
- request preemption
- recomputation
- latency spikes
- reduced throughput
- backend instability under additional load
Running requests
View running requests:
- the agent may have accepted a request that has not entered the engine’s running batch yet
- a long streaming generation can continue after Hivenet Router releases its declared capacity slot when response headers arrive
- a backend may continue work briefly after a client disconnects
- collection and routing snapshots may arrive at slightly different times
Waiting requests
View backend queues:
- time to first token
- request latency
- timeout risk
- cache pressure
Preemptions
_total.
Backend source:
Time to first token
Time to first token, or TTFT, is the time between a request entering the inference engine and the first output token becoming available. Hivenet Router exposes two per-agent gauges:Average TTFT
P90 TTFT
Raw TTFT histogram
For vLLM agents, Hivenet Router also exports:Do not average per-agent P90 gauges to calculate a fleet-wide P90.Use the raw histogram buckets where they are available.
- a waiting scheduler queue
- long prompt prefill
- cold model loading
- CPU-side input processing
- GPU contention
- cache pressure
- large running batches
Inter-token latency
Inter-token latency, or ITL, is the time between generated output tokens during the decode phase. Hivenet Router exposes:- vLLM
- llama.cpp
- compute saturation
- large running batches
- long contexts
- contention from other GPU workloads
- memory pressure
- backend configuration
Prompt-length histogram
vLLM supplies a histogram of prompt sizes:- prefill time
- TTFT
- KV-cache use
- memory pressure
- per-request cost
Generation-length histogram
vLLM also supplies a distribution of generated output lengths:- occupy scheduler capacity for longer
- retain KV-cache allocations
- increase output-token use
- can reduce effective concurrency
Finish reasons
vLLM reports cumulative completion counts grouped by finish reason. Hivenet Router converts changes between backend snapshots into the counter:llama.cpp token throughput
llama.cpp exposes two current throughput gauges:Generation throughput
Prompt throughput
- request sizes
- active and waiting requests
- GPU use
- context length
- batch configuration
- model quantization
Use engine metrics in routing policies
The supported engine metric gates are:Missing metrics pass
When an agent does not expose a selected field, Hivenet Router skips that gate for the agent. For example:Practical routing patterns
Avoid cache pressure
Avoid backend queues
Protect TTFT
Use a relaxed fallback
Grafana
The provisioned router dashboard includes engine panels for:- KV-cache utilization
- running and waiting requests
- preemptions
- average and P90 TTFT
- average and P90 ITL
- llama.cpp prompt and generation throughput
- the backend does not support the metric
- backend metrics are not enabled
- no observations exist yet
- the agent has not completed a successful scrape
- dashboard filters exclude the series
Alerting examples
The thresholds below are examples. Establish appropriate limits from your models, hardware, and service objectives.KV-cache pressure
Backend queue growth
TTFT degradation
vLLM preemptions increasing
Troubleshooting
No engine metrics appear
Check whether the selected engine supports metrics:- systemd
- Docker
SGLang metrics are missing
Start SGLang with:llama.cpp metrics are missing
Start llama.cpp with:Values appear stale
Check the agent logs for:TTFT or ITL is absent
The backend may not expose that metric, or it may not have recorded any observations yet. Check:- engine type
- backend metrics configuration
- whether requests have completed
- whether the expected histogram exists on the backend
Raw histogram queries are empty
The current Hivenet Router implementation re-exports raw engine histograms from vLLM. SGLang and llama.cpp currently supply scalar average and P90 values but not raw histogram series through the router. Filter for vLLM:Preemption calculations become negative
The backend cumulative value can reset when vLLM restarts. Use:Engine values exist but policy gates do not behave as expected
Check:- policy field spelling
- units
- current routing-table value
- whether the agent passes earlier routing gates
- whether the metric is missing rather than zero
- whether cached data is stale after scrape failure
Next steps
Latency tracking
Understand Hivenet Router’s RFC 6298 SRTT and RTTVAR measurements.
Hardware-aware routing
Combine engine pressure with GPU, CPU, memory, and hardware-tier policies.
Grafana dashboards
Explore the provisioned engine tables and time-series panels.

