mirror of
https://github.com/prometheus/prometheus.git
synced 2026-05-05 04:16:15 +02:00
Call PostCreation callback only after the new series is added to the mempotings (#15579)
Signed-off-by: alanprot <alanprot@gmail.com>
This commit is contained in:
parent
6823f58e59
commit
9d1abbb9ed
12
tsdb/head.go
12
tsdb/head.go
@ -1730,6 +1730,11 @@ func (h *Head) getOrCreateWithID(id chunks.HeadSeriesRef, hash uint64, lset labe
|
||||
h.numSeries.Inc()
|
||||
|
||||
h.postings.Add(storage.SeriesRef(id), lset)
|
||||
|
||||
// Adding the series in the postings marks the creation of series
|
||||
// as any further calls to this and the read methods would return that series.
|
||||
h.series.postCreation(lset)
|
||||
|
||||
return s, true, nil
|
||||
}
|
||||
|
||||
@ -2037,9 +2042,6 @@ func (s *stripeSeries) getOrSet(hash uint64, lset labels.Labels, createSeries fu
|
||||
// The callback prevented creation of series.
|
||||
return nil, false, preCreationErr
|
||||
}
|
||||
// Setting the series in the s.hashes marks the creation of series
|
||||
// as any further calls to this methods would return that series.
|
||||
s.seriesLifecycleCallback.PostCreation(series.labels())
|
||||
|
||||
i = uint64(series.ref) & uint64(s.size-1)
|
||||
|
||||
@ -2050,6 +2052,10 @@ func (s *stripeSeries) getOrSet(hash uint64, lset labels.Labels, createSeries fu
|
||||
return series, true, nil
|
||||
}
|
||||
|
||||
func (s *stripeSeries) postCreation(lset labels.Labels) {
|
||||
s.seriesLifecycleCallback.PostCreation(lset)
|
||||
}
|
||||
|
||||
type sample struct {
|
||||
t int64
|
||||
f float64
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user