Skip to content

feat(roadmap): serve the project insights and show them in Grafana #6599

Open

Description

@dan-petty

Update 2026-11-26 (infra move): the Grafana values are now in dan-petty/homelab.

The Infinity datasource, its allowedHosts and its token are configured there (homelab follow-up of #4597). This item keeps the insights route and the Project brain row of the product dashboard in k8s/devops/dashboards/. The table works only after the datasource exists.


Problem

The project brain plan of 2026-11-11 (#4624) added three parts for the project insights:

The designs of #4586 and #4699 do not deliver these parts now, and #4597 leaves its table to this item. So no other item delivers them. The Service dashboard cannot show a list of insights from Prometheus, because #3851 does not permit an id label.

Scope

  1. Route GET /api/v1/roadmap/repos/{owner}/{name}/insights?limit=20 in the read-only API of feat(service): serve a read-only roadmap API with OpenAPI #4586: a ValkeyReader over roadmap:v1:brain-insights:<owner>/<name> and the insight hashes. No insight hash exists yet: feat(roadmap): keep alternatives results in a brain index #4676 (feat(roadmap): keep alternatives results in a brain index #7320) wrote the kinds brain-item, brain-tool, brain-ref, brain-events and brain-sync only. The insights and the key brain-insights come with feat(roadmap): run brain repair, consolidate and evaluate daily #4687 and feat(roadmap): the brain files project insights through intake #4693.
  2. A collapsed row "Project brain" in k8s/devops/dashboards/roadmap-pipeline.json of feat(roadmap): a dashboard and alerts for the pipeline #3655. The row has Prometheus stats, a Loki audit panel, and a link to dashboard devops-project-brain that keeps repo.
  3. A table "Project insights" in that row. It reads the insights route through the Infinity datasource of feat(monitoring): read the Service API with the Infinity datasource #4597. allowedHosts holds the in-cluster Service URL only. The read token is the grafana key of service.api.tokens (feat(service): serve a read-only roadmap API with OpenAPI #4586).

Acceptance criteria

  • Test first: a test with a fakeredis brain gets 20 insights in score order, with as_of and no body text. The test fails on the base.
  • A test gets 503 while Valkey is down.
  • The OpenAPI document lists the route.
  • Live check after the release: the table shows the insights of the repository that repo selects. While the API is down, the table shows no data, and no other panel fails.

Dependencies

Source

Source: #4624

Alternatives check of 2026-12-01: in-use.
The item already names this tool.
Tool: Infinity datasource (https://github.com/grafana/grafana-infinity-datasource), Apache-2.0, last activity 2026-12-01, maintained.
Reason: The Infinity datasource covers only the table panel that reads the insights route; the route over Valkey with its score order, limit cap, cursor and 503, and the dashboard row, stay project code.

Covers:

  • Reads a JSON HTTP route into a table panel
  • Sends the configured reader token to the route
  • Restricts reachable hosts through allowedHosts
  • Needs no custom plugin code to build

Lacks:

  • The insights route over ValkeyReader
  • Score order, limit cap of 50 and cursor paging
  • The collapsed Project brain row with Prometheus and Loki panels
  • The insight field schema and the no-body-text rule

Proposed design

Problem statement

The read-only API of #4586 has no insights route, so no reader can list the project insights of a repository. The roadmap-pipeline dashboard of #3655 has neither a Project brain row nor a Project insights table, and #3851 stops a Prometheus panel from listing insights because it permits no id label. No other item delivers these three parts. This item adds the route, the row and the table in one pull request. #4693 writes the insights and the key roadmap:v1:brain-insights:<owner>/<name> that the route reads, and the table shows data once the Infinity datasource exists in dan-petty/homelab.

Acceptance criteria

Requirement: insights-route-list

The read-only API SHALL serve GET /api/v1/roadmap/repos/{owner}/{name}/insights from the insight hashes of the repository.

Scenario: Twenty insights in score order

  • WHEN A test seeds a fakeredis brain with 20 insight hashes under roadmap:v1:brain-insights:<owner>/<name> and requests the route with limit=20.
  • THEN The answer holds as_of and links and 20 insights in descending score, each with id, title, kind, score, state, member count and issue link, and no body text.

Requirement: insights-route-limit-cap

The insights route SHALL return at most 50 insights for one request.

Scenario: A limit above the cap

  • WHEN A test requests the route with limit=100 over 60 insight hashes.
  • THEN The answer holds 50 insights and a links.next cursor.

Requirement: insights-route-cursor

The insights route SHALL return a cursor that reads the next page.

Scenario: The second page

  • WHEN A test reads the first page with limit=20 and then requests the route with the cursor value from links.next.
  • THEN The second answer holds the next 20 insights in score order and no insight of the first page.

Requirement: insights-route-valkey-down

The insights route SHALL answer 503 when the connection to valkey-roadmap fails.

Scenario: Valkey is down

  • WHEN A test makes the Valkey reader raise a connection error.
  • THEN The route answers 503 and returns no insight.

Requirement: insights-route-openapi

The OpenAPI document of the read-only API SHALL list the insights route.

Scenario: The OpenAPI document

  • WHEN A test builds the API application and reads its OpenAPI document.
  • THEN The document holds the path /api/v1/roadmap/repos/{owner}/{name}/insights with the limit and cursor parameters.

Requirement: dashboard-project-brain-row

The roadmap-pipeline dashboard SHALL hold a collapsed row named Project brain with a Prometheus stats panel, a Loki audit panel and a link to the devops-project-brain dashboard that keeps the repo variable.

Scenario: The dashboard passes the dashboard lint

  • WHEN A person runs uv run devops grafana dashboards lint k8s/devops/dashboards/roadmap-pipeline.json on the branch that changes the file.
  • THEN The command reports 0 errors.

Requirement: dashboard-insights-table

The Project insights table SHALL read the insights route through the Infinity datasource with the in-cluster Service URL and the repo variable in the path.

Scenario: The dashboard passes the dashboard lint

  • WHEN A person runs uv run devops grafana dashboards lint k8s/devops/dashboards/roadmap-pipeline.json on the branch that changes the file.
  • THEN The command reports 0 errors.

Requirement: Pending a person after the merge

The row and the table SHALL show the insights of the repository that repo selects on the cluster after the release.

Scenario: The live dashboard after the release

  • WHEN A person opens the roadmap-pipeline dashboard after the release with repo set for a repository that has insights, and then stops the read-only API.
  • THEN The Project brain row is collapsed, its stats and audit panels show their data, the table lists the insights in score order, the link opens devops-project-brain with the same repo value, and while the API is down the table shows no data and no other panel fails.

Existing Tool Considered

The Grafana Infinity datasource (grafana/grafana-infinity-datasource, Apache-2.0, maintained, last activity 2026-11-24) covers the Project insights table: it reads a JSON HTTP route into a table panel, sends a token, limits the reachable hosts, and needs no plugin code to build. The alternatives block of 2026-11-24 gives the verdict partly and lists what the tool lacks; this item builds those parts. The insights route is project code over the Valkey reader of #4586: about 120 lines of handler, response model and tests, with a written cost of about 25,000 tokens and 3 hours to build, keep and fix. The row, its Prometheus stats panel and its Loki audit panel are dashboard JSON of this repository.

Key questions

  • Which envelope does the insights answer use?: The answer uses the envelope of ADR 0029: as_of, links and one insights list. (best practice) [sources: docs/adr/0029-the-roadmap-service-serves-a-read-only-api.md:50]
    • Chosen: The ADR 0029 envelope. ADR 0029 line 50 requires as_of, links and one list or object field on each answer.
    • Rejected: A bare list of insights. ADR 0029 line 50 states that no route returns a bare list.
  • How does the insights route order, cap and page its results?: The route reads the insights in descending score, with id as the tie-break. It returns 20 by default and clamps a larger limit to 50. It pages with an opaque cursor of the last (score, id) pair in links.next, and the next page starts after that pair. (best practice) [sources: docs/adr/0029-the-roadmap-service-serves-a-read-only-api.md:50]
    • Chosen: Cursor on score and id. The order is total when scores tie, and the page stays stable while insights change.
    • Rejected: Offset paging. A new insight shifts every later page, so the table shows an insight twice or misses one.
    • Rejected: Reject a limit above 50 with 422. A read-only dashboard must not fail on its own parameter, and the cap is enough.
  • How does the insights route report that valkey-roadmap is down?: The route answers 503 with no insight. It sends no Retry-After, because it cannot estimate a recovery time. CL4 names each dependency and its failure behavior, DEP-1 asks for a test of that behavior, and ADR 0029's health route already reports the Valkey connection. (best practice) [sources: docs/adr/0029-the-roadmap-service-serves-a-read-only-api.md:34, docs/SERVICE_PATTERNS.md:99, docs/guidelines/production-readiness.md:172]
    • Chosen: 503. The route cannot serve, and the client can retry after the dependency returns; MDN defines 503 as a temporary unavailability of a server.
    • Rejected: An empty list with 200. It hides the outage from the reader.
    • Rejected: 500. The fault is a dependency of the route, not a defect of the route.
  • How does the Project insights table read the insights route?: Through a Grafana Infinity panel that requests the in-cluster Service URL of the insights route with limit=20 and the repo value in the path. The datasource, its allowedHosts and its token are configured in dan-petty/homelab (the homelab follow-up of feat(monitoring): read the Service API with the Infinity datasource #4597), so this item writes only the panel and sets no host list. (best practice) [sources: docs/adr/0029-the-roadmap-service-serves-a-read-only-api.md:62, k8s/devops/dashboards/kustomization.yaml:2, k8s/devops/dashboards/kustomization.yaml:4]
    • Chosen: The Infinity datasource. ADR 0029 names Grafana's Infinity data source as a reader, the alternatives block records the tool as partly, and it reads a JSON route into a table with no plugin code.
    • Rejected: A Prometheus panel. test(roadmap): compare each dashboard panel value with roadmap explain #3851 does not permit an id label, so a metric cannot name an insight.
    • Rejected: A custom Grafana plugin. It adds a plugin to build, ship and keep for one table.
  • Which token does the Project insights table use?: The grafana reader token of ADR 0029 section 7, which feat(service): serve a read-only roadmap API with OpenAPI #4586 holds under service.api.tokens. The settings module's GrafanaConfig holds only the Grafana URL, so this item mints no new secret; the datasource in dan-petty/homelab holds the token value. (best practice) [sources: docs/adr/0029-the-roadmap-service-serves-a-read-only-api.md:66, docs/guidelines/production-readiness.md:132, src/devops_cli/config/settings.py:400]
    • Chosen: The existing grafana token. One token rotates in one place, ADR 0029 already names grafana as a reader, and ACC-10 asks a datasource that anonymous viewers read to use a read-only token.
    • Rejected: A new token for the table. It adds a second secret to mint, store and rotate.
  • Which dashboard does the Project brain row link to?: It links to devops-project-brain, the dashboard of feat(monitoring): a project brain dashboard and alerts #4699, which becomes a dependency. The link follows the product dashboards' own pattern: the target /d/devops-project-brain with includeVars true, which carries the repo value to the other dashboard. (best practice) [sources: k8s/devops/dashboards/devops-cli.json:13, k8s/devops/dashboards/devops-cli.json:20]
  • Does this item configure the Infinity datasource and its token?: No. The Grafana values are in dan-petty/homelab, which the dashboard kustomization names as the environment tree that applies these dashboards, and this repository holds no k8s/monitoring values folder. The panel that names the datasource and the route is the only part here. [sources: k8s/devops/dashboards/kustomization.yaml:4, src/devops_cli/config/settings.py:400]
  • Does this item amend the route table of ADR 0029?: No. ADR 0029 is an accepted record and its body does not change: an agent never edits the body of an accepted record. The issue records the new route, as the contributing guide asks a design decision to be recorded in the issue or in an ADR. (best practice) [sources: docs/adr/README.md:50, CONTRIBUTING.md:26, docs/adr/0029-the-roadmap-service-serves-a-read-only-api.md:30]
    • Chosen: Record the route in the issue. The body of an accepted record does not change, and the contributing guide accepts the issue as the record of a decision.
    • Rejected: Add the route to the ADR 0029 route table. The body hash of an accepted record is checked again, so an edit of the body fails the ADR check.
  • Do the insight hashes that the route reads exist today?: No. The brain index writes the kinds brain-item, brain-tool, brain-ref, brain-events and brain-sync only, so the insights and the key brain-insights come with feat(roadmap): the brain files project insights through intake #4693. [sources: src/devops_cli/roadmap/brain_index.py:56]

Fit

Fits in one pull request.

Suspected block

The Infinity datasource, its allowedHosts and its grafana token in dan-petty/homelab (the homelab follow-up of #4597); the Project insights table shows no data until that repository applies them.

Dependencies

#3655, #4586, #4597, #4693, #4699

Activity

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

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 21, 2026
  5. devops-cli-service commented on Nov 22, 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.

  6. 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: no check. A person decides what the new result means for the item.

    Searches (7)

    Tools considered:

    Searches run:

    • Grafana Infinity datasource query JSON HTTP API table, results: 5
    • Grafana plugin allowedHosts datasource URL restriction, results: 5
    • yesoreyeram-infinity-datasource Grafana plugin, results: 5
    • Infinity datasource github yesoreyeram, results: 5
    • grafana.com plugins infinity datasource JSON CSV GraphQL, results: 5
    • "infinity" grafana datasource documentation query type json backend parser, results: 5
    • grafana infinity datasource plugin page data sources json api authentication, results: 5

    Sources:

  7. dan-petty commented on Nov 27, 2026

    @dan-petty
    OwnerAuthor

    Design check, 2026-11-26

    Body, 2 corrections

    Refine block

    Place: the route and the dashboard row stay here. The Infinity datasource is in dan-petty/homelab, as the update says.

    Dependencies: #4676 is closed. #4693, #4586, #4597 and #3655 are open. src/ has no api/v1/roadmap path yet.

    Open question: the row links to the dashboard of #4699 (open).

  8. 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 in the section Proposed design of the body.

  9. devops-cli-service commented on Dec 1, 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/grafana-infinity-datasource. A person decides what the new result means for the item.

    Searches (7)

    Tools considered:

    Searches run:

    • open source tool list records from Redis cache into Grafana table with pagination cursor, results: 5
    • Grafana Infinity datasource read JSON REST endpoint into table, results: 5
    • Grafana Infinity datasource JSON API table panel, results: 5
    • grafana-infinity-datasource documentation, results: 5
    • Grafana data source plugin query JSON HTTP endpoint as table, results: 5
    • grafana infinity datasource github readme, results: 5
    • grafana infinity plugin query json api table panel url, 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/highpriority/p2-mediumscope/roadmapsource/agentstatus/newtype/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions