From a34d3e5fa6f1837a3d39fc79066c2b66b3fb0300 Mon Sep 17 00:00:00 2001 From: Arve Knudsen Date: Fri, 21 Jul 2023 18:56:54 +0200 Subject: [PATCH] Add LabelQuerier.LabelValuesSet method Signed-off-by: Arve Knudsen --- storage/interface.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/storage/interface.go b/storage/interface.go index 74ddc5acad..01358497ba 100644 --- a/storage/interface.go +++ b/storage/interface.go @@ -159,6 +159,12 @@ type LabelQuerier interface { // to label values of metrics matching the matchers. LabelValues(name string, matchers ...*labels.Matcher) ([]string, Warnings, error) + // LabelValuesSet returns an iterator over all potential values for a label name. + // It is not safe to use the strings beyond the lifetime of the querier. + // If matchers are specified the returned result set is reduced + // to label values of metrics matching the matchers. + LabelValuesSet(name string, matchers ...*labels.Matcher) (LabelValuesSet, error) + // LabelNames returns all the unique label names present in the block in sorted order. // If matchers are specified the returned result set is reduced // to label names of metrics matching the matchers. @@ -444,3 +450,16 @@ type ChunkIterable interface { } type Warnings []error + +// LabelValuesSet contains a set of label values. +type LabelValuesSet interface { + Next() bool + // At returns a label value. + At() string + // The error that iteration as failed with. + // When an error occurs, set cannot continue to iterate. + Err() error + // A collection of warnings for the whole set. + // Warnings could be return even iteration has not failed with error. + Warnings() Warnings +}