[GH-ISSUE #2341] /metrics/prometheus gauges never decay — stale non-zero values served while server is fully idle #944

Closed
opened 2026-11-04 01:47:14 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @br00t4c on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2341

  • Engine: Strata 0.1.43.1 (endpoint :8080, /metrics/prometheus, Prometheus text format)

Description

We scrape Strata's Prometheus-format endpoint with Prometheus (15 s interval) and graph it in Grafana. While the server is completely idle, the exposition output is byte-for-byte frozen at the values from the last handled request.

Verified by scraping twice 45 seconds apart with zero traffic: identical output, including:

  • llamacpp:prompt_tokens_seconds 1408.1173761205446
  • llamacpp:predicted_tokens_seconds 58.70608143248928

…served while the server had handled no request for many minutes (requests_processing 0, requests_deferred 0).

What's fine

  • The *_total counters staying pinned is correct Prometheus counter semantics (cumulative since start) — no change wanted there.
  • rate() over them correctly yields 0 when idle.
  • requests_processing / requests_deferred correctly report 0 when idle.

The problem

  • llamacpp:prompt_tokens_seconds and llamacpp:predicted_tokens_seconds are exposed as plain gauges but hold lifetime-average throughput (tok/s). Because they never decay, the endpoint advertises e.g. "58 tok/s decode speed" indefinitely after the last request, with no timestamp or freshness signal in the text format to indicate otherwise. Any operator or alerting rule reading the raw endpoint — or any dashboard panel that plots the gauge directly instead of a rate() ratio — gets a confidently wrong "server is fast and was recently busy" signal.

Expected behavior (any of these would fix it)

  1. Decay the throughput gauges to 0 when no request has completed in the last scrape interval (or N seconds), matching what an operator means by "current speed"; or
  2. Only expose the gauges while a request is in flight / recently completed (omit the sample when stale — Prometheus treats absent series as no-data, which dashboards render as a gap); or
  3. Minimum: rename/document them as lifetime averages (e.g. ..._average_tokens_per_second_lifetime) so consumers can't mistake them for instantaneous throughput.

Environment notes

  • The metrics endpoint is served by BaseHTTP/0.6 Python/3.14.4 (HTTP/1.0 responses) — fine for Prometheus, just noting it's a separate path from the inference server.
  • llama.cpp's native /metrics exposes the same two metric names with the same lifetime-average semantics, so we understand this is partly inherited behavior — but llama.cpp also exposes per-slot KV utilization and spec_decode_* counters that give dashboards honest activity signals; Strata currently exposes neither, so these two stale gauges are the only "speed" telemetry available and their staleness is much more consequential.

Repro

  1. Start Strata, send one chat completion.
  2. Wait 5+ minutes with no traffic.
  3. curl -H "Authorization: Bearer " http://:8080/metrics/prometheus
  4. Observe llamacpp:predicted_tokens_seconds still non-zero; repeat after another 5 min — identical value.
Originally created by @br00t4c on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2341 * Engine: Strata 0.1.43.1 (endpoint :8080, /metrics/prometheus, Prometheus text format) # Description We scrape Strata's Prometheus-format endpoint with Prometheus (15 s interval) and graph it in Grafana. While the server is completely idle, the exposition output is byte-for-byte frozen at the values from the last handled request. Verified by scraping twice 45 seconds apart with zero traffic: identical output, including: * llamacpp:prompt_tokens_seconds 1408.1173761205446 * llamacpp:predicted_tokens_seconds 58.70608143248928 …served while the server had handled no request for many minutes (requests_processing 0, requests_deferred 0). # What's fine * The *_total counters staying pinned is correct Prometheus counter semantics (cumulative since start) — no change wanted there. * rate() over them correctly yields 0 when idle. * requests_processing / requests_deferred correctly report 0 when idle. # The problem * llamacpp:prompt_tokens_seconds and llamacpp:predicted_tokens_seconds are exposed as plain gauges but hold lifetime-average throughput (tok/s). Because they never decay, the endpoint advertises e.g. "58 tok/s decode speed" indefinitely after the last request, with no timestamp or freshness signal in the text format to indicate otherwise. Any operator or alerting rule reading the raw endpoint — or any dashboard panel that plots the gauge directly instead of a rate() ratio — gets a confidently wrong "server is fast and was recently busy" signal. # Expected behavior (any of these would fix it) 1. Decay the throughput gauges to 0 when no request has completed in the last scrape interval (or N seconds), matching what an operator means by "current speed"; or 2. Only expose the gauges while a request is in flight / recently completed (omit the sample when stale — Prometheus treats absent series as no-data, which dashboards render as a gap); or 3. Minimum: rename/document them as lifetime averages (e.g. ..._average_tokens_per_second_lifetime) so consumers can't mistake them for instantaneous throughput. # Environment notes * The metrics endpoint is served by BaseHTTP/0.6 Python/3.14.4 (HTTP/1.0 responses) — fine for Prometheus, just noting it's a separate path from the inference server. * llama.cpp's native /metrics exposes the same two metric names with the same lifetime-average semantics, so we understand this is partly inherited behavior — but llama.cpp also exposes per-slot KV utilization and spec_decode_* counters that give dashboards honest activity signals; Strata currently exposes neither, so these two stale gauges are the only "speed" telemetry available and their staleness is much more consequential. # Repro 1. Start Strata, send one chat completion. 2. Wait 5+ minutes with no traffic. 3. curl -H "Authorization: Bearer <key>" http://<host>:8080/metrics/prometheus 4. Observe llamacpp:predicted_tokens_seconds still non-zero; repeat after another 5 min — identical value.
Author
Owner

@Niko1221 commented on GitHub (Oct 19, 2026):

Thanks for taking the time to report this.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6270970072 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for taking the time to report this. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#944
No description provided.