Log when GC / block write starts
Right now Prometheus only logs when these operations are completed. It's a bit surprising to see suddenly a message saying "I was busy doing X for the past N minutes" so let's add a message when the operation starts, so it's easier to understand what Prometheus was doing at any point in time when reading logs. Signed-off-by: Lukasz Mierzwa <l.mierzwa@gmail.com>
This commit is contained in:
parent
c8deefb038
commit
31282d67b7
|
@ -648,6 +648,7 @@ func (db *DB) keepSeriesInWALCheckpointFn(last int) func(id chunks.HeadSeriesRef
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *DB) truncate(mint int64) error {
|
func (db *DB) truncate(mint int64) error {
|
||||||
|
db.logger.Info("series GC started")
|
||||||
db.mtx.RLock()
|
db.mtx.RLock()
|
||||||
defer db.mtx.RUnlock()
|
defer db.mtx.RUnlock()
|
||||||
|
|
||||||
|
|
|
@ -562,6 +562,7 @@ func (c *LeveledCompactor) Write(dest string, b BlockReader, mint, maxt int64, b
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
||||||
uid := ulid.MustNew(ulid.Now(), rand.Reader)
|
uid := ulid.MustNew(ulid.Now(), rand.Reader)
|
||||||
|
c.logger.Info("write block started", "mint", mint, "maxt", maxt, "ulid", uid)
|
||||||
|
|
||||||
meta := &BlockMeta{
|
meta := &BlockMeta{
|
||||||
ULID: uid,
|
ULID: uid,
|
||||||
|
@ -596,7 +597,7 @@ func (c *LeveledCompactor) Write(dest string, b BlockReader, mint, maxt int64, b
|
||||||
}
|
}
|
||||||
|
|
||||||
c.logger.Info(
|
c.logger.Info(
|
||||||
"write block",
|
"write block completed",
|
||||||
"mint", meta.MinTime,
|
"mint", meta.MinTime,
|
||||||
"maxt", meta.MaxTime,
|
"maxt", meta.MaxTime,
|
||||||
"ulid", meta.ULID,
|
"ulid", meta.ULID,
|
||||||
|
|
|
@ -1420,6 +1420,7 @@ func (db *DB) compactOOOHead(ctx context.Context) error {
|
||||||
// Each ULID in the result corresponds to a block in a unique time range.
|
// Each ULID in the result corresponds to a block in a unique time range.
|
||||||
// The db.cmtx mutex should be held before calling this method.
|
// The db.cmtx mutex should be held before calling this method.
|
||||||
func (db *DB) compactOOO(dest string, oooHead *OOOCompactionHead) (_ []ulid.ULID, err error) {
|
func (db *DB) compactOOO(dest string, oooHead *OOOCompactionHead) (_ []ulid.ULID, err error) {
|
||||||
|
db.logger.Info("out-of-order compaction started")
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
||||||
blockSize := oooHead.ChunkRange()
|
blockSize := oooHead.ChunkRange()
|
||||||
|
|
|
@ -1416,6 +1416,7 @@ func (h *Head) truncateOOO(lastWBLFile int, newMinOOOMmapRef chunks.ChunkDiskMap
|
||||||
// truncateSeriesAndChunkDiskMapper is a helper function for truncateMemory and truncateOOO.
|
// truncateSeriesAndChunkDiskMapper is a helper function for truncateMemory and truncateOOO.
|
||||||
// It runs GC on the Head and truncates the ChunkDiskMapper accordingly.
|
// It runs GC on the Head and truncates the ChunkDiskMapper accordingly.
|
||||||
func (h *Head) truncateSeriesAndChunkDiskMapper(caller string) error {
|
func (h *Head) truncateSeriesAndChunkDiskMapper(caller string) error {
|
||||||
|
h.logger.Info("Head GC started", "caller", caller)
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
headMaxt := h.MaxTime()
|
headMaxt := h.MaxTime()
|
||||||
actualMint, minOOOTime, minMmapFile := h.gc()
|
actualMint, minOOOTime, minMmapFile := h.gc()
|
||||||
|
|
Loading…
Reference in New Issue