Metrics

Prometheus metrics, and a ready-made Grafana dashboard.

Hald serves Prometheus metrics at /metrics. The metrics never hold the text of a request or a reply.

Prometheus

Add Hald to prometheus.yml:

scrape_configs:
  - job_name: hald
    scrape_interval: 5s
    static_configs:
      - targets: ["SPARK:8888"]

Grafana

  1. Download hald.json.
  2. In Grafana, go to Dashboards → New → Import.
  3. Upload the file, and choose your Prometheus data source.

The dashboard shows requests, tokens per second, time per token, waiting times, prompt reuse, draft acceptance, the prompt cache and memory.

The metrics

All names start with hald_. Most have a model label.

MetricTypeWhat it counts
requests_totalcounterFinished requests, by outcome.
requestsgaugeRunning requests, by state.
prompt_tokens_totalcounterPrompt tokens.
reused_tokens_totalcounterPrompt tokens reused from earlier prompts.
generated_tokens_totalcounterGenerated tokens.
draft_tokens_totalcounterDrafted tokens checked by the model.
draft_accepted_tokens_totalcounterDrafted tokens the model accepted.
request_secondshistogramTime from start to end of a request.
queue_secondshistogramTime a request waited for its turn.
prompt_secondshistogramTime to process the prompt.
time_per_output_token_secondshistogramTime per generated token.
load_secondshistogramTime a request waited for its model to load.
cache_hits_total, cache_misses_totalcounterPrompt cache lookups.
cache_used_bytes, cache_free_bytesgaugePrompt cache use.
device_memory_allocated_bytesgaugeGPU memory that Hald uses.
model_memory_bytesgaugeGPU memory of each model, by part.
model_stategaugeWhether a model is loaded.
arena_bytes, arena_free_bytesgaugeThe shared KV arena.

Open /metrics to see all metrics, with a help text for each.

Turn it off

Set metrics = "" in the http block. See Configuration.