From ff0177896a5f1f3bb7c205b824cdbe85d48c15ee Mon Sep 17 00:00:00 2001 From: beorn7 Date: Sat, 29 Sep 2018 10:47:28 +0200 Subject: [PATCH] Be more precise about concurrency requirements Signed-off-by: beorn7 --- prometheus/collector.go | 3 ++- prometheus/registry.go | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/prometheus/collector.go b/prometheus/collector.go index 08491be..c0d70b2 100644 --- a/prometheus/collector.go +++ b/prometheus/collector.go @@ -40,7 +40,8 @@ type Collector interface { // Collector may yield any Metric it sees fit in its Collect method. // // This method idempotently sends the same descriptors throughout the - // lifetime of the Collector. + // lifetime of the Collector. It may be called concurrently and + // therefore must be implemented in a concurrency safe way. // // If a Collector encounters an error while executing this method, it // must send an invalid descriptor (created with NewInvalidDesc) to diff --git a/prometheus/registry.go b/prometheus/registry.go index 8d274e0..43e38e9 100644 --- a/prometheus/registry.go +++ b/prometheus/registry.go @@ -107,9 +107,6 @@ type Registerer interface { // Collector, and for providing a Collector that will not cause // inconsistent metrics on collection. (This would lead to scrape // errors.) - // - // It is in general not safe to register the same Collector multiple - // times concurrently. Register(Collector) error // MustRegister works like Register but registers any number of // Collectors and panics upon the first registration that causes an