Skip to main content
Hivenet Router agents collect operational metrics from supported inference engines and send them to the router. These metrics describe the state of the backend scheduler and model-serving process, including:
  • 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
The router exposes the latest values through Prometheus. A subset is also available through the administration routing table.
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:
  1. requests the backend’s /metrics endpoint
  2. extracts the metrics Hivenet Router understands
  3. caches the latest successful snapshot
  4. sends that snapshot through routing signals and heartbeats
  5. continues serving requests when a metrics scrape fails
The router:
  1. stores the current engine snapshot
  2. exposes scalar values through /admin/routing-table
  3. publishes Prometheus gauges, counters, and histograms
  4. makes supported scalar fields available to routing-policy gates
Prometheus scrapes the router rather than every inference host.

Collection interval

The default engine scrape interval is:
Change it on the agent:
Each scrape has a five-second timeout. The default routing-signal interval is also:
This lets a newly collected snapshot reach the router without an additional heartbeat delay. If the routing-signal interval is shorter than the engine scrape interval, the agent may send the same cached snapshot more than once.

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
The warning resembles:
A previously reported metric may remain at its last successful value while scraping is failing.The current metric set does not include a dedicated engine-snapshot age gauge. Correlate suspicious values with agent logs, backend health, and heartbeat freshness.
A metric that an engine has never reported is absent rather than emitted as zero. When an agent disconnects and is removed from the router, Hivenet Router removes its engine series.

Engine support

The current implementation collects engine metrics from:
  • vLLM
  • SGLang
  • llama.cpp
The following integrations do not currently provide engine-specific metrics:
  • Ollama
  • Infinity
  • custom engines
They still report Hivenet Router request history, latency, capacity, and available host hardware metrics.

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 exposes its Prometheus endpoint without an additional Hivenet Router-specific flag.Check it:
A missing or disabled backend metrics endpoint does not prevent the agent from registering and forwarding requests.

Prometheus labels

Engine metrics use:
as their common labels. For example:
These labels let you compare values by:
  • agent
  • model
  • engine
  • organization
  • machine
Keep agent metadata stable to avoid unnecessary time-series cardinality.

View the current engine snapshot

Use the administration routing table:
A vLLM agent may resemble:
The values above are examples. The 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

KV-cache utilization is the fraction of the engine’s preallocated KV or token cache currently in use. The range is:
Backend sources are: View current cache use:
Find agents above 85%:
Average by model and engine:
High cache utilization can lead to:
  • request preemption
  • recomputation
  • latency spikes
  • reduced throughput
  • backend instability under additional load
The operational meaning of a particular value depends on the engine, model, context lengths, scheduler, and workload. Avoid treating one threshold as universal across every deployment.

Running requests

This is the number of requests currently being processed by the inference engine. Backend sources are: View running requests:
Total by model:
Running requests describe the engine scheduler. They are not necessarily identical to the Hivenet Router agent’s:
The two values are observed at different layers and times. For example:
  • 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

Waiting requests are queued inside the inference-engine scheduler. Backend sources are: View backend queues:
Find agents with queued requests:
Total waiting work by model:
A growing waiting count normally means the backend has accepted more work than it can process immediately. This can increase:
  • time to first token
  • request latency
  • timeout risk
  • cache pressure
It is separate from Hivenet Router’s per-model capacity wait queue. One queue lives inside the inference engine; the other lives in the router before an agent is selected.

Preemptions

vLLM reports a cumulative count of requests preempted because of scheduler and KV-cache pressure. Hivenet Router exports the backend’s latest cumulative value as a Prometheus gauge, even though its name ends in _total. Backend source:
View the current cumulative value:
Detect growth over a period:
Show increases by agent:
Treat this metric as a gauge containing the backend’s latest cumulative value.It may fall when vLLM restarts. Ordinary counter assumptions do not fully apply.
A rising value together with high KV-cache utilization is evidence of cache pressure.

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:
Both are measured in seconds.

Average TTFT

This is calculated from the backend histogram’s cumulative sum and count.

P90 TTFT

The agent estimates this value from the backend histogram buckets. Hivenet Router keeps it as a scalar because routing policies need to read a current value directly during agent selection.

Raw TTFT histogram

For vLLM agents, Hivenet Router also exports:
Prometheus exposes:
Fleet-wide P90 for vLLM:
P90 by model:
Do not average per-agent P90 gauges to calculate a fleet-wide P90.Use the raw histogram buckets where they are available.
High TTFT can result from:
  • a waiting scheduler queue
  • long prompt prefill
  • cold model loading
  • CPU-side input processing
  • GPU contention
  • cache pressure
  • large running batches
Establish a baseline for each model and workload rather than copying a generic target.

Inter-token latency

Inter-token latency, or ITL, is the time between generated output tokens during the decode phase. Hivenet Router exposes:
for:
  • vLLM
  • llama.cpp
SGLang does not currently supply ITL through this integration. Average ITL:
P90 ITL:
For vLLM, Hivenet Router also exports the raw histogram:
Fleet-wide vLLM P90:
High ITL can make streamed output feel slow or uneven. Possible causes include:
  • 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:
Prometheus exposes:
P50 prompt length:
P90 by model:
Long prompts can increase:
  • prefill time
  • TTFT
  • KV-cache use
  • memory pressure
  • per-request cost

Generation-length histogram

vLLM also supplies a distribution of generated output lengths:
P90 generation length:
Long generations:
  • occupy scheduler capacity for longer
  • retain KV-cache allocations
  • increase output-token use
  • can reduce effective concurrency
Use prompt and generation histograms together to understand the shape of the workload rather than relying only on request counts.

Finish reasons

vLLM reports cumulative completion counts grouped by finish reason. Hivenet Router converts changes between backend snapshots into the counter:
Additional label:
Common values include:
Completion rate by reason:
Length-limited completions:
Aborted completions:
Unlike the preemption gauge, this is a Hivenet Router Prometheus counter. The first snapshot establishes a baseline. Hivenet Router counts changes observed after it begins tracking that agent rather than importing the engine’s complete earlier lifetime count. If the backend count decreases after a restart, Hivenet Router treats the new value as post-restart activity.

llama.cpp token throughput

llama.cpp exposes two current throughput gauges:

Generation throughput

This is the backend’s recent generated-token rate.
Average by model:

Prompt throughput

This is the backend’s recent prompt-ingestion rate.
These values are currently available through Prometheus but not through the administration routing-table response. A falling throughput value can indicate contention or a changed workload, but interpret it alongside:
  • 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:
For example:
Preemptions, finish reasons, request-shape histograms, and token-throughput values are available for monitoring but are not current policy-gate fields.

Missing metrics pass

When an agent does not expose a selected field, Hivenet Router skips that gate for the agent. For example:
does not exclude an SGLang agent because SGLang does not report ITL through this integration.
Combine engine-specific gates with a static engine or metadata match when the metric must be present.Missing data does not fail the gate.

Practical routing patterns

Avoid cache pressure

Avoid backend queues

Protect TTFT

Use a relaxed fallback

This lets Hivenet Router prefer low-pressure agents while retaining a controlled local fallback under heavier load.

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
Blank values may mean:
  • 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
See Grafana dashboards for provisioning and dashboard behavior.

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:
Then check the backend directly:
Inspect the agent logs:

SGLang metrics are missing

Start SGLang with:
Restart SGLang, then check:

llama.cpp metrics are missing

Start llama.cpp with:
Restart the server, then check:

Values appear stale

Check the agent logs for:
Test the backend metrics endpoint locally. The agent deliberately retains its latest successful snapshot during a scrape failure. Restarting the agent clears its local cache, but the better fix is to restore the backend metrics endpoint.

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
SGLang does not provide ITL through the current integration.

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:
rather than treating the series as a normal Prometheus counter.

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
Policy utilization fields use fractions rather than percentages.

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.