Skip to content

feat(k8s): llm gateway, otel collector and prometheus dashboards over metrics the cluster collects (k8s/monitoring/dashboards/) #693

Closed

Description

@dan-petty

Context & Rationale

The item asked for ten new dashboards, one per stack. Checked against the code, much of that work already exists, has no metrics behind it, or targets components that have been removed. The two stack dashboards we already ship also contain panels that can never have data, and some of those show a false zero instead of "no data".

What exists. k8s/monitoring/dashboards/ holds eight dashboards:

  • Four cluster views (k8s-views-global/namespaces/nodes/pods.json). The same four are also packaged, with the same uids, as two ConfigMaps labelled grafana_dashboard: '1' (k8s/monitoring/k8s-global-dashboards-configmap.yaml, k8s/monitoring/k8s-node-dashboards-configmap.yaml). Grafana's sidecar loads those ConfigMaps (k8s/monitoring/grafana-values.yaml:85-92).
  • Two devops-cli telemetry dashboards (devops-cli.json, ai-spend.json). These are owned by feat(cli): devops-cli dashboards chart the metrics the cli sends and the grafana sidecar provisions them #692.
  • Two stack dashboards:
    • llm-stack.json, titled "LLM & Vector Stack": gateway, vLLM, GPUs and Qdrant;
    • otel-collector.json, titled "OpenTelemetry & Jaeger Traces": two collector panels and no Jaeger panel.

Grafana also provisions two dashboards from grafana.com, Node Exporter Full and NVIDIA DCGM (grafana-values.yaml:74-83). devops grafana dashboards sync pushes every *.json file in the directory (src/devops_cli/commands/grafana.py:226-281; the directory is set at src/devops_cli/config/defaults.py:61). devops grafana dashboards lint checks those files in CI (tests/test_grafana_dashboards.py:190-200).

How objects reach the cluster. devops k8s deploy-stack installs the Helm releases. Besides those, it applies only two things:

  • k8s/kustomization.yaml, which holds namespaces, cloudflared and the registry;
  • the files in _MANIFESTS_BY_STACK (src/devops_cli/commands/k8s/stack_lifecycle.py:130-145, 740).

It never applies k8s/monitoring/kustomization.yaml. That file holds the monitoring NetworkPolicy, the service aliases and both dashboard ConfigMaps (k8s/monitoring/kustomization.yaml:4-9). They reach a cluster only by hand, or through ArgoCD, whose paths are broken (#755). Nobody has checked whether they exist on the homelab.

deploy-stack also installs every chart without --version (stack_lifecycle.py:492-513). Chart versions cited below are therefore the locally cached charts, not necessarily what is deployed.

What is collected. Prometheus gets its series in two ways.

  1. Alloy (k8s-monitoring) remote-writes to the server (k8s/monitoring/k8s-monitoring-values.yaml:9-12). It sends:
    • kubelet, cAdvisor, kube-state-metrics and node-exporter series, filtered by the chart's default allow lists plus the additions at lines 18-50;

    • targets named by a ServiceMonitor (lines 60-62). Today there are two:

      • the llm-gateway monitor (lines 126-142), which reads LiteLLM's Prometheus callback (k8s/llm/gateway/configmap.yaml:164);
      • dcgm-exporter's own monitor (k8s/monitoring/dcgm-exporter-values.yaml:42-45).

      Of the synthetic per-scrape series, Alloy forwards only up and scrape_samples_scraped for these targets (cached k8s-monitoring 4.5.2, feature-prometheus-operator-objects/templates/_service_monitors.alloy.tpl:61);

    • anything remote-written to Alloy's receiver (lines 64-66). This is where the collector sends devops-cli's OTLP metrics (k8s/otel/values.yaml:79-84).

  2. The server scrapes directly, using the chart's default jobs. k8s/monitoring/prometheus-values.yaml:40-69 leaves all of them on except kubernetes-nodes and kubernetes-nodes-cadvisor (lines 41-44). That leaves:
    • prometheus, which scrapes the server itself at localhost:9090 (cached chart 29.35.0, values.yaml:815-821);
    • kubernetes-api-servers;
    • kubernetes-pods(-slow) and kubernetes-service-endpoints(-slow), which scrape any pod or Service annotated prometheus.io/scrape: "true" (chart values.yaml:873-1051). Nothing under k8s/ sets that annotation (rg -n prometheus.io k8s/ finds nothing). So these two jobs only pick up objects that other charts, or k3s itself, annotate. Only the cluster can say which objects those are.

What nothing in k8s/ scrapes. None of these has a ServiceMonitor or a scrape annotation in the repo:

  • ArgoCD: k8s/argocd/values.yaml sets no metrics keys.
  • CoreDNS: Alloy's clusterMetrics.kubeDNS is off by default. k3s's own kube-dns Service may carry scrape annotations (unverified). If it does, kubernetes-service-endpoints scrapes it, unless the monitoring NetworkPolicy is applied: that policy's kube-system egress leaves out port 9153 (k8s/monitoring/networkpolicy.yaml:68-90).
  • Loki: self-monitoring is off (k8s/logging/loki-values.yaml:46-50).
  • The registry: no debug metrics address is configured (k8s/registry/deployment.yaml:27-33).
  • Jaeger: no metrics port is declared or admitted (k8s/otel/jaeger.yaml:50-61). Jaeger v2 may still serve internal metrics on 8888, but nothing scrapes it.
  • Portkey and Valkey.
  • Ollama, which exports no metrics at all (k8s/llm/gateway/configmap.yaml:162-163).
  • Qdrant and the OTel collector: see below.

What is wrong.

  • vLLM panels with no source. These parts of llm-stack.json chart vLLM:

    • panel 3 (lines 74-131);
    • panel 8 (lines 289-345);
    • row 9 with panels 10 and 11 (lines 346-463);
    • the vllm tag (line 777).

    fdd4d0f (feat(k8s): modernize monitoring stack, llm profiles, traefik routing, and remove squid proxy #734) deleted the vLLM profiles (k8s/llm/profiles/vllm-profiles.yaml). Only the ollama-*gib Services remain (k8s/llm/profiles/services.yaml).

  • Scrape jobs lost in feat(k8s): modernize monitoring stack, llm profiles, traefik routing, and remove squid proxy #734, hidden by a false zero.

    • fdd4d0f deleted the kube-prometheus-stack values that held the static qdrant and otel-collector scrape jobs (git show fdd4d0f^:k8s/monitoring/prometheus-values.yaml, lines 29-35).
    • Nothing replaced them. Neither k8s/llm/values-qdrant.yaml nor k8s/otel/values.yaml turns on a ServiceMonitor or a scrape annotation, and both charts leave the monitor off by default.
    • Every query in the Qdrant row of llm-stack.json (lines 669-769, queries at 720 and 764) and in otel-collector.json (lines 36 and 59) ends in or vector(0). So these panels show a flat 0 instead of "no data".

    The collector carries devops-cli's own metrics, so a broken export currently looks like a quiet system.

  • Unchecked names and labels. The existing guard test only checks names with a vllm:, litellm_ or DCGM_FI_ prefix (tests/test_llm_pool_metrics.py:51, 58-68). So the Qdrant and collector names were never compared with anything an exporter serves. The test checks no labels at all, and it requires at least one vLLM series to be present (line 66).

  • Failover is invisible. When a backend fails, the pool relies on the gateway's retries, cooldowns and fallbacks (k8s/llm/gateway/configmap.yaml:168-187). No panel shows any of them.

  • Wrong titles.

    • With vLLM and Qdrant gone, the "LLM & Vector Stack" title (llm-stack.json:796) no longer fits.
    • "OpenTelemetry & Jaeger Traces" (otel-collector.json:73, tag at line 69) has no Jaeger panel.
  • Stale plan. The request still names Squid, LightLLM with TokenAttention, vLLM's KV cache and tensor parallelism, AWQ, and SLO alerts. Two documents repeat that plan and rate it P0, matching the issue's priority/p0-critical label:

    • the task file, docs/agent/tasks/task-693-turnkey-kubernetes-stacks-grafana-observability-dashboard-su.md;
    • docs/ROADMAP.md, lines 665-678 and row 1431.

This item makes three stack dashboards query only series the cluster collects: llm-stack.json, otel-collector.json and a new prometheus-server.json. Their metric names and labels are checked against captures from the deployed exporters. The item also restores the collector's scrape and adds gateway routing and failover panels. Other stacks get dashboards once they have metrics (#551 and the split-offs).

Scope & Deliverables

  • Deliverable:
    • llm-stack.json (uid stays devops-llm-stack; the title becomes "LLM Gateway & GPUs"):

      • Delete:

        • panels 3 and 8;
        • row 9 with panels 10 and 11;
        • the Qdrant row 17 with panels 18 and 19;
        • the vllm and qdrant tags (lines 777 and 780).
      • In the Latency row, put "Time to first token p95 per deployment" where panel 8 was.

      • Add a "Routing and failover" row with these panels:

        • requests per virtual model;
        • responses by status code;
        • output tokens per second per model;
        • cooldowns per deployment;
        • successful and failed fallbacks per model pair.
      • Every new panel reads LiteLLM's Prometheus callback through the llm-gateway ServiceMonitor. LiteLLM documents the series as:

        • litellm_proxy_total_requests_metric_total, with labels including requested_model and status_code;
        • litellm_output_tokens_metric_total;
        • litellm_deployment_cooled_down_total;
        • litellm_deployment_successful_fallbacks_total and litellm_deployment_failed_fallbacks_total, with labels including requested_model and fallback_model;
        • litellm_llm_api_time_to_first_token_metric_bucket.

        Panels use only the names and labels that appear in the capture from the deployed gateway (ghcr.io/berriai/litellm:v1.103.0, k8s/llm/gateway/deployment.yaml:32).

    • OTel collector:

      • In k8s/otel/values.yaml, add podAnnotations prometheus.io/scrape: "true" and prometheus.io/port: "8888". The server's kubernetes-pods job then scrapes the collector's own telemetry, which is already served on 8888 (the port is enabled at values.yaml:111-113).
      • In otel-collector.json (uid stays devops-otel-traces; the title becomes "OpenTelemetry Collector"; the jaeger tag goes), replace both queries and build these panels from the collector's internal metrics, as captured from 0.159.0 (values.yaml:9):
        • spans accepted and refused, per receiver;
        • metric points accepted and refused, per receiver;
        • spans and metric points sent and failed, per exporter (otlp_grpc/jaeger, prometheusremotewrite);
        • exporter queue size against capacity;
        • process memory against the memory_limiter limit of 400 MiB (values.yaml:53-56).
    • New prometheus-server.json (uid devops-prometheus-server, title "Prometheus Server"), built over the server's job="prometheus" self-scrape and over up. Panels:

      • targets up against total, by job (sum by (job) (up), count by (job) (up)). This covers both the server's own jobs and the up series Alloy forwards;
      • scrape duration by job (scrape_duration_seconds; the server's own jobs only);
      • head series and head chunks (prometheus_tsdb_head_series, prometheus_tsdb_head_chunks), and samples appended per second;
      • remote-write requests received, by status code (prometheus_http_requests_total{handler="/api/v1/write"}). This is how Alloy delivers every series listed above;
      • query duration (prometheus_engine_query_duration_seconds);
      • compactions per hour, failed compactions, and compaction p95 duration over 6h, plus WAL fsync time;
      • TSDB size (prometheus_tsdb_storage_blocks_bytes + prometheus_tsdb_wal_storage_size_bytes), with a threshold at the volume's 20 GiB (prometheus-values.yaml:22);
      • resident memory against the 2048Mi limit (prometheus-values.yaml:17).
    • prometheus-values.yaml: set scrapeConfigs.prometheus.enabled: true and scrapeConfigs.kubernetes-pods.enabled: true explicitly. These dashboards now depend on those jobs, and deploy-stack doesn't pin the chart version that supplies their defaults.

    • PromQL helpers. Add two pure functions to src/devops_cli/prometheus/promql.py, each with its own unit tests. Both reuse _strip_strings (line 51).

      • selectors(expr) returns every series selector as its metric name plus the label names its matchers use, including {__name__="..."}. It skips:
        • function and aggregation names;
        • keywords: by, without, on, ignoring, group_left, group_right, bool, offset, and, or, unless;
        • label lists, string contents, numbers and durations.
      • grouping_labels(expr) returns the labels named in by, without, on, ignoring, group_left and group_right.
    • Captures. Commit one file per exporter under tests/fixtures/metrics/: LiteLLM, DCGM, the collector and the Prometheus server. Each file records:

      • where it was taken and from which image or chart version;
      • every family's name exactly as its # TYPE line prints it, in the plain text format (curl, not OpenMetrics);
      • each family's type and label names, never label values;
      • the target labels that the scrape path adds, such as job, instance, namespace, pod and cluster.

      A histogram or summary family also allows its _bucket, _sum and _count series and its le or quantile label.

    • New test, tests/test_stack_dashboards.py. It is parametrized over the three dashboards and their exporters:

      • llm-stack.json: LiteLLM and DCGM;
      • otel-collector.json: the collector;
      • prometheus-server.json: the Prometheus server.

      For each dashboard it checks that:

      • every selector's metric is in the union of that dashboard's captures, or in the synthetic set up, scrape_duration_seconds, scrape_samples_scraped, scrape_samples_post_metric_relabeling and scrape_series_added;
      • every matcher label is on its own metric, or is a target label;
      • every grouping label is on at least one metric in the same expression, or is a target label;
      • no expression contains or vector(;
      • each exporter's scrape is defined in k8s/:
        • the llm-gateway ServiceMonitor;
        • serviceMonitor.enabled in the DCGM values;
        • the collector's two pod annotations;
        • scrapeConfigs.prometheus.enabled and scrapeConfigs.kubernetes-pods.enabled set to true.

      Remove EXPOSED, _EXPORTED_NAME and the old dashboard test from tests/test_llm_pool_metrics.py (lines 31-51 and 58-68).

    • Docs.

  • Acceptance criteria:
    • rg -n -i "vllm|qdrant" k8s/monitoring/dashboards/llm-stack.json prints nothing.

    • rg -n -F "or vector(" k8s/monitoring/dashboards/llm-stack.json k8s/monitoring/dashboards/otel-collector.json k8s/monitoring/dashboards/prometheus-server.json prints nothing.

    • Both edited dashboards keep their uids and carry the new titles. otel-collector.json has no jaeger tag.

    • The unit tests for selectors and grouping_labels cover:

      • aggregations with and without by;
      • binary operations with on (...) group_left (...);
      • histogram_quantile;
      • offset;
      • a regex matcher whose value contains braces;
      • {__name__="x"};
      • vector(0).

      They also show that function names, keywords, label names and durations are never returned as metrics.

    • tests/test_stack_dashboards.py passes. Each of these mutations makes it fail, each in its own test:

      • a query that names a series missing from the capture;
      • a by (...) label that no metric in the expression carries;
      • an added or vector(0);
      • collector values without the scrape annotations;
      • prometheus-values.yaml without scrapeConfigs.prometheus.enabled: true.
    • The tests read files only and never touch the network.

    • devops grafana dashboards lint k8s/monitoring/dashboards reports no errors.

    • On the homelab, after devops k8s deploy-stack --stack infra and devops grafana dashboards sync:

      • devops prometheus query 'up{namespace="otel"}' returns 1 for the collector pod.
      • Every panel expression in the three dashboards returns at least one series through devops prometheus query, with two qualifications:
        • The TTFT panel is checked after one streamed chat request through the gateway. devops-cli's OpenAI-compatible client streams (src/devops_cli/ai/client/openai.py:192).
        • Panels whose families are listed as from_source (see the key questions) are exempt, and the task file names them.
    • Besides those results, the task file records:

      • the chart versions from helm list -A;
      • whether monitoring-default-perimeter, grafana-k8s-global-dashboards and grafana-k8s-node-dashboards exist;
      • whether the servicemonitors.monitoring.coreos.com CRD exists;
      • the output of count by (job, namespace) (up).
    • uv run devops ci passes.

  • Key questions:
    • Which stacks exist under k8s/ today?

      • The stacks are argocd, cloudflared, coredns (k3s resource limits only), gpu-feature-discovery, ingress (Traefik), llm, logging (Loki, Fluent Bit), monitoring (k8s-monitoring/Alloy, Prometheus, Grafana, DCGM), otel (collector, Jaeger) and registry.
      • The llm stack holds the LiteLLM gateway, the Ollama VRAM-tier DaemonSets, Portkey, Valkey, Open WebUI and Qdrant.
      • There is no squid, vllm or lightllm stack.
    • Which of the ten requested dashboards does this item build? (proposed)

      • 1 and 2: the parts that have a data source, in llm-stack.json.
      • 7: as prometheus-server.json.
      • 8: as otel-collector.json.
      • 5: the core already exists (the GPU row and NVIDIA DCGM 12239). Throttling, power limit, PCIe, SM occupancy and GPU allocation are a split-off.
      • 3, 6 and 9: they wait for their exporters (Metrics for the rest of the platform #551).
      • 4 (CoreDNS): a split-off.
      • 10 (Squid): dropped.
    • Should llm-stack.json be split into k8s-llm-mesh.json and k8s-ai-gateway.json? No (proposed). With vLLM gone, both files would chart the same LiteLLM series. Keeping the file and its uid also keeps existing links working.

    • How is the collector scraped? By pod annotation, through the server's kubernetes-pods job, not by a ServiceMonitor (proposed). Three reasons:

      • It doesn't go through Alloy. The collector exports its metrics to Alloy (k8s/otel/values.yaml:79-80). If Alloy is what fails, an Alloy-scraped collector goes dark with it. Its send_failed counters, the panel that should show the failure, would go dark too.
      • It needs no monitoring.coreos.com CRDs. Nothing has installed them since feat(k8s): modernize monitoring stack, llm profiles, traefik routing, and remove squid proxy #734 (see the CRD split-off). The chart's ServiceMonitor template has no capability guard (cached opentelemetry-collector 0.174.0, templates/servicemonitor.yaml:1). On a cluster without the CRDs, a monitor would fail the whole release.
      • It is already allowed and labelled. The monitoring policy allows egress to otel:8888 (networkpolicy.yaml:106-112), and no policy selects the collector pods (k8s/otel/networkpolicy.yaml:10-12). The job also adds cluster (prometheus-values.yaml:50-54).

      A ServiceMonitor would match the llm-gateway and DCGM monitors, but it loses on the first two points. fix(k8s): restore kubernetes cpu metrics and align monitoring dashboards to homelab-k3s #737 doesn't settle the question: it disabled only the two node jobs and added the cluster label to the rest.

    • How are names and labels captured? Once, from each deployed exporter on the homelab (proposed):

      • the gateway's /metrics/;
      • the collector's port 8888;
      • the Prometheus server's /metrics;
      • one dcgm-exporter pod.

      Only names, types and label names are committed. A family missing from the capture gets no panel, and the task file notes it. There is one exception: a family the exporter's source defines at the deployed version, but that only appears after its first event. Two cases:

      • LiteLLM's cooldown and fallback counters. prometheus_client prints their # TYPE line but no samples, so their labels can't be read from the capture.
      • Collector counters the OTel SDK hasn't recorded yet.

      Such a family is listed as from_source, citing the source file at that tag, and its panel is exempt from the live-data check.

    • What if a metric lacks the label a panel groups by (for example, TTFT without api_base)? The test fails. The panel then groups by labels the metric does have (for example model), and the task file says so (proposed).

    • Why doesn't the label check tie each by label to its exact operand? That would need a full PromQL parser. Checking against the labels of every metric in the expression already catches a label that no metric carries, which is how a wrong grouping silently collapses into one series (proposed). It won't catch a label that exists only on the other side of a join.

    • Why no PVC-usage panel from kubelet_volume_stats_*? The Prometheus PVC uses local-path (prometheus-values.yaml:21), which provisions hostPath volumes, and the kubelet probably reports no volume stats for those. The TSDB's own size metrics measure the same thing from a source that exists. For information only, the task file records whether kubelet_volume_stats_capacity_bytes{persistentvolumeclaim=~".*prometheus.*"} returns data.

    • Why does the test cover only these three dashboards?

    • What happens to the Qdrant row? It is removed now (proposed). Restoring it needs an authenticated scrape (split-off).

    • Who packages dashboards as ConfigMaps? feat(cli): devops-cli dashboards chart the metrics the cli sends and the grafana sidecar provisions them #692 (proposed).

    • Who builds the ArgoCD, Loki and registry dashboards? Whoever adds each exporter, under Metrics for the rest of the platform #551 (proposed). Metrics for the rest of the platform #551 currently promises dashboards only for ArgoCD sync and health, tunnel health, and cache and proxy errors. Its body is also stale: it says Prometheus scrapes Qdrant and the collector, and it still lists squid. It needs refreshing, but that isn't part of this item.

    • SLO alerts? None in this item. Alertmanager is disabled (prometheus-values.yaml:28-29) and no alert rules exist. Alerts fire into nothing: no Alertmanager, and k3s false positives #549 owns alerting.

    • Should panels filter on cluster? No (proposed). job="prometheus" series carry no cluster label, because the relabel rules apply only to the kubernetes-* jobs (prometheus-values.yaml:45-69).

    • Priority? P2 (proposed). This is a feature that restores lost observability, not a critical fix. When this refinement is applied, the issue's priority/p0-critical label becomes priority/p2-medium, and the ROADMAP and the task file say P2.

  • Constraint:

Strategic Alignment

Activity

  1. added this to the v0.2.24 milestone on Sep 28, 2026
  2. added
    type/feature
    scope/k8s
    priority/p0-critical
    on Sep 28, 2026
  3. changed the title [-]feat(k8s): turnkey kubernetes stacks grafana observability dashboard suite (`k8s/monitoring/dashboards/`)[/-] [+]feat(k8s): llm gateway, otel collector and prometheus dashboards over metrics the cluster collects (`k8s/monitoring/dashboards/`)[/+] on Oct 1, 2026
  4. dan-petty commented on Oct 1, 2026

    @dan-petty
    OwnerAuthor

    The split-offs from this item's refinement are filed. The Prometheus Operator CRD install is #819, a P0 critical fix in v0.2.24: the introducing commit fdd4d0f (#734) is unshipped, and the live checks here need it. The vLLM leftovers are #820, the GPU throttling, power, PCIe and allocation panels #821, the CoreDNS dashboard #822, and the Qdrant authenticated scrape and row #823 (which depends on #819).

  5. added
    priority/p2-medium
    and removed
    priority/p0-critical
    on Oct 1, 2026
  6. dan-petty commented on Oct 1, 2026

    @dan-petty
    OwnerAuthor

    Relabelled from priority/p0-critical to priority/p2-medium, as this item's refinement proposes: it is a feature, not a critical fix. It stays in v0.2.24, which it was already in when the release started.

  7. dan-petty commented on Oct 1, 2026

    @dan-petty
    OwnerAuthor

    Closed by #833, merged into release/v0.2.24.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

  8. added a commit that references this issue on Oct 1, 2026
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

    priority/p2-mediumscope/k8stype/feature

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions