Skip to content

fix(telemetry): a cluster job's usage counters count in increase(), though each job pod exports once #2039

Closed

Description

@dan-petty

Friction

Each in-cluster Job (k8s/devops/cronjob.yaml) is a new pod that exports its metrics once, when it exits. So each Job pod's series holds one sample, and increase() or rate() over it gives nothing. The AI usage counters of cluster jobs never show in the dashboards.

Evidence

Found while #1629 was built. #1629 gives roadmap-service one series identity (service.instance.id=roadmap-service) and a flush after each batch. A shared instance id does not fix the Jobs, because the CronJobs use concurrencyPolicy: Allow, so two Jobs can export to the same series at the same time and the collector drops out-of-order deltas.

Proposed remedy

  • Find the standard answer for short-lived batch jobs in OpenTelemetry: for example, export cumulative totals with a start time, so that Prometheus sees the first sample as an increase from zero, or have the collector's deltatocumulative processor keep the stream across pods.
  • Check it against the collector version in k8s/otel/ before any code change.
  • A test shows that two Job runs add up in the query that the dashboards use.

Activity

  1. added
    type/bug
    scope/telemetry
    on Oct 24, 2026
  2. dan-petty commented on Oct 24, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.

    • Priority: P2-Medium. This issue affects dashboard visibility and telemetry accuracy but does not block core functionality or cause system failures.
    • Value: Medium. Improves monitoring and observability for cluster jobs which helps with system health understanding.
    • Effort: Medium. Requires research into OpenTelemetry standards, collector configuration changes and testing across pod restart scenarios.
    • Related: fix(telemetry): delta metrics from one process can reach the collector out of order #792, which asks for a different change. Both items deal with telemetry issues but item 792 focuses on out-of-order delta metrics while this one addresses cluster job counter visibility.
  3. dan-petty commented on Oct 27, 2026

    @dan-petty
    OwnerAuthor

    The issue premise cannot be built as written against upstream Prometheus and OpenTelemetry systems. In Prometheus promql/functions.go, the function extrapolatedRate drops each series that contains fewer than two points (if len(samples.Points) < 2 { continue }). Therefore, the function increase() ignores a time series when a batch job exports only one sample upon termination. The collector's prometheus_remote_write exporter sends Prometheus Remote Write 1.0 payloads, which do not transmit start timestamps. Also, the deltatocumulative processor tracks stream identities by hashing resource attributes (service.name, service.instance.id, and host.name). Because each job pod uses a unique pod name, the collector assigns each pod to an isolated stream.

    A shared instance identifier does not resolve concurrent jobs. Because k8s/devops/cronjob.yaml sets concurrencyPolicy: Allow, concurrent jobs export interleaved deltas. The deltatocumulative processor drops interleaved deltas with delta.ErrOutOfOrder and delta.ErrOlderStart. Official Prometheus guidance advises using the Pushgateway with recording-rule deduplication, or tracking batch executions through gauges or logs. Per AGENTS.md rule 2, this item returns to New for re-evaluation.

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

    scope/telemetrytype/bug

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions