Skip to content

feat(roadmap): give each stage Job its own metric instance id #6364

Done

Description

@dan-petty

Problem

Each stage pod sends the one OpenTelemetry instance service.instance.id=roadmap-stage (k8s/devops/cronjob-stage.yaml, the env of the container). The comment there says that this holds only while one stage pod runs at a time (roadmap.stage.jobs = 1): two pods at once write one series, and Prometheus reads a counter reset.

So the Service cannot run a second stage Job without broken stage metrics. The stage queue held 204 Ready items on 2026-11-19, and at most 3 model Jobs ran at once against roadmap.model_jobs 6. The owner decision of 2026-11-19 is to allow roadmap.stage.jobs 2 only after #6319, after #4563 (shared GitHub budget), and after each stage Job has its own instance id.

The text of the default of roadmap.stage.jobs also names "one model tier" (defaults.py near the stage Job count, its settings description, and the module docstring of stage_submit.py), which the DeepSeek group no longer has.

Expected

  • The Service gives each stage Job that it creates its own service.instance.id as a plain env value (the admission policy refuses fieldRef), so two stage pods write two series, and a dashboard sums them.
  • A test: two Job specs that the Service builds carry different instance ids, and the stage dashboards and alerts read the sum over the instance label.
  • The texts that name one model tier state the current reason for the default.

Alternatives check of 2026-11-19: none.
Tool: none found.
Reason: Searches returned only OpenTelemetry Collector and Operator distributions, which pipeline telemetry centrally but neither mint a per-Job instance id nor build the Service's Job specs; the need is a change in the project's own code.

Lacks:

  • No tool mints a distinct service.instance.id for each stage Job
  • No tool sets that value as a plain Job env entry
  • No tool rewrites the stage dashboards and alerts to sum by instance
  • No tool updates the stage Job count setting text

Proposed design

Problem statement

The stage CronJob sends one OpenTelemetry instance id, service.instance.id=roadmap-stage, from every stage pod. Two stage Jobs that run at the same time write one Prometheus series, and Prometheus reads a counter reset. The Service cannot run a second stage Job until each Job has its own instance id. The text of the default of roadmap.stage.jobs also names one model tier, which the DeepSeek group no longer has.

Acceptance criteria

Requirement: Distinct stage Job instance id

The Service MUST set a distinct service.instance.id in OTEL_RESOURCE_ATTRIBUTES for each stage Job that it creates.

Scenario: Two stage Jobs

  • WHEN a test calls the Service's stage Job builder twice
  • THEN the two Job specs carry different service.instance.id values.

Requirement: Plain instance id value

The Service MUST write the instance id as a plain value and MUST NOT set valueFrom on OTEL_RESOURCE_ATTRIBUTES.

Scenario: Built Job env entry

  • WHEN a test builds a stage Job spec and reads its OTEL_RESOURCE_ATTRIBUTES entry
  • THEN the entry has a value and no valueFrom.

Requirement: Admitted stage Job

The admission policy MUST admit the stage Job that the Service builds with a per-Job instance id.

Scenario: Built stage Job

  • WHEN uv run devops ci --check --only k8s runs on the changed template and policy
  • THEN the command exits 0 and the policy still refuses an env entry with valueFrom.fieldRef.

Requirement: Stage queries sum the instances

The stage dashboard and alert queries MUST aggregate the instance label so that two stage pods show one line.

Scenario: Two stage pods

  • WHEN uv run devops ci --check --only k8s runs on the changed dashboard and alerts
  • THEN the command exits 0.

Requirement: Stage Job count reason

The text of the default of roadmap.stage.jobs and the module docstring of stage_submit.py MUST state the current reason and MUST NOT name one model tier.

Scenario: Settings description

  • WHEN a test reads the setting description and the module docstring
  • THEN both name the per-Job instance id and neither contains one model tier.

Existing Tool Considered

The alternatives check of 2026-11-19 records verdict none in the block of the issue body: no open, maintained tool mints a distinct service.instance.id for each stage Job, sets it as a plain Job env entry, rewrites the stage dashboards and alerts, or updates the stage Job count text. The proposal does that work in the project's own code: the Service derives the id from the Job name that it sets, writes it as a plain OTEL_RESOURCE_ATTRIBUTES value, and the stage queries aggregate the instance label. Written cost of the project's own code: about 15,000 output tokens and 2 hours of elapsed time to build, and about 1 hour per quarter to keep and fix.

Key questions

  • How does the Service give each stage Job a distinct service.instance.id?: The Service derives the value from the Job name that it sets, and writes OTEL_RESOURCE_ATTRIBUTES=service.instance.id=<job-name> as a plain environment value. The Job name is unique, and the Service knows it when it builds the spec. (best practice) [sources: k8s/devops/cronjob-stage.yaml, docs/CLUSTER.md:90, k8s/devops/roadmap-service/admissionpolicy.yaml]
    • Chosen: Job name. It is unique per Job, the Service sets it, and it is a plain value that the admission policy admits.
    • Rejected: Random UUID per Job. It is unique, but it does not map a series to a Job and adds a source of randomness.
    • Rejected: Pod name from fieldRef. The admission policy refuses valueFrom.fieldRef.
  • Does the admission policy roadmap-service-jobs need a change to admit the per-Job value?: No. The policy admits the plain environment names of the template, and OTEL_RESOURCE_ATTRIBUTES is one. It refuses valueFrom.fieldRef only. [sources: docs/CLUSTER.md:90, k8s/devops/roadmap-service/admissionpolicy.yaml, k8s/devops/cronjob-stage.yaml]
  • Which queries must sum over the instance label?: The stage panels of k8s/devops/dashboards/devops-cli.json and the stage rules of k8s/devops/alerts/inbox.yaml. Each query aggregates the label that carries service.instance.id, so two pods show one line. [sources: k8s/devops/dashboards/devops-cli.json, k8s/devops/alerts/inbox.yaml, k8s/devops/cronjob-stage.yaml]
  • What text replaces the reason that names one model tier in the default of roadmap.stage.jobs?: State that the default stays 1 because each stage pod writes one service.instance.id series, and that the owner decision of 2026-11-19 raises it to 2 only after fix(roadmap): A schema limit of the plan reply never fails a stage item #6319, feat(service): share the GitHub budget and holds in Valkey #4563 and this change. Remove the model-tier reason. (best practice) [sources: k8s/devops/cronjob-stage.yaml, docs/CLUSTER.md:90]
    • Chosen: State the instance-id reason and the owner-decision prerequisites. It matches the stage template comment and the owner decision of 2026-11-19.
    • Rejected: State only the instance-id reason. It hides the shared GitHub budget and fix(roadmap): A schema limit of the plan reply never fails a stage item #6319 that the owner decision also requires.
    • Rejected: Remove the reason. A reader then cannot tell why the default is 1.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/feature
    source/agent
    scope/roadmap
    status/new
    on Nov 19, 2026
  2. dan-petty commented on Nov 19, 2026

    @dan-petty
    OwnerAuthor
    • Related: fix(telemetry): keep one metric stream per workload #4697, which asks for a different change. Both ensure metric streams are uniquely identified per workload, but #4697 fixed host.name for Service pod restarts while the candidate sets service.instance.id for concurrent stage Jobs.
  3. added
    value/medium
    effort/low
    priority/p2-medium
    on Nov 19, 2026
  4. devops-cli-service commented on Nov 19, 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 (10)

    Searches run:

    • OpenTelemetry service.instance.id unique per pod automatically Kubernetes, results: 5
    • OpenTelemetry Collector resourcedetection processor set service.instance.id from pod UID, results: 5
    • opentelemetry-python Resource service.instance.id default uuid, results: 5
    • Prometheus OpenTelemetry metrics service.instance.id counter reset duplicate series, results: 5
    • kubernetes Job env var unique instance id template, results: 5
    • opentelemetry service.instance.id, results: 5
    • opentelemetry collector k8sattributes service.instance.id pod uid example config, results: 5
    • github open-telemetry semantic-conventions service.instance.id, results: 5
    • "service.instance.id" collector processor k8sattributes pod_uid, results: 5
    • prometheus otel "service.instance.id" instance label multiple pods same job, results: 5

    Sources:

  5. added
    status/ready
    and removed
    status/new
    on Nov 19, 2026
  6. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  7. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 25, 2026
  8. removed
    status/in-review
    owner/agent
    on Nov 25, 2026
  9. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-25 17:09 UTC

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/lowpriority/p2-mediumscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions