Skip to content

fix(telemetry): devops-cli telemetry reaches the cluster's collector - #565

Merged
dan-petty merged 1 commit into
release/v0.2.23from
fix/547-telemetry-collector
Sep 25, 2026
Merged

dan-petty merged 1 commit into
release/v0.2.23from
fix/547-telemetry-collector

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Closes #547.

Problem

devops-cli exports OTLP to telemetry.endpoint, which defaults to http://localhost:4318. Nothing listens there, because the collector was ClusterIP only. As a result, Jaeger had no services and no devops_cli_* metric reached Prometheus. Exports also failed silently, and exports still queued at exit were cancelled.

Changes

  • k8s/otel/values.yaml:
    • the collector service is a NodePort, with the port left for Kubernetes to assign;
    • the remote-write exporter uses translation_strategy: UnderscoreEscapingWithoutSuffixes. Previously the default unit suffixes turned devops_cli_command_total into devops_cli_command_total_ratio, which no dashboard queries.
  • devops telemetry connect (telemetry/collector.py):
    • finds the collector's OTLP HTTP node port and the current context's API server host through kubectl;
    • checks it answers, then saves telemetry.endpoint and enables telemetry;
    • explains why when it can't (ClusterIP, no HTTP port, no answer);
    • writes no host or port into the repository.
  • Failures are counted (HTTP errors included). When a run's exports all fail, an interactive user is told at exit, at most once a day per endpoint. CI and test runs, which have no terminal, stay quiet.
  • Exports are drained at shutdown for up to a second instead of being cancelled; one trace had arrived without its root span.

Verification

Checked through a port-forward of the collector to localhost:4318:

  • Jaeger listed a devops-cli service, and each command's trace arrived (18 spans for a review).
  • devops_cli_* metrics reached Prometheus.

The NodePort and the metric naming take effect when the otel stack is next applied (devops k8s stack); after that, run devops telemetry connect.

The devops-cli and ai-spend dashboards also query metrics nothing sends over OTLP (review duration, findings, AI spend, which only devops server exposes). Those are filed as #564.

Test plan

  • tests/test_telemetry_collector_export.py (8 tests):
    • endpoint discovery, with the context flag first;
    • ClusterIP and missing-port errors;
    • connect saving an endpoint that answers, and keeping the configuration when it doesn't;
    • failures reported once a day to a terminal, and never without one;
    • drain at shutdown.
  • uv run devops ci --force: all 13 gates pass

devops-cli exported OTLP to localhost:4318, where nothing listened: the collector was
ClusterIP only. Jaeger had no services and the devops-cli dashboards were empty.
Failures were silent, and exports still queued at exit were cancelled.

- The collector service is a NodePort. `devops telemetry connect` finds it through
  kubectl, checks it answers and saves telemetry.endpoint; no host or port goes in the
  repository.
- Exports count failures, and an interactive user is told at exit, once a day per
  endpoint.
- Shutdown drains in-flight exports for up to a second instead of cancelling them.
- The collector's remote write keeps metric names as sent
  (translation_strategy: UnderscoreEscapingWithoutSuffixes), so
  devops_cli_command_total no longer arrives as ..._total_ratio.

Verified through a port-forward: traces in Jaeger, metrics in Prometheus. Dashboard
metrics nothing sends over OTLP are #564.

Closes #547
@dan-petty dan-petty added this to the v0.2.23 milestone Sep 25, 2026
@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 priority/p1-high Priority P1: high-impact work for the next planned milestone labels Sep 25, 2026
@dan-petty
dan-petty merged commit b5034f0 into release/v0.2.23 Sep 25, 2026
7 checks passed
@dan-petty
dan-petty deleted the fix/547-telemetry-collector branch September 25, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p1-high Priority P1: high-impact work for the next planned milestone 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.

1 participant