Fix remote write receiver endpoint for exemplars (#9414)

Signed-off-by: Serge Catudal <serge.catudal@gmail.com>
pull/9562/head
Serge Catudal 3 years ago committed by GitHub
parent 4c088ba8ba
commit 8c3eca84db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -305,12 +305,20 @@ func (s *memSeries) appendable(t int64, v float64) error {
// AppendExemplar for headAppender assumes the series ref already exists, and so it doesn't
// use getOrCreate or make any of the lset sanity checks that Append does.
func (a *headAppender) AppendExemplar(ref uint64, _ labels.Labels, e exemplar.Exemplar) (uint64, error) {
func (a *headAppender) AppendExemplar(ref uint64, lset labels.Labels, e exemplar.Exemplar) (uint64, error) {
// Check if exemplar storage is enabled.
if !a.head.opts.EnableExemplarStorage || a.head.opts.MaxExemplars.Load() <= 0 {
return 0, nil
}
// Get Series
s := a.head.series.getByID(ref)
if s == nil {
s = a.head.series.getByHash(lset.Hash(), lset)
if s != nil {
ref = s.ref
}
}
if s == nil {
return 0, fmt.Errorf("unknown series ref. when trying to add exemplar: %d", ref)
}

Loading…
Cancel
Save