From f34145a85eaff9d42ff629a2975e8118ab41773c Mon Sep 17 00:00:00 2001 From: beorn7 Date: Wed, 26 May 2021 23:41:30 +0200 Subject: [PATCH] Document implications of negative observations Signed-off-by: beorn7 --- prometheus/histogram.go | 7 ++++++- prometheus/summary.go | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/prometheus/histogram.go b/prometheus/histogram.go index 3346fa1c5..8425640b3 100644 --- a/prometheus/histogram.go +++ b/prometheus/histogram.go @@ -47,7 +47,12 @@ type Histogram interface { Metric Collector - // Observe adds a single observation to the histogram. + // Observe adds a single observation to the histogram. Observations are + // usually positive or zero. Negative observations are accepted but + // prevent current versions of Prometheus from properly detecting + // counter resets in the sum of observations. See + // https://prometheus.io/docs/practices/histograms/#count-and-sum-of-observations + // for details. Observe(float64) } diff --git a/prometheus/summary.go b/prometheus/summary.go index 50e48bad8..c5fa8ed7c 100644 --- a/prometheus/summary.go +++ b/prometheus/summary.go @@ -55,7 +55,12 @@ type Summary interface { Metric Collector - // Observe adds a single observation to the summary. + // Observe adds a single observation to the summary. Observations are + // usually positive or zero. Negative observations are accepted but + // prevent current versions of Prometheus from properly detecting + // counter resets in the sum of observations. See + // https://prometheus.io/docs/practices/histograms/#count-and-sum-of-observations + // for details. Observe(float64) }