Skip to content

fix(monitoring): follow the step in AI request and token panels #5922

Open

Description

@dan-petty

Update 2026-11-26 (infra move): tests/prometheus/test_k8s_monitoring_dashboards.py is gone (#7234). The dashboard cases run in tests/prometheus/test_dashboard_queries.py.


Split from #4724. The pull request of #4724 changes only the spend panels of k8s/devops/dashboards/ai-spend.json. These parts of #4724 stay open:

Problem

  • Token Processing Rate (tokens/sec) and Request Rate by Model use rate(...[5m]) on the sparse OTLP counters devops_cli_ai_tokens_total and devops_cli_ai_requests_total. A Job pod sends about 6 samples for each series in 6 h, so a 5 min window holds 0 or 1 sample. At 7 d the panels show 37 % of the requests and 42 % of the tokens (measure of fix(monitoring): read AI spend from the gateway counter #4724). Their rolling lines use fixed [30m] windows.
  • Response Cache Hit Share, Gateway Attempts by Status and Gateway Requests and Tokens by Caller use rolling [1h] windows at steps under 1 h, so the points overlap.
  • Ollama Slot Wait by Priority (p95) has no series in 30 d (query of 2026-11-16: count by (priority, outcome) (last_over_time(devops_cli_ai_ollama_slot_wait_seconds[30d])) is empty).
  • k8s/devops/dashboards/devops-ai-rag.json has the same spend defect: AI Spend in Range and AI Spend Rate by Server ($/hr) read devops_cli_ai_spend_usd_total with rate(...[5m]).

Expected behavior

Acceptance criteria

  • tests/fixtures/dashboard_queries/ai-spend.yaml holds a bars case for the request and token panels, and the bars add up to the fixture total within 1 %.
  • Live at 7 d: the request bars add up to at least 95 % of sum(increase(devops_cli_ai_requests_total[7d])).
  • tests/prometheus/test_dashboard_queries.py passes.

Source: #4724

Alternatives check of 2026-11-24: none.
Tool: none found.
Reason: Searches found only PromQL linters and dashboard generators; none rewrites panel queries or handles sparse counters, so the fix stays in the dashboard JSON with increase(...[$__interval]), a 1 h Min step and the repo's fixture test.

Lacks:

  • No tool rewrites rate() windows inside panel JSON
  • No handling of counters with one sample per hour
  • No switch to gateway series or drop of slot-wait panel
  • No fixture test that bar totals add up

Activity

  1. added
    type/bug
    source/agent
    status/new
    value/medium
    effort/medium
    scope/monitoring
    on Nov 16, 2026
  2. dan-petty commented on Nov 16, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 16, 2026
  4. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (7)

    Tools considered:

    Searches run:

    • Grafana dashboard linter validate PromQL queries JSON, results: 5
    • promtool test rules unit test PromQL increase query fixture yaml, results: 5
    • dashboard-linter rules list grafana/dashboard-linter docs, results: 5
    • cloudflare pint lint Grafana dashboard json support promql checks, results: 5
    • pint prometheus linter promql/rate promql/series checks, results: 5
    • tool to test Grafana dashboard panel queries against synthetic Prometheus data, results: 5
    • dashboard-linter target-rate-interval-rule rate_interval rate irate increase, results: 5

    Sources:

  5. devops-cli-service commented on Nov 24, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: partly, tool https://github.com/grafana/dashboard-linter. A person decides what the new result means for the item.

    Searches (6)

    Tools considered:

    Searches run:

    • open source tool lint Grafana dashboard PromQL queries rate window too short, results: 5
    • Grafana dashboard PromQL rate on sparse counters increase $__interval min step 1h, results: 5
    • litellm prometheus grafana dashboard template, results: 5
    • cloudflare pint promql linter dashboard, results: 5
    • github cloudflare pint promql, results: 5
    • prometheus promql increase sparse samples last_over_time, results: 5

    Sources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/monitoringsource/agentstatus/newtype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions