From 39728dc0a45a615d2e1046b6dbc47a7b95bd5075 Mon Sep 17 00:00:00 2001 From: Takuro Ashie Date: Tue, 28 Sep 2021 14:22:06 +0900 Subject: [PATCH] output: Don't output nanoseconds field of next retry time in warning log It might output unfriendly fractions due to Time class's behavior as of Ruby 2.7, and actual retry time isn't so accurate. In addition, fix inappropriate labels: retry_time -> retry_times next_retry_seconds -> next_retry_time e.g.) before: [warn]: #0 failed to flush the buffer. retry_times=9 next_retry_time=2021-07-19 13:00:22 24648004639507749129/34359738368000000000 after: [warn]: #0 failed to flush the buffer. retry_times=9 next_retry_time=2021-07-19 13:00:22 Signed-off-by: Takuro Ashie --- lib/fluent/plugin/output.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/fluent/plugin/output.rb b/lib/fluent/plugin/output.rb index 23fd29ab7e..354c6649f3 100644 --- a/lib/fluent/plugin/output.rb +++ b/lib/fluent/plugin/output.rb @@ -1275,7 +1275,7 @@ def update_retry_state(chunk_id, using_secondary, error = nil) unless @retry @retry = retry_state(@buffer_config.retry_randomize) if error - log.warn "failed to flush the buffer.", retry_time: @retry.steps, next_retry_seconds: @retry.next_time, chunk: chunk_id_hex, error: error + log.warn "failed to flush the buffer.", retry_times: @retry.steps, next_retry_time: @retry.next_time.round, chunk: chunk_id_hex, error: error log.warn_backtrace error.backtrace end return @@ -1304,11 +1304,11 @@ def update_retry_state(chunk_id, using_secondary, error = nil) if error if using_secondary msg = "failed to flush the buffer with secondary output." - log.warn msg, retry_time: @retry.steps, next_retry_seconds: @retry.next_time, chunk: chunk_id_hex, error: error + log.warn msg, retry_times: @retry.steps, next_retry_time: @retry.next_time.round, chunk: chunk_id_hex, error: error log.warn_backtrace error.backtrace else msg = "failed to flush the buffer." - log.warn msg, retry_time: @retry.steps, next_retry_seconds: @retry.next_time, chunk: chunk_id_hex, error: error + log.warn msg, retry_times: @retry.steps, next_retry_time: @retry.next_time.round, chunk: chunk_id_hex, error: error log.warn_backtrace error.backtrace end end