summaryrefslogtreecommitdiff
path: root/lib/gitlab/health_checks/redis_check.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/health_checks/redis_check.rb')
-rw-r--r--lib/gitlab/health_checks/redis_check.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/gitlab/health_checks/redis_check.rb b/lib/gitlab/health_checks/redis_check.rb
new file mode 100644
index 00000000000..57bbe5b3ad0
--- /dev/null
+++ b/lib/gitlab/health_checks/redis_check.rb
@@ -0,0 +1,25 @@
+module Gitlab
+ module HealthChecks
+ class RedisCheck
+ extend SimpleAbstractCheck
+
+ class << self
+ private
+
+ def metric_prefix
+ 'redis_ping'
+ end
+
+ def is_successful?(result)
+ result == 'PONG'
+ end
+
+ def check
+ catch_timeout 10.seconds do
+ Gitlab::Redis.with(&:ping)
+ end
+ end
+ end
+ end
+ end
+end