docs: fix metrics endpoint description in server README (#22879)

* docs: fix metrics endpoint description in server README

Required model query parameter for router mode described.

Removed metrics:
- llamacpp:kv_cache_usage_ratio
- llamacpp:kv_cache_tokens

Added metrics:
- llamacpp:prompt_seconds_total
- llamacpp:tokens_predicted_seconds_total
- llamacpp:n_decode_total
- llamacpp:n_busy_slots_per_decode

* server: fix metrics type for n_busy_slots_per_decode metric
This commit is contained in:
willjoha
2026-05-11 18:32:26 +02:00
committed by GitHub
parent 68e7ea3eab
commit ef22b3e4ac
2 changed files with 21 additions and 14 deletions
+17 -10
View File
@@ -1043,16 +1043,23 @@ If query param `?fail_on_no_slot=1` is set, this endpoint will respond with stat
This endpoint is only accessible if `--metrics` is set. This endpoint is only accessible if `--metrics` is set.
Available metrics: In *router mode* the query param `?model={model_id}` has to be set. This endpoint will respond with status code 400 `model name is missing from the request` if not set.
- `llamacpp:prompt_tokens_total`: Number of prompt tokens processed.
- `llamacpp:tokens_predicted_total`: Number of generation tokens processed. #### Available metrics
- `llamacpp:prompt_tokens_seconds`: Average prompt throughput in tokens/s.
- `llamacpp:predicted_tokens_seconds`: Average generation throughput in tokens/s. | Metric | Type | Description |
- `llamacpp:kv_cache_usage_ratio`: KV-cache usage. `1` means 100 percent usage. | ------ | ---------------------- | ----------- |
- `llamacpp:kv_cache_tokens`: KV-cache tokens. | `llamacpp:prompt_tokens_total` | Counter | Number of prompt tokens processed. |
- `llamacpp:requests_processing`: Number of requests processing. | `llamacpp:prompt_seconds_total` | Counter | Prompt process time in seconds. |
- `llamacpp:requests_deferred`: Number of requests deferred. | `llamacpp:prompt_tokens_seconds` | Gauge | Average prompt throughput in tokens/s. |
- `llamacpp:n_tokens_max`: High watermark of the context size observed. | `llamacpp:tokens_predicted_total` | Counter | Number of generation tokens processed. |
| `llamacpp:tokens_predicted_seconds_total` | Counter | Predict process time in seconds. |
| `llamacpp:predicted_tokens_seconds` | Gauge | Average generation throughput in tokens/s. |
| `llamacpp:requests_processing` | Gauge | Number of requests processing. |
| `llamacpp:requests_deferred` | Gauge | Number of requests deferred. |
| `llamacpp:n_tokens_max` | Counter | High watermark of the context size observed. |
| `llamacpp:n_decode_total` | Counter | Total Number of llama_decode() calls. |
| `llamacpp:n_busy_slots_per_decode` | Gauge | Average number of busy slots per llama_decode() call. |
### POST `/slots/{id_slot}?action=save`: Save the prompt cache of the specified slot to a file. ### POST `/slots/{id_slot}?action=save`: Save the prompt cache of the specified slot to a file.
+4 -4
View File
@@ -3622,10 +3622,6 @@ void server_routes::init_routes() {
{"name", "n_tokens_max"}, {"name", "n_tokens_max"},
{"help", "Largest observed n_tokens."}, {"help", "Largest observed n_tokens."},
{"value", res_task->n_tokens_max} {"value", res_task->n_tokens_max}
}, {
{"name", "n_busy_slots_per_decode"},
{"help", "Average number of busy slots per llama_decode() call"},
{"value", (float) res_task->n_busy_slots_total / std::max((float) res_task->n_decode_total, 1.f)}
}}}, }}},
{"gauge", {{ {"gauge", {{
{"name", "prompt_tokens_seconds"}, {"name", "prompt_tokens_seconds"},
@@ -3643,6 +3639,10 @@ void server_routes::init_routes() {
{"name", "requests_deferred"}, {"name", "requests_deferred"},
{"help", "Number of requests deferred."}, {"help", "Number of requests deferred."},
{"value", (uint64_t) res_task->n_tasks_deferred} {"value", (uint64_t) res_task->n_tasks_deferred}
},{
{"name", "n_busy_slots_per_decode"},
{"help", "Average number of busy slots per llama_decode() call"},
{"value", (float) res_task->n_busy_slots_total / std::max((float) res_task->n_decode_total, 1.f)}
}}} }}}
}; };