mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-05 21:57:09 +02:00
Log WAL segment loading time (#16336)
Improve readability of "WAL segment loaded" by logging the duration of each load. This helps make it easier to spot slow WAL file load times. Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
parent
74a1d96c72
commit
a721daf981
@ -784,6 +784,7 @@ func (h *Head) Init(minValidTime int64) error {
|
||||
}
|
||||
// Backfill segments from the most recent checkpoint onwards.
|
||||
for i := startFrom; i <= endAt; i++ {
|
||||
walSegmentStart := time.Now()
|
||||
s, err := wlog.OpenReadSegment(wlog.SegmentName(h.wal.Dir(), i))
|
||||
if err != nil {
|
||||
return fmt.Errorf("open WAL segment: %d: %w", i, err)
|
||||
@ -808,7 +809,7 @@ func (h *Head) Init(minValidTime int64) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
h.logger.Info("WAL segment loaded", "segment", i, "maxSegment", endAt)
|
||||
h.logger.Info("WAL segment loaded", "segment", i, "maxSegment", endAt, "duration", time.Since(walSegmentStart))
|
||||
h.updateWALReplayStatusRead(i)
|
||||
}
|
||||
walReplayDuration := time.Since(walReplayStart)
|
||||
|
Loading…
Reference in New Issue
Block a user