mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-26 13:11:11 -08:00
tsdb: register metrics after Head is initialized (#12876)
This avoids situations where metrics are scraped before the data they are trying to look at is initialized. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
a15e884e7a
commit
6dcbd653e9
|
@ -258,7 +258,6 @@ func NewHead(r prometheus.Registerer, l log.Logger, wal, wbl *wlog.WL, opts *Hea
|
|||
if err := h.resetInMemoryState(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
h.metrics = newHeadMetrics(h, r)
|
||||
|
||||
if opts.ChunkPool == nil {
|
||||
opts.ChunkPool = chunkenc.NewPool()
|
||||
|
@ -278,6 +277,7 @@ func NewHead(r prometheus.Registerer, l log.Logger, wal, wbl *wlog.WL, opts *Hea
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
h.metrics = newHeadMetrics(h, r)
|
||||
|
||||
return h, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue