Skip to content

[prober] Warn when latency is both a number and a distribution - #1520

Merged
manugarg merged 3 commits into
mainfrom
latency-kind-clash-warning
Oct 4, 2026
Merged

manugarg merged 3 commits into
mainfrom
latency-kind-clash-warning

Conversation

@manugarg

@manugarg manugarg commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Every probe exports latency, and it's a distribution only for the probes that have latency_distribution. A config with both kinds of probes exports one metric name with two types. Prometheus stores it, but the result depends on which probe reports first: the metric type, the identity of the latency_bucket series (le="1" vs le="1.0"), and whether NHCB conversion happens at all. With native histograms, latency then selects float and histogram series together. OTel gets one name with two instrument types.

What changes

  • Warning: cloudprober logs one warning per latency metric name that is exported as a distribution by some probes and as a number by others. The warning names the probes (the first five on each side) and the fix (latency_metric_name), and says this will become an error in a future release.
  • When: at startup, on gRPC AddProbe (only for a clash involving the added probe), and in --configtest, which still passes. The check is options.LatencyTypeClashes (in probes/options), shared by all three.
  • Only with a Prometheus or OTel surfacer. Prometheus is a default surfacer, so this applies unless the config lists only other surfacers.
  • Not a clash: probes that already use different latency metric names, and distribution probes with different buckets. System and UDP listener probes are skipped as they export no latency.
  • TCP probe: connect_latency and tls_handshake_latency now follow latency_metric_name (as connect_<name> and tls_handshake_<name>), like the HTTP probe's latency breakdown metrics. Without this, the suggested fix left TCP probes still clashing on those two.

--configtest looks at all the probes in the config, while a running cloudprober looks only at the probes that run on that host (run_on). So configtest can warn about two probes that never run together.

--configtest now also reads --surfacers_config_file. It didn't before, so the check would have assumed the default surfacers (which include Prometheus) for configs that define their surfacers there.

Compatibility

TCP probes that set both tls_handshake and a non-default latency_metric_name get those two metrics renamed. Nothing else changes besides the new log line.

Testing

Unit tests for the check, the warning text and the TCP metric names. Also ran a local cloudprober with a mixed config: one warning for latency at startup and one in --configtest, none for the probe using latency_dist, and the TCP metrics come out as connect_latency_dist and tls_handshake_latency_dist.

Warn at startup, and on AddProbe, if some probes export a latency metric as a distribution (latency_distribution) and others export the same name as a number, and there is a Prometheus or OTel surfacer. One metric name with two types doesn't work well there: in Prometheus the metric type, the bucket series and the NHCB conversion depend on which probe reports first. This will become an error in a future release. The fix is to set latency_metric_name for the distribution probes.

To make that fix work for TCP probes, connect_latency and tls_handshake_latency now follow latency_metric_name, like the HTTP probe's latency breakdown metrics. This renames those two metrics for TCP probes that set both tls_handshake and latency_metric_name.
@manugarg
manugarg marked this pull request as ready for review October 4, 2026 08:38
Move the check to the config package, working on the probe and surfacer configs, so that --configtest and the prober share it. Configtest logs the same warning and still passes.

Also show only the first five probe names on each side in the warning, and fix the TCP probe's proto comment about the names of the connect and TLS handshake latency metrics.
Configtest didn't read --surfacers_config_file, so with the surfacers defined there, the latency type clash check assumed the default surfacers and warned even without a Prometheus or OTel surfacer.

Also move the check to probes/options, so that prober doesn't have to import the config package.
@manugarg
manugarg merged commit 5a7ed20 into main Oct 4, 2026
13 checks passed
@manugarg
manugarg deleted the latency-kind-clash-warning branch October 5, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant