Fix panic in findBuffers when Any pattern is used

This commit is contained in:
Lou Knauer 2021-12-01 13:22:07 +01:00
parent 61f9056781
commit fee0061172
2 changed files with 2 additions and 1 deletions

View File

@ -375,7 +375,7 @@ func (m *MemoryStore) Read(selector Selector, metric string, from, to int64) ([]
if err != nil { if err != nil {
return nil, 0, 0, err return nil, 0, 0, err
} else if n == 0 { } 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 { } else if n > 1 {
if minfo.aggregation == AvgAggregation { if minfo.aggregation == AvgAggregation {
normalize := 1. / Float(n) normalize := 1. / Float(n)

View File

@ -111,6 +111,7 @@ func (l *level) findBuffers(selector Selector, offset int, f func(b *buffer) err
return err return err
} }
} }
return nil
} }
panic("impossible") panic("impossible")