Skip to content

fix(telemetry): the collector remote-writes devops-cli metrics to the path alloy serves #829

Closed

Description

@dan-petty

Context & Rationale

On the homelab on 2026-10-01, the OpenTelemetry collector's prometheusremotewrite exporter dropped most of the metric points devops-cli sends:

The exporter writes to http://k8s-monitoring-alloy-metrics.monitoring.svc.cluster.local:9090/api/v1/write (k8s/otel/values.yaml:79-84). That endpoint came in with fdd4d0f (#734), which is in no tag yet. The obvious causes don't explain the timeouts. Each of these was checked read-only:

  • the Service exposes metrics:9090;
  • its endpoint, k8s-monitoring-alloy-metrics-0, is ready;
  • prometheusMetricsReceiver is enabled on alloy-metrics (k8s/monitoring/k8s-monitoring-values.yaml:68-70);
  • the monitoring perimeter admits the otel namespace on 9090 (k8s/monitoring/networkpolicy.yaml:47-53);
  • Alloy logs no errors or warnings.

While this goes on, devops-cli's command, review, RAG and spend metrics mostly never reach Prometheus. #692's dashboards then undercount or show nothing.

Scope & Deliverables

  • Deliverable:
    • Find why the collector's remote-write times out, and fix the configuration that causes it. Candidates to rule out, each with evidence:
      • Alloy's receiver forwarding to Prometheus synchronously (k8s/monitoring/k8s-monitoring-values.yaml:12);
      • the collector's default 5 s exporter timeout and queue settings;
      • batch size;
      • the deltatocumulative processor's output.
    • Record the cause in the task file.
  • Acceptance criteria:
    • On the homelab, after one hour of normal use, otelcol_exporter_send_failed_metric_points{exporter="prometheusremotewrite"} stays at zero, or at a stated, explained floor.
    • devops prometheus query 'devops_cli_command_total' returns the series for commands run in that hour.
    • A test pins the configuration change, for example the exporter's timeout or queue, or the receiver path.
    • Tests never touch the network. uv run devops ci passes.
  • Key questions:
  • Constraint: The agent reads the cluster only. Any change to the running stack goes through devops k8s deploy-stack, run by a person.

Strategic Alignment

Activity

  1. added
    type/bug
    scope/telemetry
    priority/p1-high
    on Oct 1, 2026
  2. added this to the v0.2.28 milestone on Oct 1, 2026
  3. dan-petty commented on Oct 1, 2026

    @dan-petty
    OwnerAuthor

    Placement (2026-10-01): v0.2.28. Value High, Effort Medium. Not Ready yet. If diagnosis shows the cause is fdd4d0f's collector configuration, which ships in v0.2.24, this becomes a P0 regression fix.

    Checked against release/v0.2.24 at d38251e. What stops it being Ready:

    • The root cause is unknown, and the item is an investigation with four candidate causes.
    • Key question deferred: whether to write directly to Prometheus or through Alloy is to be decided only after diagnosis.
    • Priority is conditional: it becomes P0 if the cause is fdd4d0f's configuration, which ships in v0.2.24.
    • Acceptance needs an hour of homelab verification and a devops k8s deploy-stack run by a person.
    • Stale line reference: prometheusMetricsReceiver is now at k8s-monitoring-values.yaml:78-80.
  4. dan-petty commented on Oct 1, 2026

    @dan-petty
    OwnerAuthor

    Diagnosis (2026-10-01, read-only on homelab-k3s and the v0.2.24 release tip 6919c02). None of the four candidate causes holds. Two separate faults explain the lost metrics.

    1. The release config posts to a path Alloy does not serve. This is a regression from fdd4d0f (feat(k8s): modernize monitoring stack, llm profiles, traefik routing, and remove squid proxy #734), which is not in v0.2.23.
      • k8s/otel/values.yaml:80 sends remote-write to k8s-monitoring-alloy-metrics...:9090/api/v1/write. Alloy's prometheus.receive_http, as k8s-monitoring 4.5.2's prometheusMetricsReceiver renders it, registers only POST /api/v1/metrics/write.
      • Probes from the cluster: /api/v1/write answers 404, and /api/v1/metrics/write answers 405 to a GET, so the route exists.
      • Alloy counts prometheus_receive_http_request_duration_seconds_count{method="POST",status_code="404"} 245, with no POST answered any other way, and prometheus_forwarded_samples_total{component_id="prometheus.receive_http.default"} 0.
      • The collector pod that ran Helm revisions 90-95, which carried this endpoint, logged failed to send WriteRequest ... "status_code": 404. The exporter treats a 4xx as permanent, so every devops-cli point is dropped without a retry.
      • Fix: change the path to /api/v1/metrics/write.
    2. The live collector runs the v0.2.23 values (Helm revision 96, deployed 2026-10-01 06:40 UTC).
      • Those values point at kube-prometheus-kube-prome-prometheus, a Service that disappeared at about 07:16 UTC. The name now returns NXDOMAIN.
      • The 1,214 Exporting failed. Dropping data. lines with context deadline exceeded all come from that dead host, not from Alloy.
      • This clears only when the collector is redeployed from a branch that contains the fix (devops k8s deploy-stack).

    Alloy's onward write to Prometheus is healthy: /api/v1/write on the Prometheus server shows 14,207 responses with code 204. Prometheus has had no devops_cli_* series for at least 3 days.

    By this issue's own rule, cause 1 makes this a P0 regression shipping in v0.2.24. It is Copilot thread k8s/otel/values.yaml:80 on release PR #905.

  5. modified the milestones: v0.2.28, v0.2.24 on Oct 1, 2026
  6. changed the title [-]fix(telemetry): the collector's remote-write to alloy times out and drops most devops-cli metrics[/-] [+]fix(telemetry): the collector remote-writes devops-cli metrics to the path alloy serves[/+] on Oct 1, 2026
  7. added
    priority/p0-critical
    and removed
    priority/p1-high
    on Oct 1, 2026
  8. dan-petty commented on Oct 1, 2026

    @dan-petty
    OwnerAuthor

    Closed by #910, merged into release/v0.2.24.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

  9. added a commit that references this issue on Oct 1, 2026
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

    priority/p0-criticalscope/telemetrytype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions