Skip to content

Commit

Permalink
log successful/failed retries
Browse files Browse the repository at this point in the history
  • Loading branch information
yurymikhailenko committed Jan 14, 2021
1 parent a41a224 commit 0ef50c8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/logstash/outputs/mongodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ def receive(event)
write_to_mongodb(collection, [document])
end

if retry_count > 0
@logger.debug("Retry was successful",
:collection => collection,
:document => document,
:action => action,
:filter => filter_hash,
:update_expressions => expressions_hash)
end

rescue => e
logger_data = {:collection => collection,
:document => document,
Expand Down Expand Up @@ -242,6 +251,8 @@ def receive(event)
@logger.warn("Failed to send event to MongoDB retrying (#{retry_count.to_s}) in #{@retry_delay.to_s} seconds")
sleep(@retry_delay)
retry
elsif retry_count > 0
@logger.debug("No more retry attempts left, dropping operation", logger_data)
end
end
end
Expand Down

0 comments on commit 0ef50c8

Please sign in to comment.