Skip to content

fix(telemetry): one metric stream across devops-cli builds #5338

Closed

Description

@dan-petty

Problem

A vetting review of #5324 (merged 2026-11-13 02:13Z as 0165669, for #4697) found two major defects and some minor ones. The core change is correct: the tracer keeps only service.name, service.namespace, service.instance.id, os.type and telemetry.sdk.* in the metric Resource, and both CronJobs set service.instance.id=devops-cli-job.

  1. The alert DevopsCliMetricStreamsShareSeries names a cause that cannot raise it. A different service.instance.id gives a different instance label. The real cause is version skew: a devops-cli process from a build before fix(telemetry): keep one metric stream per workload #4697 still sends host.name next to a new build with the same job and instance, so two cumulative streams write one series and its counts are wrong. At 02:38Z the alert was pending for 3 such pairs (a workstation, a runner pod, and roadmap-service after its pod change). The README row (k8s/README.md, Alerting) gives the same wrong cause, and it has 5 cells in a 4-column table, so GFM does not render the action.
  2. No test guards the workstation default any more (no OTEL_RESOURCE_ATTRIBUTES, so service.instance.id is the host name). The PR changed the only such test to set the variable. A change of the default to a constant or a per-process value passes all 466 telemetry tests. No test fails when the allowlist filter in tracer.py _ensure_meter is removed.

Proposed solution

  • In the OpenTelemetry collector metrics pipeline, before deltatocumulative, add a transform processor (OTTL) that deletes the resource attribute host.name, so every build, old or new, writes one stream. This is the cure; the description fix alone does not stop the wrong counts.
  • Rewrite the alert description, the expected description in tests/fixtures/prometheus_rules/metric_streams_tests.yaml and the README row: compare the label sets of the two target_info series; a different host_name means an old build runs next to a new one (old global install, long-lived MCP server, worktree on an old branch, Job from an old image); a different telemetry_sdk_* label means a second SDK; the alert clears 15 minutes after the old writer stops. Put the action in a cell that renders, and make the README test parse the table so a row with more cells than the header fails.
  • Add a test with OTEL_RESOURCE_ATTRIBUTES removed and platform.node set: the metric Resource equals the literal allowlisted dict with no host.name. Add host.name and k8s.pod.name to OTEL_RESOURCE_ATTRIBUTES in test_two_tracers_with_one_instance_send_equal_metric_resources, so removing the filter fails a test.
  • Pin the promtool cases: eval times that fail with a shorter for:, a quiet case for a job outside the regex, a case that needs the 15m lookback.
  • One line in docs/TELEMETRY.md: overlapping Job pods share one deltatocumulative stream; watch otelcol_deltatocumulative_datapoints{error!=""}.

Acceptance

  • After the merge, count by (job, instance) (last_over_time(target_info{job=~"devops-cli.*|roadmap-service"}[15m])) is 1 for every pair within 30 minutes, with an old and a new build both running.
  • The new tests fail on the current main and pass on the branch.
  • The rendered README shows the runbook action.

Process note: #5324 applied the CronJob env at the merge, before the image with the tracer change rolled (window 02:13Z to 02:27Z, no Job started in it). Ship a manifest change that needs new image code after the release that carries the code.

Activity

  1. added
    source/agent
    type/bug
    scope/telemetry
    status/new
    value/high
    effort/medium
    on Nov 13, 2026
  2. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
    • Priority: P1-High. A merged fix left a wrong alert cause and a test gap that allow silent regressions of the metric stream invariant. The regression commit 0165669 does not set P0: the author has no write access, and no caller attached it as evidence. A person can set P0 with the label priority/p0-critical.
    • Related: fix(telemetry): keep one metric stream per workload #4697, which asks for a different change. Both target one metric stream per workload; #4697 delivered the core tracer fix, the candidate fixes residual defects (wrong alert cause, missing OTTL strip of host.name, test gap) found in that delivery.
  3. added
    priority/p1-high
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 13, 2026
  4. removed
    status/in-review
    owner/agent
    on Nov 13, 2026
  5. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor

    Post-merge check: the collector rolled out at 04:45:21Z. At 04:55Z, count by (job, instance) (last_over_time(target_info{job=~"devops-cli.*|roadmap-service"}[5m])) gives 1 for each pair (the workstation devops-cli series and roadmap-service), and DevopsCliMetricStreamsShareSeries no longer fires.

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

    @devops-cli-service
    Contributor

    Live since 2026-11-13 05:08 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/mediumpriority/p1-highscope/telemetrysource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions