From b47181b629b6cfea2484ccdceb8f7abe1c8b6743 Mon Sep 17 00:00:00 2001 From: Christian Norbert Menges Date: Sun, 22 Oct 2023 15:10:39 +0200 Subject: [PATCH] buffer: Avoid calling dump_unique_id_hex if log level is not trace Signed-off-by: Christian Norbert Menges --- lib/fluent/plugin/buffer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fluent/plugin/buffer.rb b/lib/fluent/plugin/buffer.rb index 3871b4f25b..fd2c889140 100644 --- a/lib/fluent/plugin/buffer.rb +++ b/lib/fluent/plugin/buffer.rb @@ -580,7 +580,7 @@ def takeback_chunk(chunk_id) chunk = @dequeued.delete(chunk_id) return false unless chunk # already purged by other thread @queue.unshift(chunk) - log.trace "chunk taken back", instance: self.object_id, chunk_id: dump_unique_id_hex(chunk_id), metadata: chunk.metadata + log.on_trace { log.trace "chunk taken back", instance: self.object_id, chunk_id: dump_unique_id_hex(chunk_id), metadata: chunk.metadata } @queued_num[chunk.metadata] += 1 # BUG if nil @dequeued_num[chunk.metadata] -= 1 end @@ -610,7 +610,7 @@ def purge_chunk(chunk_id) @queued_num.delete(metadata) @dequeued_num.delete(metadata) end - log.trace "chunk purged", instance: self.object_id, chunk_id: dump_unique_id_hex(chunk_id), metadata: metadata + log.on_trace { log.trace "chunk purged", instance: self.object_id, chunk_id: dump_unique_id_hex(chunk_id), metadata: metadata } end nil