Repository navigation
Closed
Labels
effort/mediumEffort Mediumpriority/p2-mediumPriority P2: standard workscope/monitoringGrafana, Prometheus, Loki, alerts and dashboardssource/agentFiled by an agenttype/featureType feature: a new functionvalue/mediumValue Medium
Description
Problem or Motivation
The gateway refuses every key when its database is down, so a full claim stops all AI work. Nothing measures the database:
cnpg_collector_upexists only for mattermost-db.kubectl get podmonitor -Ashows only the operator and mattermost-db.- Port 9187 is closed to monitoring in
k8s/llm/gateway-db.yaml. - The spend-log table gets about 71k rows a week with no limit. No code reads it: feat(ai): label gateway spend by repository #4578 reads Prometheus, and feat(roadmap): cost and token budgets per item and per day #3066 counts in the Service.
- The chart already makes the CNPG dashboard, but in cnpg-system, where the Grafana sidecar does not look.
This item is rank 5 of the cluster integration plan #4989. It is a configuration fix that ships now and needs no owner step.
Proposed Solution & Architectural Design
- Add a PodMonitor for
cnpg.io/cluster=llm-gateway-db(portmetrics, 9187), ask8s/mattermost/podmonitor.yamldoes. - Add an ingress rule from monitoring on TCP 9187 in the
llm-gateway-db-perimeterNetworkPolicy (k8s/llm/gateway-db.yaml). - Copy the CloudNativePG dashboard JSON (
cloudnative-pg/grafana-dashboards, Apache-2.0) intok8s/monitoring/dashboardsand its configMapGenerator. It must pass docs/DESIGN.md, and the dashboard lint of test(monitoring): lint dashboards for range, window and legend errors #4743 when it lands. The dashboard also serves mattermost-db. - Add rules for one instance, each with a promtool case: collector down, connections near
max_connections, and database size plus WAL (cnpg_pg_database_size_bytes + cnpg_collector_pg_wal) against the 5Gi claim. - Set
general_settings.maximum_spend_logs_retention_periodto30dink8s/llm/gateway/config.yaml.
Target Subsystem
Kubernetes & Minikube Automation (k8s/llm/, k8s/monitoring/).
Existing Tool Considered
The CloudNativePG metrics exporter and its upstream dashboard (Apache-2.0), the Prometheus Operator PodMonitor, and the LiteLLM spend-log retention setting. Nothing is built.
Acceptance Criteria
- After the merge, Prometheus has
cnpg_collector_upfor llm-gateway-db. - promtool cases pass for the three rules.
- The dashboard shows llm-gateway-db and mattermost-db.
- The gateway config holds the 30d retention, and a config test holds it.
Dependencies
None.
Source: #4989
Metadata
Metadata
Assignees
Labels
effort/mediumEffort Mediumpriority/p2-mediumPriority P2: standard workscope/monitoringGrafana, Prometheus, Loki, alerts and dashboardssource/agentFiled by an agenttype/featureType feature: a new functionvalue/mediumValue Medium
Activity
dan-petty commentedon Nov 12, 2026
Both items target the llm-gateway-db CloudNativePG cluster, but dan-petty/homelab#332 adds an off-node backup while this candidate adds metrics scraping, a dashboard, and alert rules.devops-cli-service commentedon Nov 12, 2026
Released in v0.118.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.118.0
devops-cli-service commentedon Nov 12, 2026
Live since 2026-11-12 12:40 UTC