From 563bfdd384bb9ae0b4e2a76a3b87c46ba3faa25d Mon Sep 17 00:00:00 2001 From: Jan Fajerski Date: Fri, 4 Oct 2024 12:01:54 +0200 Subject: [PATCH] storage: require selectors to always return matching results Signed-off-by: Jan Fajerski --- docs/querying/remote_read_api.md | 3 ++- storage/interface.go | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/querying/remote_read_api.md b/docs/querying/remote_read_api.md index efbd08e98..76de11234 100644 --- a/docs/querying/remote_read_api.md +++ b/docs/querying/remote_read_api.md @@ -17,7 +17,8 @@ Request are made to the following endpoint. ### Samples -This returns a message that includes a list of raw samples. +This returns a message that includes a list of raw samples matching the +requested query. ### Streamed Chunks diff --git a/storage/interface.go b/storage/interface.go index 7ac93129e..b7ef14ce9 100644 --- a/storage/interface.go +++ b/storage/interface.go @@ -114,6 +114,8 @@ type Querier interface { LabelQuerier // Select returns a set of series that matches the given label matchers. + // Results are not checked whether they match. Results that do not match + // may cause undefined behavior. // Caller can specify if it requires returned series to be sorted. Prefer not requiring sorting for better performance. // It allows passing hints that can help in optimising select, but it's up to implementation how this is used if used at all. Select(ctx context.Context, sortSeries bool, hints *SelectHints, matchers ...*labels.Matcher) SeriesSet @@ -152,6 +154,8 @@ type ChunkQuerier interface { LabelQuerier // Select returns a set of series that matches the given label matchers. + // Results are not checked whether they match. Results that do not match + // may cause undefined behavior. // Caller can specify if it requires returned series to be sorted. Prefer not requiring sorting for better performance. // It allows passing hints that can help in optimising select, but it's up to implementation how this is used if used at all. Select(ctx context.Context, sortSeries bool, hints *SelectHints, matchers ...*labels.Matcher) ChunkSeriesSet