Skip to content

feat(monitoring): a project brain dashboard and alerts #4699

Open

Description

@dan-petty

Update 2026-11-26 (infra move): The dashboard and the alerts stay in devops-cli, under k8s/devops/.

The dashboard goes in k8s/devops/dashboards/ and the alert group in k8s/devops/monitoring/prometheus-rules-values.yaml. tests/prometheus/test_k8s_monitoring_dashboards.py and its PROVISIONED list are gone. A new redis_exporter series needs the allow list in dan-petty/homelab (k8s/monitoring/k8s-monitoring-values.yaml).


Problem or Motivation

The owner asked on 2026-11-11 for brain metrics on a Grafana dashboard, with alerts and a place in the Service dashboard. Today no dashboard shows a Valkey series or a brain series, and no alert covers a late brain task, a high fallback share or an insight with no durable copy.

Proposed Solution & Architectural Design

  • k8s/devops/dashboards/project-brain.json (uid devops-project-brain, title "Roadmap / Project Brain") in its own configMapGenerator entry grafana-project-brain-dashboard, so each ConfigMap stays under 262,144 bytes.
  • Add it to _PURE_DEVOPS_CLI_DASHBOARDS (tests/telemetry/test_telemetry_instruments.py). The allow list for the redis_exporter series is in dan-petty/homelab (see the update above).
  • Variables: datasource, loki_datasource, repo, task, instance.
  • Rows: Health (late tasks, fallback share, sync lag, undurable entries, brain spend 7 days); Contents (entries by kind and state, insights by state, proposals 30 days); Reads and GitHub (reads by store and result, embedding lookups by tier, requests saved, 304 share, first reads); Valkey (memory, keys and client errors for valkey-devops and valkey-roadmap; evictions for valkey-devops only, because valkey-roadmap has the policy noeviction); Maintenance (runs by task and result, entries changed, keys removed, Jev decisions by point); Per item (references by provider and result); Audit (a Loki panel {namespace="devops"} | json | logger="devops_cli.roadmap.brain").
  • Alert group project-brain in k8s/devops/monitoring/prometheus-rules-values.yaml, in the sparse-series form of the roadmap-service group, each selector by job, never by pod: BrainTaskLate, BrainTaskFailing, BrainValkeyFallback, BrainSyncLagHigh, BrainUndurable, BrainCacheEvicting, BrainSpendHigh.
  • promtool tests in tests/fixtures/prometheus_rules/project_brain_tests.yaml, registered in tests/prometheus/test_k8s_monitoring_alerting.py; one runbook row for each alert in the Alerting section of k8s/README.md.
  • The collapsed row "Project brain" in the roadmap-pipeline dashboard and the insights table are scope 2 and 3 of feat(roadmap): serve the project insights and show them in Grafana #6599, not of this item.

Target Subsystem

Kubernetes & Minikube Automation (k8s/devops/dashboards/, k8s/devops/monitoring/).

Existing Tool Considered

Grafana dashboards as JSON, promtool, Prometheus, Loki and the existing dashboard and alert tests. No new tool. Cost: about 200,000 tokens and 4 hours to build.

Acceptance Criteria

  • tests/grafana/test_grafana_dashboards.py and tests/telemetry/test_telemetry_instruments.py pass, and each query names a declared metric.
  • Each alert has a promtool case that fires, one that stays quiet, and one over a pod change.
  • After the sync, the Grafana MCP tool get_dashboard_by_uid devops-project-brain returns the dashboard.

Dependencies

#4693. Part of the project brain plan #4624. (#3655 is a dependency of the row, which #6599 holds.)

Source: #4624

Alternatives check of 2026-11-26: none.
Tool: none found.
Reason: Searches returned only the Grafana/Loki images the cluster already runs, no maintained tool that ships a project-brain dashboard or alerts over this project's own devops_cli_* and redis_exporter series. The issue asks for no new tool.

Lacks:

  • No dashboard over the project's devops_cli_* brain instruments
  • No alerts for late, failing, undurable or expensive brain tasks
  • No Valkey or fallback-share panels and no runbook rows

Proposed design

Problem statement

The owner asked for brain metrics on a Grafana dashboard, with alerts and a place in the Service dashboard. No dashboard shows a Valkey series or a brain series today. No alert covers a late brain task, a high fallback share or an insight with no durable copy. This item adds the project brain dashboard, its seven alerts, the promtool cases and the runbook rows. The roadmap-pipeline row and the insights table belong to #6599.

Acceptance criteria

Requirement: Dashboard ConfigMap entry

The k8s/devops/dashboards/kustomization.yaml SHALL generate k8s/devops/dashboards/project-brain.json in its own configMapGenerator entry named grafana-project-brain-dashboard.

Scenario: Kustomize renders the project brain ConfigMap

  • WHEN kubectl kustomize k8s/devops/dashboards runs.
  • THEN The output holds one ConfigMap named grafana-project-brain-dashboard with the key project-brain.json.

Requirement: Dashboard lint

The project brain dashboard MUST pass the dashboard checks of tests/grafana/test_grafana_dashboards.py.

Scenario: The Grafana dashboard test runs

  • WHEN uv run pytest tests/grafana/test_grafana_dashboards.py runs.
  • THEN The command exits 0 and reports no error for project-brain.json.

Requirement: Declared instruments

Each PromQL query of the project brain dashboard that reads a devops_cli_* series MUST name an instrument that src/devops_cli/telemetry/instruments.py declares.

Scenario: The telemetry test checks the dashboard queries

  • WHEN uv run pytest tests/telemetry/test_telemetry_instruments.py runs after the dashboard joins _PURE_DEVOPS_CLI_DASHBOARDS.
  • THEN The command exits 0 and reports no unsent devops_cli_* series.

Requirement: Dashboard registry

tests/telemetry/test_telemetry_instruments.py MUST list project-brain.json in _PURE_DEVOPS_CLI_DASHBOARDS.

Scenario: The telemetry registry holds the dashboard

  • WHEN uv run pytest tests/telemetry/test_telemetry_instruments.py runs.
  • THEN The command exits 0 and _PURE_DEVOPS_CLI_DASHBOARDS holds project-brain.json.

Requirement: Alert group in the product rules

The project-brain alert group MUST be in k8s/devops/monitoring/prometheus-rules-values.yaml under serverFiles.devops_cli_alerting_rules.yml.

Scenario: The k8s CI row validates the product rule file

  • WHEN uv run devops ci --check --only k8s runs.
  • THEN The command exits 0 and reports no error for the project-brain group.

Requirement: Alert selectors and cases

Each of the seven project brain alerts MUST select its series by a job matcher and MUST have a fire case, a quiet case and a pod-change case.

Scenario: The alerting test runs the project brain cases

  • WHEN uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py runs.
  • THEN The command exits 0 and promtool passes tests/fixtures/prometheus_rules/project_brain_tests.yaml for the seven alerts.

Requirement: BrainCacheEvicting scope

The BrainCacheEvicting alert MUST select the valkey-devops instance only and MUST NOT select valkey-roadmap.

Scenario: Promtool runs the eviction cases

  • WHEN promtool test rules tests/fixtures/prometheus_rules/project_brain_tests.yaml runs.
  • THEN The fire case uses valkey-devops, the valkey-roadmap case stays quiet and promtool exits 0.

Requirement: Runbook rows

The ## Alerting section of k8s/README.md MUST hold one row for each of the seven project brain alerts.

Scenario: The k8s CI row reads the Alerting table

  • WHEN uv run devops ci --check --only k8s runs.
  • THEN The command exits 0 and reports no missing row for the seven project brain alerts.

Requirement: Pending a person after the merge

The synced dashboard MUST show uid devops-project-brain, its title, its five variables, its seven rows and the Valkey row with evictions for valkey-devops only.

Scenario: A person reads the dashboard from Grafana

  • WHEN A person syncs the product dashboards after the merge and calls the Grafana MCP tool get_dashboard_by_uid devops-project-brain.
  • THEN The tool returns the dashboard with title Roadmap / Project Brain, the five variables, the seven rows and the Valkey row with evictions for valkey-devops only.

Existing Tool Considered

The alternatives check of 2026-11-26 in the issue body gives the verdict none and names no tool. The block lists what no tool covers. The change builds dashboard JSON, one rule group and promtool cases on the Grafana, Prometheus and Loki stack that the cluster already runs. Written cost: about 200,000 tokens and 4 hours to build, keep and fix that code.

Key questions

  • Where does the project brain dashboard live and how does the project provision it?: The dashboard is k8s/devops/dashboards/project-brain.json. The k8s/devops/dashboards/kustomization.yaml gets a configMapGenerator entry named grafana-project-brain-dashboard with the file and the sidecar labels of the other product dashboards. (best practice) [sources: k8s/devops/dashboards/kustomization.yaml, tests/telemetry/test_telemetry_instruments.py, docs/HOMELAB_REPO_SWITCH.md:170]
    • Chosen: Product dashboard folder with its own generator. Product dashboards live in k8s/devops/dashboards/, and one generator keeps each ConfigMap under 262,144 bytes.
    • Rejected: Join the existing product dashboard ConfigMap. One ConfigMap would hold every product dashboard and can pass the size limit.
    • Rejected: Environment dashboard folder. The environment tree is in dan-petty/homelab, and this repository does not hold it.
  • Where does the project-brain alert group go?: The group goes in k8s/devops/monitoring/prometheus-rules-values.yaml under serverFiles.devops_cli_alerting_rules.yml. The chart loads this product file next to the environment rules. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml, tests/prometheus/test_k8s_monitoring_alerting.py, docs/HOMELAB_REPO_SWITCH.md:170]
    • Chosen: Product rule file. The chart loads this file next to the environment rules, and the group watches devops_cli_* series.
    • Rejected: Environment rule file. The environment values file lives in dan-petty/homelab, and this repository does not hold it.
    • Rejected: A new rule file. The chart loads one product rule file, and the alerting test names that file.
  • How does each project brain counter alert count a sparse series?: Each counter alert uses the sparse form of the roadmap-stage rule: (last_over_time(series[window]) unless last_over_time(series[window] offset window)) or increase(series[window]). The form counts a series that starts inside the window from zero. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml]
    • Chosen: Sparse-series form. It counts the first export of a short-lived job, as the roadmap-stage rule does.
    • Rejected: Raw increase. It misses the first value of a series that starts in the window.
    • Rejected: Raw rate. It needs two samples and misses a job that exports one sample.
  • Which label do the project brain alerts select?: Each devops_cli_* selector names a job matcher and never a pod. The rule uses the job label that each brain series carries. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml]
    • Chosen: Job matcher. Pod names change, and the file selects each devops_cli_* series by job.
    • Rejected: Pod matcher. A pod matcher breaks when the pod restarts.
    • Rejected: No selector. The rule would count a workstation or another job.
  • How are the seven project brain alerts tested and registered?: tests/fixtures/prometheus_rules/project_brain_tests.yaml holds a fire case, a quiet case and a pod-change case for each alert. The rule-test registry in tests/prometheus/test_k8s_monitoring_alerting.py maps the group project-brain to that file. (best practice) [sources: tests/prometheus/test_k8s_monitoring_alerting.py]
    • Chosen: Promtool cases in the shared rule-test registry. The existing test runs each registered group and requires a case for each alert.
    • Rejected: No promtool cases. The test requires a case for each alert of a tested group.
    • Rejected: A Python-only expression check. It does not evaluate the rule over samples.
  • Which redis_exporter series may the dashboard and BrainCacheEvicting read?: Only the series that the allow list in dan-petty/homelab keeps. A new series must join that allow list in k8s/monitoring/k8s-monitoring-values.yaml of dan-petty/homelab before a panel or an alert reads it. BrainCacheEvicting selects valkey-devops only, because valkey-roadmap uses the noeviction policy. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml, docs/HOMELAB_REPO_SWITCH.md:170, k8s/devops/valkey-roadmap/valkey.conf]
    • Chosen: Allow-listed redis_exporter series only. The chart drops a series outside its allow list, so the panel stays empty and the alert cannot fire.
    • Rejected: Any redis_exporter series. A series outside the allow list never reaches Prometheus.
    • Rejected: A new exporter. The stack already scrapes redis_exporter, and no new tool is needed.
  • Which label does the first-reads counter have?: The first-reads counter has no outcome label. The first-reads panel must not group by outcome. [sources: src/devops_cli/telemetry/instruments.py]
  • Which Valkey instance can evict keys?: valkey-devops can evict keys. valkey-roadmap uses the noeviction policy and never evicts. [sources: k8s/devops/valkey-roadmap/valkey.conf]
  • Which section of k8s/README.md holds the alert rows?: The ## Alerting section holds the row of each alert. [sources: k8s/README.md]
  • Does this item add a new redis_exporter series to the allow list in dan-petty/homelab?: No. This item reads only the series that the allow list already keeps. A new series is a separate change in dan-petty/homelab. (best practice) [sources: docs/HOMELAB_REPO_SWITCH.md:170, k8s/devops/monitoring/prometheus-rules-values.yaml]
    • Chosen: Use existing allow-listed series only. The allow list is in another repository, and this item has no issue there.
    • Rejected: Add a new series in this item. The allow list lives in dan-petty/homelab, so this repository cannot change it.
    • Rejected: Add a new exporter. The stack already scrapes redis_exporter.
  • What gates the dashboard offline, and how is the live Grafana read recorded?: The offline gates are uv run pytest tests/grafana/test_grafana_dashboards.py, uv run pytest tests/telemetry/test_telemetry_instruments.py and kubectl kustomize k8s/devops/dashboards. The live get_dashboard_by_uid devops-project-brain read is an acceptance criterion named Pending a person after the merge. (best practice) [sources: tests/grafana/test_grafana_dashboards.py, k8s/README.md]
    • Chosen: Offline tests and generator render. Both run offline, and the live read stays a person step after the sync.
    • Rejected: The live read as the only gate. It needs a live Grafana and a sync, so it cannot gate the pull request.
    • Rejected: No check. The dashboard can still break the lint or the generator.
  • Which test files register a product dashboard?: _PURE_DEVOPS_CLI_DASHBOARDS in tests/telemetry/test_telemetry_instruments.py registers the dashboard, and tests/grafana/test_grafana_dashboards.py lints it. The old tests/prometheus/test_k8s_monitoring_dashboards.py and its PROVISIONED list are gone. [sources: tests/telemetry/test_telemetry_instruments.py, tests/grafana/test_grafana_dashboards.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4693

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/monitoring
    status/new
    value/high
    effort/medium
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/monitoring. The (monitoring) scope of the title gives the scope.
    • Priority: P2-Medium. It is a requested monitoring feature with two open dependencies, not a blocking defect.
    • Value: High. The owner asked for brain metrics, alerts, and a dashboard; without them, late brain tasks and high fallback share go unnoticed.
    • Effort: Medium. The body estimates about 4 hours: one dashboard JSON, seven alert rules, promtool tests, and three test-file updates.
    • Related: feat(roadmap): a dashboard and alerts for the pipeline #3655, which asks for a different change. Both add Grafana dashboards and alerts under k8s/monitoring/dashboards/ and are siblings from the project-brain plan #4624, but #3655 covers pipeline metrics while this covers brain and Valkey metrics.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Scope from the content freshness plan (2026-11-11)

    This issue is child 19 of #4880, the content freshness tracker. The scope adds document-drift panels and alerts.

    Why

    A document-drift lane with a cap can let findings wait for a long time with no signal. This issue has no panel or alert for document drift.

    New scope

    1. Panels: drift findings by rule, class and area; stale citations; the age of the oldest open finding; RAG ingest age; knowledge base review age.
    2. Alerts: the oldest open finding is older than 28 days; docs_check_at_main_head fails 2 days in a row.

    The panels follow docs/DESIGN.md when #4735 lands it.

    Acceptance added

    • The acceptance of this issue stays.
    • A rule test fires the 28-day alert with a fixture series.
    • A rule test fires the main-head alert after 2 failed days.

    Depends on: #4693, and the dependencies that this issue already names.

  6. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The searches surfaced only unrelated hits (container images such as grafana/grafana and valkey/valkey, and MDN documentation pages) and no open, maintained tool or library that supplies a project-brain dashboard, its panels and the seven brain alerts. The need is repository-specific dashboard JSON, Prometheus rule groups and promtool cases built on Grafana, Prometheus and Loki, which the issue itself names as "No new tool".

    Tool: none found

    Lacks:

    • A dashboard JSON with uid devops-project-brain and the Health, Contents, Reads and GitHub, Valkey, Maintenance, Per item and Audit rows
    • The project-brain alert group (BrainTaskLate, BrainTaskFailing, BrainValkeyFallback, BrainSyncLagHigh, BrainUndurable, BrainCacheEvicting, BrainSpendHigh) in sparse, job-selector form
    • promtool rule tests for fire, quiet and pod-change cases
    • Registrations in PROVISIONED, _PURE_DEVOPS_CLI_DASHBOARDS and the alerting test module, plus runbook rows in k8s/README.md
    • The follow-up collapsed 'Project brain' row in the roadmap-pipeline dashboard after feat(roadmap): a dashboard and alerts for the pipeline #3655

    Searches run:

    • Prometheus alerting rules Vlk Valkey evictions memory client errors, results: 5
    • Valkey Grafana dashboard JSON, results: 5
    • grafana.com Valkey dashboards download, results: 5
    • redis_exporter mixin Valkey Prometheus rules alerts, results: 5
    • prometheus-community redis mixin alert rules, results: 5
    • Grafana dashboard for Redis Prometheus redis_exporter memory keys evicted, results: 5
    • "redis_exporter" grafana dashboard 763, results: 5
    • grafana.com/grafana/dashboards valkey, results: 5
    • Grafonnet jsonnet library build Grafana dashboards as code, results: 5
    • promtool unit testing alerting rules prometheus test yaml, results: 5

    Sources:

    Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.

  7. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 0820a64 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

  8. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  9. dan-petty commented on Nov 27, 2026

    @dan-petty
    OwnerAuthor

    Design check, 2026-11-26

    Body, 7 corrections

    Refine block

    • It names k8s/monitoring/prometheus-values.yaml. This repository does not hold that file.
    • BrainCacheEvicting can fire for valkey-devops only.

    Place: correct. Argo CD reads k8s/devops and the rule file from this repository (docs/HOMELAB_REPO_SWITCH.md:170).

    Dependencies: #4693 is open. The task, proposal and undurable series come with #4687 and #4693.

    Open question: the body names no issue of dan-petty/homelab for the allow list.

  10. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files in the section Proposed design of the body.

  11. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

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/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions