Skip to content

Commit b02dbb4

Browse files
Add block size to head block cut log message (#5771)
* Add block size to head block cut log message This change adds a size field to the 'head block cut' log message in the ingester. This improves observability by showing the actual size of the block when it's cut, making it easier to understand whether blocks are cut due to size or duration limits. Before: level=info msg="head block cut. enqueueing flush op" tenant=CashwalkAPI block=0e5151dd-4a5f-4fbe-b24e-d946f6faf894 After: level=info msg="head block cut. enqueueing flush op" tenant=CashwalkAPI block=0e5151dd-4a5f-4fbe-b24e-d946f6faf894 size=134217728 This is particularly useful for debugging OOMKilled issues caused by concurrent flushing of oversized blocks, as it provides immediate visibility into block sizes that correlate with memory pressure. Signed-off-by: backend-minho <[email protected]> * Add block size to head block cut log messages This change adds a size field to the log messages when cutting head blocks in both ingester and livestore modules. This improves observability by showing the actual size of blocks when they are cut, making it easier to understand whether blocks are cut due to size or duration limits. Changes: - ingester: Add size to 'head block cut. enqueueing flush op' message - livestore: Add size to 'queueing wal block for completion' message Example output (ingester): level=info msg="head block cut. enqueueing flush op" block=0e5151dd-4a5f-4fbe-b24e-d946f6faf894 size=134217728 This is particularly useful for debugging OOMKilled issues caused by concurrent flushing of oversized blocks, as it provides immediate visibility into block sizes that correlate with memory pressure. Signed-off-by: MinhoJJang <[email protected]> * Enhance logging for flush operations in ingester This update improves the logging for flush operations by adding a message when enqueueing a flush operation in the `cutOneInstanceToWal` method. Additionally, the log message for cutting head blocks has been simplified by removing the "enqueueing flush op" part, focusing on the block cut event itself. Changes: - ingester: Log message enhancement for flush operation enqueueing - ingester: Simplify log message for head block cut This enhancement aids in better tracking of flush operations and improves log clarity. Signed-off-by: [MinhoJJang] <[email protected]> --------- Signed-off-by: backend-minho <[email protected]> Signed-off-by: MinhoJJang <[email protected]> Signed-off-by: [MinhoJJang] <[email protected]> Co-authored-by: MinhoJJang <[email protected]>
1 parent 058140d commit b02dbb4

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

modules/ingester/flush.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func (i *Ingester) cutOneInstanceToWal(instance *instance, immediate bool) {
193193
}
194194

195195
if blockID != uuid.Nil {
196-
level.Info(log.Logger).Log("msg", "head block cut. enqueueing flush op", "tenant", instance.instanceID, "block", blockID)
196+
level.Info(log.Logger).Log("msg", "enqueueing flush op", "tenant", instance.instanceID, "block", blockID)
197197
// jitter to help when flushing many instances at the same time
198198
// no jitter if immediate (initiated via /flush handler for example)
199199
i.enqueue(&flushOp{

modules/ingester/instance.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ func (i *instance) CutBlockIfReady(maxBlockLifetime time.Duration, maxBlockBytes
287287
}
288288

289289
completingBlock := i.headBlock
290+
blockID := (uuid.UUID)(completingBlock.BlockMeta().BlockID)
291+
blockSize := completingBlock.DataLength()
292+
293+
level.Info(i.logger).Log("msg", "head block cut", "block", blockID, "size", blockSize)
290294

291295
// Now that we are adding a new block take the blocks mutex.
292296
// A warning about deadlocks!! This area does a hard-acquire of both mutexes.
@@ -304,7 +308,7 @@ func (i *instance) CutBlockIfReady(maxBlockLifetime time.Duration, maxBlockBytes
304308
return uuid.Nil, fmt.Errorf("failed to resetHeadBlock: %w", err)
305309
}
306310

307-
return (uuid.UUID)(completingBlock.BlockMeta().BlockID), nil
311+
return blockID, nil
308312
}
309313

310314
return uuid.Nil, nil

modules/livestore/instance.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,10 @@ func (i *instance) cutBlocks(immediate bool) (uuid.UUID, error) {
396396
}
397397

398398
id := (uuid.UUID)(i.headBlock.BlockMeta().BlockID)
399+
blockSize := i.headBlock.DataLength()
399400
i.walBlocks[id] = i.headBlock
400401

401-
level.Info(i.logger).Log("msg", "queueing wal block for completion", "block", id.String())
402+
level.Info(i.logger).Log("msg", "queueing wal block for completion", "block", id.String(), "size", blockSize)
402403

403404
err = i.resetHeadBlock()
404405
if err != nil {

0 commit comments

Comments
 (0)