Fix redis check with_timing method usage

This commit is contained in:
Pawel Chojnacki 2017-07-25 15:17:05 +02:00
parent b1d6670d04
commit 37f27079fe

View file

@ -15,14 +15,13 @@ module Gitlab
end end
def metrics def metrics
with_timing method(:check) do |result, elapsed| result, elapsed = with_timing(&method(:check))
Rails.logger.error("#{human_name} check returned unexpected result #{result}") unless is_successful?(result) Rails.logger.error("#{human_name} check returned unexpected result #{result}") unless is_successful?(result)
[ [
metric("#{metric_prefix}_timeout", result.is_a?(Timeout::Error) ? 1 : 0), metric("#{metric_prefix}_timeout", result.is_a?(Timeout::Error) ? 1 : 0),
metric("#{metric_prefix}_success", is_successful?(result) ? 1 : 0), metric("#{metric_prefix}_success", is_successful?(result) ? 1 : 0),
metric("#{metric_prefix}_latency_seconds", elapsed) metric("#{metric_prefix}_latency_seconds", elapsed)
] ]
end
end end
private private