From fee006117245d559ba1f25c716b293036503c565 Mon Sep 17 00:00:00 2001 From: Lou Knauer Date: Wed, 1 Dec 2021 13:22:07 +0100 Subject: [PATCH] Fix panic in findBuffers when Any pattern is used --- memstore.go | 2 +- selector.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/memstore.go b/memstore.go index 2332526..da6aa52 100644 --- a/memstore.go +++ b/memstore.go @@ -375,7 +375,7 @@ func (m *MemoryStore) Read(selector Selector, metric string, from, to int64) ([] if err != nil { return nil, 0, 0, err } else if n == 0 { - return nil, 0, 0, errors.New("metric not found") + return nil, 0, 0, errors.New("metric or host not found") } else if n > 1 { if minfo.aggregation == AvgAggregation { normalize := 1. / Float(n) diff --git a/selector.go b/selector.go index 9aa14a6..55577b8 100644 --- a/selector.go +++ b/selector.go @@ -111,6 +111,7 @@ func (l *level) findBuffers(selector Selector, offset int, f func(b *buffer) err return err } } + return nil } panic("impossible")