Repository navigation
Description
Update 2026-11-26 (infra move): the log label setting goes to dan-petty/homelab.
k8s/monitoring/k8s-monitoring-values.yamlhere is gone after step 17. ThepodLogsViaLoki.annotationsentry is the follow-up issue.- This issue keeps the log filter, the VCS span attributes and the metric label.
- The merged plan
openspec/changes/4576-*needs a change: drop task group 6. Group 7 rendersk8s/overlays/homelab/devops, which step 17 deletes; renderk8s/devops.
Follow-up: dan-petty/homelab#270.
Problem or Motivation
The logs, metrics and traces of the roadmap Service name a repository in different ways. Loki has no repo label for a Job pod, and the router logs carry the repository only in the message text. Traces use service.repo. When the rows move into their own pods, one Grafana variable must filter logs, metrics and traces for one repository with one value.
Proposed Solution & Architectural Design
Use the casefolded key of RepoRef in all telemetry:
- A logging filter that copies
repo=keyinto each record of the router and the sweep (the pattern ofTraceCorrelationFilter,src/devops_cli/telemetry/logging_bridge.py:77). - The OpenTelemetry VCS span attributes (
vcs.provider.name=github,vcs.owner.name,vcs.repository.name) in place ofservice.repo. The item number is a span attribute only. podLogsViaLoki.annotations: {repo: roadmap.devops-cli/repository}ink8s/monitoring/k8s-monitoring-values.yamlof dan-petty/homelab (follow-up issue), so a unit pod's logs get the stream labelrepo.- The metric
repovalue fromRepoRef(otherfor a repository outsideservice.repos). Never an item number, a unit name, a branch or a pod name in a Service metric label.
Target Subsystem
Kubernetes & Minikube Automation (telemetry: src/devops_cli/telemetry/, k8s/monitoring/).
Existing Tool Considered
OpenTelemetry VCS semantic conventions and the k8s-monitoring chart's podLogsViaLoki.annotations (open tools). Cost: about 200,000 tokens and 2 hours to build, about 5,000 tokens a month to keep, about 20,000 tokens to fix.
Acceptance Criteria
{service_name="roadmap-service"} | json | repo="<owner>/<name>"returns lines from each repository's work.{repo="<owner>/<name>"}returns the lines of a unit pod, and the value is the casefoldedkeyin logs, metrics and traces.- TraceQL
{span.vcs.repository.name="<name>"}finds round spans. count by (repo)overdevops_cli_service_*gives onlyservice.reposvalues andother.- The router pod gets no new stream label.
Dependencies
- "feat(roadmap): name each repository's resources from one RepoRef".
- "feat(roadmap): label Service Jobs by repository and item" (the pod annotation).
Source: #4517
Alternatives check of 2026-11-19: in-use.
The item already names this tool.
Tool: open-telemetry/semantic-conventions (https://github.com/open-telemetry/semantic-conventions), Apache-2.0, last activity 2026-11-18, maintained.
Reason: Searches found the OpenTelemetry VCS semantic conventions and the k8s-monitoring chart, both open and maintained; they cover trace span attributes and the Loki pod-annotation stream label, but not the Python log-record filter or the bounded Service metric label.
Covers:
- vcs.provider.name, vcs.owner.name and vcs.repository.name span attributes
- Vendor-neutral convention read by Tempo and Grafana
- Adopted by ADR 0022 for span attributes
Lacks:
- No Python log-record filter that copies the repo key
- No Loki stream label from a pod annotation
- No bounded repo metric label with an other fallback
- No router JSON log body field
Proposed design
Problem statement
The roadmap Service names a repository in different ways in its logs, metrics and traces. The router and the sweep put the repository only in the message text, and traces use the custom attribute service.repo. One Grafana variable cannot filter logs, metrics and traces for one repository with one value. This change puts the casefolded RepoRef key in each signal. The Loki stream label from the pod annotation is the follow-up dan-petty/homelab#270, because the collector values left this repository in step 17.
Acceptance criteria
Requirement: Router log record carries the repository key
Each log record that the Service json handler writes while a RepoRef is current SHALL carry repo with the casefolded key.
Scenario: A router record names its repository
- WHEN a test sets the current
RepoReftodan-petty/devops-cliand writes one record from thedevops_clilogger, which does not propagate, through thejsonhandler ofservice_log_config - THEN the parsed JSON line holds
repoequal todan-petty/devops-cli
Requirement: Sweep log record holds the casefolded key
The repo field of a log record SHALL hold the casefolded RepoRef key, also when the display spelling has capital letters.
Scenario: A sweep record for a repository with capitals
- WHEN a test sets the current
RepoReftoDan-Petty/DevOps-CLIand writes one record through thejsonhandler ofservice_log_config - THEN the parsed JSON line holds
repoequal todan-petty/devops-cli
Requirement: No repository field without a current reference
A log record that the json handler writes with no current RepoRef MUST NOT carry a repo field.
Scenario: A service-level record with no repository
- WHEN a test clears the current
RepoRefand writes one record through thejsonhandler ofservice_log_config - THEN the parsed JSON line holds no
repokey
Requirement: Round span uses the VCS repository attributes
A round span SHALL carry vcs.provider.name, vcs.owner.name and vcs.repository.name, and MUST NOT carry service.repo.
Scenario: A round span names its repository
- WHEN a test starts a round for
dan-petty/devops-cliwith an in-memory span recorder - THEN the span holds
vcs.provider.name=github,vcs.owner.name=dan-pettyandvcs.repository.name=devops-cli, and holds noservice.repo
Requirement: Metric label for a configured repository
The repo label of a devops_cli_service_* metric SHALL equal the casefolded RepoRef key when service.repos holds the repository.
Scenario: A metric for a configured repository
- WHEN a test records a Service metric for
dan-petty/devops-cli, whichservice.reposholds - THEN the metric sample holds
repoequal todan-petty/devops-cli
Requirement: Metric label outside the configured repositories
The repo label of a devops_cli_service_* metric MUST be other for a repository that service.repos does not hold.
Scenario: A metric for a repository outside service.repos
- WHEN a test records a Service metric for a repository that
service.reposdoes not hold - THEN the metric sample holds
repoequal toother
Existing Tool Considered
open-telemetry/semantic-conventions (in-use): the item already names this tool, and ADR 0022 adopts its VCS span attributes. The alternatives check in the issue body records the verdict and what the tool covers and lacks. The tool lacks a Python log-record filter, a bounded metric label and a router JSON field. The change adds a logging.Filter that copies the casefolded RepoRef key from a contextvar into repo, and a metric repo value of key or other. Written cost: about 200,000 tokens and 2 hours to build, about 5,000 tokens a month to keep, and about 20,000 tokens to fix. The Loki stream label from a pod annotation is the follow-up dan-petty/homelab#270.
Key questions
- Which log handler carries the repository filter?: Attach a
logging.Filterto the Servicejsonhandler inservice_log_config, asTraceCorrelationFilteris attached there. A filter on the root logger misses a Service logger that does not propagate. (best practice) [sources: src/devops_cli/server/json_logs.py, src/devops_cli/telemetry/logging_bridge.py:77]- Chosen: Attach to the Service
jsonhandler. It sees each record that the handler formats, asTraceCorrelationFilterdoes, also from a logger withpropagate: False. - Rejected: Attach to the root logger. A Service logger that does not propagate bypasses it.
- Rejected: Attach to each module logger. It misses the records that libraries write and needs many call sites.
- Chosen: Attach to the Service
- How does a log record learn the repository of the work that it names?: A contextvar in a new
src/devops_cli/telemetry/repo_context.pyholds the currentRepoRef. The webhook handler sets it for a request, and the sweep sets it for each repository of a round. Alogging.Filtercopies the casefoldedkeyintorepo. (best practice) [sources: docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md, src/devops_cli/telemetry/logging_bridge.py:77]- Chosen: Contextvar set at the edge and read by a filter. ADR 0022 parses
owner/nameone time at the edge, and one filter names each record with no change to a call site. - Rejected: Parse the message or the record arguments. Messages change, and some records name no repository.
- Rejected: Pass
repoto each logging call. It changes many call sites and misses the records that libraries write.
- Chosen: Contextvar set at the edge and read by a filter. ADR 0022 parses
- Which span attributes name the repository?: Use
vcs.provider.name=github,vcs.owner.nameandvcs.repository.name, and removeservice.repo. The item number stays a span attribute only. (best practice) [sources: docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md]- Chosen: OpenTelemetry VCS conventions. An open, maintained convention that Tempo and Grafana read, and ADR 0022 section 6 adopts it.
- Rejected: Keep
service.repo. No convention or dashboard reads a project-specific key. - Rejected: Add a project
repospan attribute. It duplicates the VCS names, and no standard tool reads it.
- What value does the
repometric label take for a repository outsideservice.repos?:other. One fixed value bounds the label set, so a webhook from an unknown repository cannot grow it. (best practice) [sources: docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md, src/devops_cli/github/metrics.py:130]- Chosen:
otherfor a repository outsideservice.repos. It bounds the label cardinality and keeps a fixed value. - Rejected: The
RepoRefkey for every repository. A webhook from any repository would grow the metric label set without limit. - Rejected: No
repolabel. The metric cannot group by repository.
- Chosen:
- What does a log record do when no
RepoRefis current?: It carries norepofield.JsonLogFormatterwrites a context key only when the record attribute is not None. (best practice) [sources: src/devops_cli/server/json_logs.py]- Chosen: Omit
repowhen noRepoRefis current. A service-level record names no repository, and an empty value would mislead a query. - Rejected: Write
other.otheris a metric value for a repository outsideservice.repos, not for a record with no repository.
- Chosen: Omit
- Does the router pod get a
repostream label?: No. The chart annotation applies to unit pods only, and that mapping is the homelab follow-up. The router writesrepointo the JSON body of each line. (best practice) [sources: docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md, src/devops_cli/server/json_logs.py]- Chosen: Keep the router stream labels and put
repoin the JSON body. One pod keeps one stream set, and a| json | repo=...filter finds the lines of one repository. - Rejected: Add a
repostream label to the router pod. The router serves many repositories, so its stream set would multiply.
- Chosen: Keep the router stream labels and put
- What does
RepoRef.keyhold?: The casefoldedowner/name. TwoRepoRefvalues are equal when theirkeyvalues are equal. [sources: src/devops_cli/github/repo_ref.py:103, tests/github/test_repo_ref.py, docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md] - Where does the Loki stream label mapping for the pod annotation live?: In dan-petty/homelab, as the follow-up
dan-petty/homelab#270. The environment tree of the homelab cluster lives only in dan-petty/homelab, so this repository holds nok8s/monitoring/k8s-monitoring-values.yamlafter step 17. [sources: CONTEXT.md, docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md] - Which dependency remains for this issue?: No dependency remains. ADR 0022 is accepted, so feat(roadmap): name each repository's resources from one RepoRef #4533 is delivered. feat(roadmap): label Service Jobs by repository and item #4558 writes the pod annotation that the homelab chart maps, and no criterion here reads it. (best practice) [sources: docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md, CONTEXT.md]
- Chosen: Remove feat(roadmap): label Service Jobs by repository and item #4558 from the dependencies. The pod annotation is the homelab follow-up, and the log filter, the span attributes and the metric label do not read it.
- Rejected: Keep feat(roadmap): label Service Jobs by repository and item #4558. It writes an annotation that only the homelab chart maps, and this repository holds no such mapping.
- Which capability holds the remaining requirements?: The product telemetry capability of this repository. The plan folder holds no requirement of
monitoring-collectors, because step 17 retires that capability and an archive would recreate it with a placeholder Purpose. (best practice) [sources: CONTEXT.md, docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md]- Chosen: Keep only the product requirements. The collector files are in dan-petty/homelab, so this change adds no requirement to
monitoring-collectors. - Rejected: Keep the collector requirements in this change. The archive would recreate the retired spec with a placeholder Purpose and fail validation.
- Chosen: Keep only the product requirements. The collector files are in dan-petty/homelab, so this change adds no requirement to
- Which path does the plan render for the product manifests?:
k8s/devops, the product base that devops-cli ships. The plan renders no path underk8s/overlays/homelab/, which step 17 deletes. (best practice) [sources: CONTEXT.md]- Chosen:
k8s/devops. It is the product base that devops-cli ships, and it stays in this repository. - Rejected:
k8s/overlays/homelab/devops. Step 17 deletes it, so a render of that path fails.
- Chosen:
Fit
Fits in one pull request.
Suspected block
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.(telemetry)scope of the title gives the scope.Improves observability filtering but does not block a release or fix a failure.Lets one Grafana variable filter all three telemetry signals for one repository.Body states about 2 hours to build across four small file changes.Both deal with repository labels in Service metrics, but #3495 fixes counter accuracy while the candidate standardises the repo name value.devops-cli-service commentedon Nov 11, 2026
Refine cannot set this item to Ready at 818ac6f 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 14, 2026
Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.
devops-cli-service commentedon Nov 19, 2026
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 (10)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 19, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
20 remaining items
devops-cli-service commentedon Nov 26, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
dan-petty commentedon Nov 27, 2026
Finding from the homelab half (dan-petty/homelab#270, pull request dan-petty/homelab#440): the stage pods carry no annotation
roadmap.devops-cli/repository, so their log lines get norepostream label.The pull request maps the pod annotation to the Loki stream label
repowith the chart valuepodLogsViaLoki.annotations: {repo: roadmap.devops-cli/repository}. A live test with the rendered collector config gaverepo="dan-petty/homelab"on the lines of a pod with the annotation, and norepolabel on a pod with no annotation.Evidence of 2026-11-27:
kubectl -n devops get pods -o json: 12 of 12 pods of the Jobsimplementandfix-checkscarry the annotation with the casefoldedowner/name. 0 of 34 stage pods carry it. The stage pods carry the labelsroadmap.devops-cli/owner,roadmap.devops-cli/repoandroadmap.devops-cli/item.build_jobsets the annotation only when the caller passesrepo(src/devops_cli/k8s/cluster_job.py:314-322)._submitof the stage row callsapi.create(...)withlabels=stage_job_labels(ref, item.number)and norepo(src/devops_cli/roadmap/stage/stage_submit.py:325-332). The runner rows passrepo(_optionsinsrc/devops_cli/roadmap/job_launcher.py).The criterion "
{repo="<owner>/<name>"}returns the lines of a unit pod" holds for the stage pods only when the stage Job writes the annotation. #6594 asks for the annotation on the stage Workflow; the stage Job of today has none.The homelab change does not join the two pod labels in place of the annotation:
RepoRefchanges a part that is no label value, so the joined value is not alwayskey.devops-cli-service commentedon Nov 30, 2026
Released in v0.259.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.259.0
devops-cli-service commentedon Nov 30, 2026
Live since 2026-11-30 19:09 UTC