Module: Gitlab::HealthChecks::SimpleAbstractCheck
Instance Method Summary
collapse
#available?, #human_name, #name
Instance Method Details
#metrics ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/gitlab/health_checks/simple_abstract_check.rb', line 23
def metrics
result, elapsed = with_timing(&method(:check))
return if result.nil?
Gitlab::AppLogger.error("#{human_name} check returned unexpected result #{result}") unless successful?(result)
[
metric("#{metric_prefix}_timeout", result.is_a?(Timeout::Error) ? 1 : 0),
metric("#{metric_prefix}_success", successful?(result) ? 1 : 0),
metric("#{metric_prefix}_latency_seconds", elapsed)
]
end
|
#readiness ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/gitlab/health_checks/simple_abstract_check.rb', line 8
def readiness
check_result = check
return if check_result.nil?
if successful?(check_result)
HealthChecks::Result.new(name, true)
elsif check_result.is_a?(Timeout::Error)
HealthChecks::Result.new(name, false, "#{human_name} check timed out")
else
HealthChecks::Result.new(name, false, "unexpected #{human_name} check result: #{check_result}")
end
rescue StandardError => e
HealthChecks::Result.new(name, false, "unexpected #{human_name} check result: #{e}")
end
|