mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
Fix remote write receiver endpoint for exemplars (#9414)
Signed-off-by: Serge Catudal <serge.catudal@gmail.com>
This commit is contained in:
parent
4c088ba8ba
commit
8c3eca84db
|
@ -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
|
// 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.
|
// 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.
|
// Check if exemplar storage is enabled.
|
||||||
if !a.head.opts.EnableExemplarStorage || a.head.opts.MaxExemplars.Load() <= 0 {
|
if !a.head.opts.EnableExemplarStorage || a.head.opts.MaxExemplars.Load() <= 0 {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get Series
|
||||||
s := a.head.series.getByID(ref)
|
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 {
|
if s == nil {
|
||||||
return 0, fmt.Errorf("unknown series ref. when trying to add exemplar: %d", ref)
|
return 0, fmt.Errorf("unknown series ref. when trying to add exemplar: %d", ref)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue