Skip to content

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

Merged
dan-petty merged 3 commits into
mainfrom
fix/4684-otlp-receiver
Nov 12, 2026
Merged

dan-petty merged 3 commits into
mainfrom
fix/4684-otlp-receiver

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The OpenTelemetry collector sends the devops-cli metrics to the OTLP receiver of the Prometheus server, not through remote write. No devops-cli OTLP series started with a zero sample, so increase() did not count the first sample of a new stream: runner Jobs lost 18 % of their commands. The setting remote_write_version had no effect: the exporter at contrib v0.161.0 has no such key. The OTLP receiver of Prometheus v3.15.0 gets the start time of each point and writes a zero sample at the start of each new stream.

A transform processor keeps the cluster label. max_stale stays at 1h, and a test holds it there, because the roadmap-service rules read a series with no sample in the hour before as a new stream (#2505). The collector dashboard shows the share of delta points that deltatocumulative drops.

Closes #4684

Change: openspec/changes/archive/2026-11-12-4684-send-cumulative-metrics-to-the-prometheus/

The collector must send its running totals to the OTLP receiver of the
Prometheus server, which writes a zero sample at the start of each new
stream. max_stale must stay at 1h, the window that the roadmap-service
rules read. The collector dashboard draws a limit line for the dropped
share of delta points.
The collector sent remote write 1.0, and its setting remote_write_version
had no effect, so no devops-cli series started with a zero sample and
increase() did not count the first sample of a new stream. The OTLP
receiver of Prometheus v3.15.0 gets the start time of each point and
writes a zero sample at the start of each new stream.

max_stale stays at 1h, because the roadmap-service rules read a series
with no sample in the hour before as a new stream (#2505).
@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/telemetry OpenTelemetry tracing spans, Prometheus metrics, and Jaeger labels Nov 12, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Evidence for #4684 (local runs on the head commit).

Fail-to-pass (uv run devops ci fail-to-pass --base origin/main, exit 0): 3 failed on base, 143 passed, 0 errored.

  • tests/commands/k8s/test_k8s_monitoring_integration.py::test_otel_collector_sends_metrics_to_the_prometheus_otlp_receiver (KeyError: 'metrics_endpoint')
  • tests/telemetry/test_telemetry_instruments.py::test_prometheus_writes_a_zero_sample_at_the_start_time_of_each_otlp_point (KeyError: 'metrics_endpoint')
  • tests/commands/k8s/test_stack_dashboards.py::test_every_threshold_line_lies_within_the_axis[otel-collector.json] (the new limit line)

Collector config: helm template of chart opentelemetry-collector 0.175.0 with k8s/otel/values.yaml, then otelcol-contrib validate in the image otel/opentelemetry-collector-contrib:0.161.0: exit 0. Control: the same config with the OTTL function renamed to nosuchfn fails with processors::transform/cluster: unable to parse OTTL statement ... undefined function "nosuchfn", so the run parses the statement.

Prometheus config: helm template of chart prometheus 29.35.0 with k8s/monitoring/prometheus-values.yaml. The server container gets --enable-feature=created-timestamp-zero-ingestion, --web.enable-otlp-receiver and --web.enable-remote-write-receiver, and prometheus.yml holds otlp: {translation_strategy: UnderscoreEscapingWithoutSuffixes}. promtool check config --syntax-only (3.15.1): SUCCESS.

Tests: tests/commands/k8s/test_k8s_monitoring_integration.py, tests/commands/k8s/test_stack_dashboards.py, tests/prometheus/test_k8s_monitoring_alerting.py, tests/prometheus/test_k8s_monitoring_dashboards.py, tests/grafana/test_grafana_dashboards.py, tests/telemetry/test_telemetry_instruments.py, tests/telemetry/test_telemetry_collector_export.py, tests/docs/test_docs.py, tests/invariants/test_k8s_manifests.py, tests/invariants/test_committed_addresses.py: all pass. One test failed in the first run because a pre-commit stash put back the old values.yaml while it ran; it passes alone and in a second run of its file (92 passed).

@dan-petty

Copy link
Copy Markdown
Owner Author

Live steps after the merge. This pull request changes no live object; Argo CD syncs the two Applications from main.

  1. Argo CD syncs prometheus and otel-collector. If the collector starts before the Prometheus server runs with the OTLP receiver, the server refuses each export with an error that otlp_http does not retry, and the points of those minutes are lost. To lose none, sync prometheus first and wait until the server is ready, then sync otel-collector.
  2. Make sure that the server runs the receiver: kubectl -n monitoring get deploy prometheus-server -o jsonpath='{.spec.template.spec.containers[?(@.name=="prometheus-server")].args}' holds --web.enable-otlp-receiver.
  3. Make sure that the collector sends: in Prometheus, sum by (exporter) (rate(otelcol_exporter_sent_metric_points{exporter="otlp_http/prometheus"}[5m])) > 0, and sum by (exporter) (rate(otelcol_exporter_send_failed_metric_points[15m])) returns no series or 0.
  4. 24 h after the sync, run the live checks of fix(telemetry): send cumulative metrics to the Prometheus OTLP receiver #4684:
    • 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]))
    • histogram_count(sum(increase(devops_cli_command_duration_seconds[1h]))) returns a value
    • the panel "Delta Points Dropped by deltatocumulative" of otel-collector.json stays under 0.5 %
    • resets(devops_cli_github_throttle_wait_seconds[24h]) shows no reset outside a pod or collector start. If one stays, record the reproduction in fix(telemetry): send cumulative metrics to the Prometheus OTLP receiver #4684 for the owner decision on an upstream report.
  5. Optional: capture port 8888 of the collector again and make sure that otelcol_exporter_sent_metric_points carries exporter, server_address, server_port and url_path, as tests/fixtures/metrics/otel-collector.yaml now says.

Owner decision: the issue asked for max_stale: 25h. This pull request keeps 1h, because the roadmap-service rules count a series with no sample in the hour before by its last value (#2505), and with 25h that value is the old total of the stream. If 25h is still wanted, those rules must first read the sample before the hour, in a separate issue.

@dan-petty
dan-petty marked this pull request as ready for review November 12, 2026 04:59
@dan-petty
dan-petty merged commit a5288d1 into main Nov 12, 2026
27 checks passed
@dan-petty
dan-petty deleted the fix/4684-otlp-receiver branch November 12, 2026 04:59
dan-petty pushed a commit that referenced this pull request Nov 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.116.1](v0.116.0...v0.116.1)
(2026-11-12)


### Bug Fixes

* **telemetry:** send cumulative metrics to the Prometheus OTLP receiver
([#4930](#4930))
([a5288d1](a5288d1))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/telemetry OpenTelemetry tracing spans, Prometheus metrics, and Jaeger type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant