Skip to content

fix(telemetry): send cumulative metrics to the Prometheus OTLP receiver #4684

Closed

Description

@dan-petty

Problem or Motivation

No devops-cli OTLP series starts with a zero sample: count(min_over_time(devops_cli_github_requests_total[24h]) == 0) is empty (0 of 179 series). So increase() cannot count the first sample of a new stream. Runner Jobs: 680 commands in 7 d, increase() 555 (-18 %); job devops-cli-job sent 35 GitHub requests in 24 h, and increase() returns no data; the 45 series with 2 samples or fewer hold 86 requests, and increase() reads 16; the only Qdrant retry in 30 d reads 0. The setting 'remote_write_version: 2' (k8s/otel/values.yaml:125-127) has no effect: prometheusremotewriteexporter config.go at contrib v0.161.0 has no such key, and the confmap decoder ignores unknown keys of this exporter (IgnoreUnused, confmap/internal/decoder.go:278-279), so the collector logs no error. The exporter README calls remote write 2.0 'In Development ... not ready for usage'. docs/TELEMETRY.md:28-34, src/devops_cli/docs/generator.py:1109 and tests/telemetry/test_telemetry_instruments.py:1369 state or test the wrong claim. Also, deltatocumulative max_stale 1h (k8s/otel/values.yaml:70-71) is shorter than many export gaps: a retitle row series exports every ~65 min and its increase() is 0 over 22 samples; the Service has 344 equal consecutive samples in 24 h (each one a lost export); a workstation series counts 29 of 34 checks (-15 %).

Proposed Solution & Architectural Design

Keep deltatocumulative. In the metrics pipeline, replace the prometheus_remote_write exporter with an otlphttp exporter with metrics_endpoint http://prometheus-server.monitoring.svc.cluster.local:9090/api/v1/otlp/v1/metrics. In k8s/monitoring/prometheus-values.yaml (Prometheus v3.15.0) add the server flag web.enable-otlp-receiver and the config block otlp: {translation_strategy: UnderscoreEscapingWithoutSuffixes}; keep created-timestamp-zero-ingestion and out_of_order_time_window. The v3.15.0 OTLP translator passes the start time of each point to Append (storage/remote/otlptranslator/prometheusremotewrite/number_data_points.go:65,109), and the head adds the zero sample with fastRejectOOO (tsdb/head_append_v2.go:150-151, 362-410), so a zero cannot land in the middle of a series. Keep the cluster label with a transform statement that sets the datapoint attribute cluster. Remove remote_write_version. Set max_stale to 25h (the collector tracks 575 to 788 streams). Add a panel to otel-collector.json with sum by (error) (rate(otelcol_deltatocumulative_datapoints{error!=''}[$__rate_interval])) (0.18 % dropped today). Correct the docs and the generator text, and replace the test of the dead key with a test of the OTLP target. Record the rejected options in design.md: remote write 2.0 through its feature gate (In Development), otlp-native-delta-ingestion ('very early stage' on the Prometheus feature flags page), the Prometheus otlp-deltatocumulative flag (the same in-memory state), and a service.instance.id for each process (one series with one sample for each command). Known cost: one break in each devops-cli OTLP series, because the otel_scope_name label goes (promote_scope_metadata is false by default; no rule, panel or test selects it).

Target Subsystem

Kubernetes & Minikube Automation (OpenTelemetry Collector and Prometheus).

Existing Tool Considered

The Prometheus OTLP receiver (web.enable-otlp-receiver, Prometheus v3.15.0) and the collector otlphttp exporter are open tools with a standard interface. No new code. The solution lists the rejected options.

Acceptance Criteria

  • A test shows that the metrics pipeline of k8s/otel/values.yaml exports only to an otlphttp exporter whose metrics_endpoint ends in /api/v1/otlp/v1/metrics, and that max_stale is 25h or more.
  • A test shows that the Prometheus values hold web.enable-otlp-receiver, otlp.translation_strategy UnderscoreEscapingWithoutSuffixes and created-timestamp-zero-ingestion.
  • 'git grep remote_write_version' returns nothing.
  • Live, 24 h after the rollout: count(min_over_time(devops_cli_github_requests_total[24h]) == 0) > 0; for job devops-cli-job, sum(increase(devops_cli_command_total[24h])) is within 2 % of sum(max_over_time(devops_cli_command_total[24h])) (today 555 against 680 over 7 d); histogram_count(sum(increase(devops_cli_command_duration_seconds[1h]))) returns a value (native histograms arrive).
  • Live: the dropped share of deltatocumulative points stays under 0.5 % over 24 h (today 0.18 %), and the new otel-collector panel shows it.
  • Live: resets(devops_cli_github_throttle_wait_seconds[24h]) has no reset outside a pod or collector start; if one stays, the issue records the reproduction for the owner decision on an upstream report.

Files

  • k8s/otel/values.yaml
  • k8s/monitoring/prometheus-values.yaml
  • k8s/monitoring/dashboards/otel-collector.json
  • docs/TELEMETRY.md
  • src/devops_cli/docs/generator.py
  • tests/telemetry/test_telemetry_instruments.py
  • tests/fixtures/metrics/otel-collector.yaml

Dependencies

None.

Source: #4675

Activity

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

    @dan-petty
    OwnerAuthor

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

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/telemetry. The (telemetry) scope of the title gives the scope.
    • Priority: P2-Medium. Telemetry accuracy is degraded by 15 to 18 percent but the system still runs, so this is a correctness defect not an outage.
    • Value: Medium. Operators lose a measurable share of request counts and retry signals, which weakens alerting and capacity decisions.
    • Effort: Medium. The change touches the collector exporter, Prometheus values, docs, generator text, tests, and design.md, but the candidate states no new code is needed.
    • Related: fix(telemetry): created timestamps from the collector do not reach Prometheus, so increase() still drops the first export #2506, which asks for a different change. Both fix increase() dropping the first sample due to a missing zero sample, but the candidate switches to the OTLP receiver while #2506 used remote write 2.0.
  4. added
    priority/p2-medium
    owner/agent
    on Nov 11, 2026
  5. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Build note: max_stale stays at 1h. The other parts of the solution are built as written.

    Evidence:

    • The rules of the groups roadmap-service, roadmap-service-activity and crawl4ai in k8s/monitoring/prometheus-values.yaml count a series with no sample in the hour before by its last value: last_over_time(x[1h]) unless last_over_time(x[1h] offset 1h) (fix(monitoring): the roadmap Service alerts count the first value of a new series and see a lane of a new pod #2505). With max_stale 1h, such a series is a new stream, so its last value is the count of the hour. With 25h, a series that is idle for 1 h to 25 h keeps its old total. Example: a GitHub request series of the Service with a total of 50 that gets one request after 3 h reads 51 in RoadmapServiceGitHubRequestsHigh.
    • The zero sample alone gives the counts that a restarted stream lost. The OpenTelemetry Python SDK 1.45.1 gives a delta point the start time of the previous collection (opentelemetry/sdk/metrics/_internal/aggregation.py). So the zero sample of a restarted stream lands after the last sample of the old stream: the series reads old total, 0, new value, and increase() counts the new value. A zero sample that is older than the last sample of the series is refused (tsdb/head_append_v2.go lines 362 to 410 at v3.15.0), so a continued stream gets no zero sample in its middle.
    • A change of each rule to read the sample before the hour is a second fix on the fix(monitoring): the roadmap Service alerts count the first value of a new series and see a lane of a new pod #2505 fix.

    A test now holds max_stale at 1h together with the [1h] offset 1h rules. If 25h is still wanted, those rules must first change, in a separate issue.

  6. added
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 12, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 12, 2026
  8. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor
  9. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-12 05:27 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/p2-mediumscope/telemetrysource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions