Repository navigation
Description
Update 2026-11-26 (infra move): the collector values and dashboard files go to dan-petty/homelab.
This issue keeps the Job annotations (cluster_job.py), the table and log panels in service_dashboard.py and their tests. The kube-state-metrics allowlists, services.toml, the generated devops-roadmap-service.json and the live checks are homelab work. The k8s row here cannot read homelab values: test an unexported key on a fixture. Revise plan PR #7285.
Follow-up: dan-petty/homelab#319.
Problem or Motivation
The owner (2026-11-11): "the service dashboard should show service jobs, worktree, branch, worklog". The Service dashboard is Grafana as code (#3655, folded in by the owner's decision on #4517). Today a person cannot see which Service Jobs run, for which repository and item, on which branch and working copy, and what each one did, without kubectl and a Loki query by hand.
Measured on 2026-11-11:
- Runner Jobs carry only
app.kubernetes.io/name: devops-cli-joband a hashedimplement-repolabel, and the annotationsroadmap.devops-cli/progressandprogress-at. They carry no item, branch or working copy. feat(roadmap): label Service Jobs by repository and item #4558 adds the labelsroadmap.devops-cli/owner,repoanditem. - kube-state-metrics runs in namespace monitoring with
--resources=...jobs,pods...but exports labels only for namespaces (--metric-labels-allowlist=namespaces=[*]) and no annotations, so a Grafana panel cannot read Job labels today. - Alloy (DaemonSet
k8s-monitoring-alloy-logs) already sends pod logs to Loki. The Service log lines carry trace ids (fix(service): put trace ids on Service JSON log lines #4511), and the round and attempt lines of feat(roadmap): log each fix round and each failed stage item #4561 name repo and item.
Proposed Solution & Architectural Design
Connect the existing open tools through their standard interfaces. Add no new Service code for this view.
- Job metadata. Each Service Job and Argo Workflow (stage, refine, alternatives, intake, implement; feat(roadmap): label Service Jobs by repository and item #4558, feat(roadmap): run each stage item in its own Job #4559, feat(k8s): let Argo Workflows run roadmap pods in devops #4566) gets the annotations
roadmap.devops-cli/branchandroadmap.devops-cli/worktree(the clone path or the Gitea work branch of the iteration lane) next to the feat(roadmap): label Service Jobs by repository and item #4558 labels. The annotation values are bounded and hold no secret. - Export. In
k8s/monitoring/k8s-monitoring-values.yaml, kube-state-metrics gets--metric-labels-allowlistforjobsandpods(the feat(roadmap): label Service Jobs by repository and item #4558 label keys) and--metric-annotations-allowlistfor the two annotations. Thenkube_job_labels,kube_job_annotations,kube_job_status_active,kube_job_status_start_timeandkube_job_status_completion_timecarry repo, item, branch and worktree. Argo Workflows gives the same through its controller metrics or the Workflow labels. - Panels in the Service dashboard (feat(roadmap): a dashboard and alerts for the pipeline #3655). A table "Service jobs" (Prometheus): job, row, repo, item, branch, worktree, state, start time and duration, with a data link to GitHub for the item and the branch. A logs panel "Work log" (Loki): the log lines of the selected Job, selected by pod name (
{namespace="devops", pod=~"$job.*"}), with the trace link of fix(service): put trace ids on Service JSON log lines #4511. Dashboard variables repo, item and job filter both panels. - History. A finished Job is gone after its TTL. For the history, the table links to the run record of feat(roadmap): keep a record of each roadmap run #4589 through the read-only API of feat(service): serve a read-only roadmap API with OpenAPI #4586 (
/runs/{run_id}), which already links Loki and Tempo.
Item and branch are unbounded values. They stay off Prometheus series that the Service emits; they appear only on the kube-state-metrics info series of live Jobs, which end with the Job, and in Loki structured metadata, not as Loki stream labels.
Target Subsystem
k8s/monitoring (kube-state-metrics values, the Service dashboard JSON of #3655), src/devops_cli/k8s/cluster_job.py (the two annotations, with #4558), docs (the dashboard section of k8s/README.md).
Existing Tool Considered
kube-state-metrics label and annotation allowlists, Grafana table and logs panels with data links, Loki LogQL, and the run records of #4589. No custom exporter and no new API route. The only code is two annotation keys in build_job beside the labels of #4558.
Depends on #4558 (labels) and #3655 (the dashboard). Uses #4589 and #4586 for history when they exist. Related: #4577 (Workflow run panels).
Acceptance criteria
kubectl -n devops get jobs -o jsonpathshows the branch and worktree annotations on a new runner Job and a new stage Job.- A PromQL query
kube_job_annotations{namespace="devops"}returns the branch and worktree of a live Job, andkube_job_labelsreturns its repo and item. - The Service dashboard has a "Service jobs" table and a "Work log" panel. A dashboard test fails and names the panel when a query reads a metric or a label that is not exported (the rule of feat(roadmap): a dashboard and alerts for the pipeline #3655).
- Selecting a Job row shows that Job's Loki lines within 60 s of their write.
- No Service metric gains an item, branch or worktree label (a test checks the instruments).
Source: 4517
Alternatives check of 2026-11-22: in-use.
The repository already uses this tool.
Tool: kubernetes/kube-state-metrics (https://github.com/kubernetes/kube-state-metrics), Apache-2.0, last activity 2026-11-19, maintained.
Reason: Searches surfaced no single tool that renders this Job view; kube-state-metrics, already running in the cluster, exports Job labels and annotations through its allowlists, but it draws no panels and reads no logs.
Covers:
- Label and annotation allowlists expose repo, item, branch and worktree
- kube_job_status series give state, start time and completion time
- Info series end with the Job, so Service metric cardinality stays bounded
Lacks:
- No dashboard table, columns or data links
- No Loki log query or trace link for a Job's lines
- No history once a finished Job's TTL removes it
Proposed design
Problem statement
The Roadmap Service creates Kubernetes Jobs. The dashboard shows no Job metadata, branch, worktree or work log. A person must use kubectl and a hand-written Loki query to see what each Job ran. The change sets the branch and worktree annotations, exports the Job labels and annotations through kube-state-metrics, and adds the Service jobs table and the Work log panel to the generated Roadmap Service dashboard.
Acceptance criteria
Requirement: Service Job branch and worktree annotations
The Service SHALL set the roadmap.devops-cli/branch and roadmap.devops-cli/worktree annotations on each stage and implement Job it creates for an item.
Scenario: A stage Job and a runner Job carry their branch and lane clone path
- WHEN A test builds the stage Job for item 4621 on branch feat/4621-demo and the runner Job for the same item on branch feat/4621-demo, from the stage and implement lane clones.
- THEN Each Job's metadata holds roadmap.devops-cli/branch: feat/4621-demo and roadmap.devops-cli/worktree with its lane clone path.
Requirement: kube-state-metrics Job label and annotation allowlists
The kube-state-metrics values SHALL allow the Job labels roadmap.devops-cli/owner, roadmap.devops-cli/repo, roadmap.devops-cli/item and app.kubernetes.io/component and the Job annotations roadmap.devops-cli/branch and roadmap.devops-cli/worktree.
Scenario: Pending a person after the merge
- WHEN A person runs kubectl -n monitoring get deployment kube-state-metrics -o jsonpath='{.spec.template.spec.containers[0].args}' after the merge.
- THEN The output holds --metric-labels-allowlist=jobs=[roadmap.devops-cli/owner,roadmap.devops-cli/repo,roadmap.devops-cli/item,app.kubernetes.io/component] and --metric-annotations-allowlist=jobs=[roadmap.devops-cli/branch,roadmap.devops-cli/worktree].
Requirement: Service jobs table
The Roadmap Service dashboard SHALL include a table panel named Service jobs that shows the job name, row, repository, item, branch, worktree, state, start time and duration of each live Job.
Scenario: The dashboard builder returns the table
- WHEN A test calls the dashboard builder with the devops-roadmap-service spec.
- THEN The returned dashboard holds a table panel named Service jobs with the nine columns, reads kube_job_labels and kube_job_annotations through their label_ and annotation_ names, uses label_app_kubernetes_io_component for the row, and links the item to
https://github.com/<owner>/<repo>/issues/<item>and the branch tohttps://github.com/<owner>/<repo>/tree/<branch>.
Requirement: Work log panel
The Roadmap Service dashboard SHALL include a logs panel named Work log that shows the Loki lines of the selected Job.
Scenario: The dashboard builder returns the Work log query
- WHEN A test calls the dashboard builder with the devops-roadmap-service spec.
- THEN The returned dashboard holds a logs panel named Work log that queries the loki data source with {namespace="devops"} | pod=~"$job.*" and keeps the trace_id derived field.
Requirement: Dashboard variables filter the panels
The Roadmap Service dashboard SHALL offer the repo, item and job variables; the Service jobs table SHALL filter by all three, and the Work log panel SHALL filter by job.
Scenario: The dashboard builder returns the variables
- WHEN A test calls the dashboard builder with the devops-roadmap-service spec.
- THEN The returned dashboard holds the repo, item and job variables, the Service jobs table query holds $repo, $item and $job, and the Work log query holds $job.
Requirement: Dashboard test refuses an unexported Job key
The dashboard test SHALL fail and name the panel when a panel query reads a Job metric, label or annotation that the monitoring values do not export.
Scenario: A panel reads a missing Job annotation
- WHEN A test adds a panel query that reads the Job annotation annotation_roadmap_devops_cli_secret and runs the dashboard test.
- THEN The test fails and names the panel and the missing key.
Requirement: No unbounded Job values on Service metrics
The Service metrics SHALL NOT carry the item, branch or worktree values as labels.
Scenario: The Service instruments
- WHEN A test inspects the label sets of the Service metric instruments.
- THEN No instrument has item, branch or worktree as a label.
Requirement: Generated dashboard matches its spec
The committed Roadmap Service dashboard SHALL be the build of its services.toml spec.
Scenario: The dashboard build leaves no diff
- WHEN make dashboards runs and git diff --exit-code k8s/monitoring/dashboards/devops-roadmap-service.json follows.
- THEN The diff command exits 0.
Requirement: Live Job labels and annotations in Prometheus
kube-state-metrics SHALL expose the Job labels and annotations of a live Job.
Scenario: Pending a person after the merge
- WHEN A person starts a new stage Job and runs kubectl -n devops get job <job> -o jsonpath='{.metadata.annotations}' and the PromQL query kube_job_annotations{namespace="devops"}.
- THEN The Job holds roadmap.devops-cli/branch and roadmap.devops-cli/worktree, and the query returns annotation_roadmap_devops_cli_branch and annotation_roadmap_devops_cli_worktree for that Job; kube_job_labels returns label_roadmap_devops_cli_repo, label_roadmap_devops_cli_item and label_app_kubernetes_io_component.
Requirement: Live Work log lines
The Work log panel SHALL show the Loki lines of the selected Job within 60 s of their write.
Scenario: Pending a person after the merge
- WHEN A person selects a Job row in the deployed Service dashboard after the Job writes a log line.
- THEN The Work log panel shows the line within 60 s and offers the trace link.
Existing Tool Considered
kube-state-metrics (in-use; see the alternatives check in the issue body for what it covers and lacks). The proposal uses its Job label and annotation allowlists and adds the Service jobs table and Work log panel to the generated Grafana dashboard. The dashboard panels are about 150 lines of template code and 4 tests, an estimated 60k tokens and half a day. The run-history link is deferred until #4589 and #4586 exist.
Key questions
- Which value does the roadmap.devops-cli/worktree annotation hold?: The clone path of the lane that submits the Job: <data>/roadmap/<owner>/<name>/lanes/<lane>. (best practice) [sources: docs/CLUSTER.md, openspec/changes/archive/2026-11-13-5553-each-roadmap-job-in-its-own-lane/design.md, docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md]
- Chosen: Lane clone path. Each lane works in its own clone under lanes/<lane>, and the Service has that path when it submits the Job.
- Rejected: Gitea work branch. The owner decided on 2026-11-11 that the lane has no Gitea work branch for now.
- Rejected: Repository clone path. The lane that submits the Job works in lanes/<lane>, not in the shared clone.
- How does the Work log panel select the lines of one Job?: It queries {namespace="devops"} | pod=~"$job.*". The pod name is structured metadata in Loki, not a stream label, so pod belongs in a label filter after the stream selector. (best practice) [sources: tests/grafana/test_service_dashboard.py, openspec/changes/archive/2026-11-07-1357-add-warnings-and-errors-above-logs/design.md, k8s/monitoring/dashboards/devops-roadmap-service.json]
- Chosen: Label filter on pod. Pod logs carry pod as structured metadata; a stream selector on pod returns no lines.
- Rejected: Stream selector on pod. It returns no lines when a pod is selected, as feat(k8s): Add warnings and errors above logs, narrow both by pod #1357 found.
- Which mechanism exports the Job labels and annotations to Prometheus?: kube-state-metrics allowlists for jobs. metricLabelsAllowlist gets roadmap.devops-cli/owner, roadmap.devops-cli/repo, roadmap.devops-cli/item and app.kubernetes.io/component. metricAnnotationsAllowlist gets roadmap.devops-cli/branch and roadmap.devops-cli/worktree. The chart's default metric list already holds kube_job.*, so no metric name is added. (best practice) [sources: k8s/monitoring/k8s-monitoring-values.yaml, src/devops_cli/k8s/cluster_job.py]
- Chosen: kube-state-metrics allowlists. The chart already deploys kube-state-metrics, and its info series end with the Job.
- Rejected: Custom Prometheus exporter. It adds code and credentials for data that kube-state-metrics already holds.
- Rejected: Grafana reads the Kubernetes API. The stack has no Kubernetes datasource and no Grafana cluster credential.
- Do item, branch or worktree values become labels on Service metrics?: No. They stay on the kube-state-metrics info series of live Jobs and in Loki structured metadata. They are not Service metric labels and not Loki stream labels. (best practice) [sources: docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md, docs/TELEMETRY.md]
- Chosen: kube-state-metrics info series. The values end with the Job and add no cardinality to Service metrics.
- Rejected: Service metric labels. Item, branch and worktree are unbounded values, and ADR 0022 forbids them.
- Rejected: Loki stream labels. Unbounded stream labels make too many streams.
- Do the branch and worktree annotations go on the Job only or also on its pod template?: They go on the Job and its pod template. The existing annotations mapping of build_job writes to both. The Service jobs table reads the Job's kube-state-metrics series, and no panel reads the pod annotation. ADR 0022 keeps the repository annotation on the pod for the log collector's stream label. (best practice) [sources: src/devops_cli/k8s/cluster_job.py:275, docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md]
- Chosen: Existing annotations mapping on Job and pod. It adds no parameter and no special case to build_job.
- Rejected: Job only with a new job_annotations parameter. It adds code for an annotation that no panel reads.
- Where do the branch and worktree values come from for each Job?: For a stage Job, the branch is StageTarget.branch, <type>/<issue>-<slug>. For an implement Job, it is ImplementTarget.branch. The worktree is the clone path of the lane that submits the Job. Both values are already in the submit round. [sources: src/devops_cli/roadmap/stage/stage.py, src/devops_cli/roadmap/implement/implement.py, src/devops_cli/roadmap/run.py]
- Which dashboard holds the Service jobs table and the Work log panel, and how is it changed?: The Roadmap Service dashboard, k8s/monitoring/dashboards/devops-roadmap-service.json. make dashboards builds it from the devops-roadmap-service table of k8s/monitoring/dashboards/services.toml with src/devops_cli/grafana/service_dashboard.py. Add the panels to the template and the spec, and regenerate the JSON. (best practice) [sources: k8s/README.md, k8s/monitoring/dashboards/services.toml, docs/DESIGN.md, src/devops_cli/grafana/service_dashboard.py]
- Chosen: Generated dashboard from the spec. The project generates dashboards from services.toml, and the docs row refuses a generated document that is not the output of its generator.
- Rejected: Hand-edit the JSON. The next dashboard build would overwrite the edit.
- Should this issue add branch and worktree annotations to Argo Workflows?: No. Defer it until a roadmap job runs on Argo Workflows. The repository has only the devops-cli-version WorkflowTemplate, which runs devops --version, and ADR 0008's go/no-go has not moved the roadmap rows. (best practice) [sources: k8s/argo-workflows/workflowtemplate-version.yaml, docs/adr/0008-argo-workflows-run-the-roadmap-jobs-after-a-measured-go.md]
- Chosen: Defer Argo Workflow annotations. No roadmap job runs on Argo Workflows, so no Workflow can carry the annotations.
- Rejected: Add them now. The only WorkflowTemplate runs devops --version and is not a roadmap job.
- Should the dashboard link to run history now?: No. The repository has no run record of feat(roadmap): keep a record of each roadmap run #4589 and no read-only /runs/{run_id} route. The FastAPI app mounts only health, status, workspace, telemetry and webhook routes. Defer the link until those land. (best practice) [sources: src/devops_cli/server/app.py, src/devops_cli/server/service.py, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
- Chosen: Defer the history link. The route and the run record do not exist, so the table would link to a route that no code serves.
- Rejected: Build the link now. It would add a dead link and depend on feat(roadmap): keep a record of each roadmap run #4589 and feat(service): serve a read-only roadmap API with OpenAPI #4586.
- Does kube-state-metrics keep the Job metric families?: Yes. The chart's default metric list holds kube_job.*, and the values do not set useDefaultAllowList to false. The allowlists add the Job labels and annotations to the existing series. [sources: k8s/monitoring/k8s-monitoring-values.yaml]
- Does kube-state-metrics need pod label allowlists for this view?: No. The Service jobs table reads the Job series. The Work log panel selects the pod by name in Loki. A pod label allowlist would export pod series that no panel reads. (best practice) [sources: k8s/monitoring/k8s-monitoring-values.yaml, k8s/monitoring/dashboards/devops-roadmap-service.json]
- Chosen: Jobs only. The table uses Job metrics, and the log panel uses the pod name.
- Rejected: Jobs and pods. It adds pod label series that no panel reads.
- How does the Service jobs table show the Service row?: It reads label_app_kubernetes_io_component from kube_job_labels. The Job already carries app.kubernetes.io/component with a value such as roadmap-stage or roadmap-implement. (best practice) [sources: src/devops_cli/k8s/cluster_job.py, k8s/monitoring/k8s-monitoring-values.yaml]
- Chosen: Component label allowlist. The Job already carries the label, and the table reads it.
- Rejected: Job name prefix. It couples the table to the Job naming scheme.
- Does this issue still depend on feat(roadmap): label Service Jobs by repository and item #4558 and feat(roadmap): a dashboard and alerts for the pipeline #3655?: No. The repository already has the feat(roadmap): label Service Jobs by repository and item #4558 Job labels in build_job and the generated Service dashboard of feat(roadmap): a dashboard and alerts for the pipeline #3655. The change uses them. The history link waits on feat(roadmap): keep a record of each roadmap run #4589 and feat(service): serve a read-only roadmap API with OpenAPI #4586, and that part is deferred. [sources: src/devops_cli/k8s/cluster_job.py, k8s/monitoring/dashboards/services.toml, k8s/monitoring/dashboards/devops-roadmap-service.json]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(monitoring)scope of the title gives the scope.It improves operational visibility of Service jobs but does not fix a broken or unsafe state.Operators gain a live view of jobs, branches and work log without manual kubectl and Loki queries.It spans two annotation keys, kube-state-metrics allowlists, Grafana panel JSON, and docs, but each part is small.Both let a person follow a Service run, but #3076 delivers a CLI command while this candidate delivers Grafana dashboard panels.dan-petty commentedon Nov 11, 2026
Scope from the iteration lane plan (2026-11-11)
This issue stays a child of #4517. It is also child 18 of #4667. The scope adds gate panels.
worktreeannotation names the clone path, not a Gitea work branch.Acceptance added:
Depends on: #4698.
devops-cli-service commentedon Nov 14, 2026
Refine cannot set this item to Ready at 0410772 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.
devops-cli-service commentedon Nov 17, 2026
Alternatives check: in-use
Reason: The searches and the repository facts show that the open, maintained kube-state-metrics project already provides exactly the mechanism the issue proposes: it exports Kubernetes Job labels and annotations to Prometheus through its --metric-labels-allowlist and --metric-annotations-allowlist flags, and its kube_job_* metric families already carry kube_job_labels, kube_job_annotations, kube_job_status_active, kube_job_status_start_time and kube_job_status_completion_time. The issue itself already names kube-state-metrics as a tool the cluster runs, and it needs no custom exporter or new API route; the table and log panels it wants are rendered by the Grafana/Loki stack the issue also names.
The repository already uses this tool.
Tool: kubernetes/kube-state-metrics (https://github.com/kubernetes/kube-state-metrics)
Covers:
Tools considered:
Searches run:
Sources:
Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 26, 2026
Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.
9 remaining items
devops-cli-service commentedon Nov 26, 2026
Cleared the stop at job by the rule
continue: the runner Job devops-cli-implement-devops-cli-4621-9be6d0 ended without a result. The classci_infraof the stop is one that a new attempt can fix. This is continuation 1 of 4 for this item. The item is Ready again. The Service takes it in the next round. The new Job takes the branch fromorigin, so it keeps the work that the run pushed there.docs(spec): plan #4621 Show Service jobs, branch and work log
docs(spec): take the environment files out of plan #4621
devops-cli-service commentedon Nov 26, 2026
The runner Job devops-cli-implement-devops-cli-4621-2ca43a ended: failed.
Image digest: sha256:4cc489070b36fcbcb50c042b238b5c60c4dff130ecb09ca5e7257fbb083d8e04
The last lines of its log:
Failure class:
spend_limit.Action taken: none.
Action left:
wait: wait for a person.The Job left this item without a result. The item is Blocked. When a retry can fix the class of the stop, the Service starts a new Job in the next round. The limit is
roadmap.implement.continuations_per_item, and the comment of that round says so. If no continuation is left, fix the cause. Then commentimplement: retry. A new runner image also clears the stop. This holds only if a retry can fix the class of the stop. The limits ofroadmap.implement.digest_clears_per_classandroadmap.implement.digest_clears_per_itemmust also allow it.docs(spec): plan #4621 Show Service jobs, branch and work log (#7285)