Skip to content

Commit

Permalink
output: Don't output nano second field of next retry time in warning log
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ashie committed Sep 28, 2021
1 parent 8faede2 commit e7907eb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/fluent/plugin/output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e7907eb

Please sign in to comment.