Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-07 15:09:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-07 15:09:16 +0300
commit0254867cf0f3341fd63cc6da07290f1da91f99ef (patch)
tree4b3fb556c1cb8cde3459e56d58d5e61eb268d9ec /lib/gitlab/instrumentation
parentc417764f00abaa5d2224a50b8d43a15e40ef8790 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/instrumentation')
-rw-r--r--lib/gitlab/instrumentation/redis_base.rb13
-rw-r--r--lib/gitlab/instrumentation/redis_interceptor.rb7
2 files changed, 18 insertions, 2 deletions
diff --git a/lib/gitlab/instrumentation/redis_base.rb b/lib/gitlab/instrumentation/redis_base.rb
index 5e3c25b8dfb..7993e6e84cc 100644
--- a/lib/gitlab/instrumentation/redis_base.rb
+++ b/lib/gitlab/instrumentation/redis_base.rb
@@ -81,6 +81,19 @@ module Gitlab
self
end
+ def count_request
+ @request_counter ||= Gitlab::Metrics.counter(:redis_client_requests_total, 'Client side Redis request count, per Redis server')
+ @request_counter.increment({ storage: storage_key })
+ end
+
+ def count_exception(ex)
+ # This metric is meant to give a client side view of how the Redis
+ # server is doing. Redis itself does not expose error counts. This
+ # metric can be used for Redis alerting and service health monitoring.
+ @exception_counter ||= Gitlab::Metrics.counter(:redis_client_exceptions_total, 'Client side Redis exception count, per Redis server, per exception class')
+ @exception_counter.increment({ storage: storage_key, exception: ex.class.to_s })
+ end
+
private
def request_count_key
diff --git a/lib/gitlab/instrumentation/redis_interceptor.rb b/lib/gitlab/instrumentation/redis_interceptor.rb
index 725e9939ad9..6847e8aa65c 100644
--- a/lib/gitlab/instrumentation/redis_interceptor.rb
+++ b/lib/gitlab/instrumentation/redis_interceptor.rb
@@ -6,11 +6,14 @@ module Gitlab
module Instrumentation
module RedisInterceptor
def call(*args, &block)
- start = Time.now
-
+ instrumentation_class.count_request
instrumentation_class.redis_cluster_validate!(args.first)
+ start = Time.now
super(*args, &block)
+ rescue ::Redis::BaseError => ex
+ instrumentation_class.count_exception(ex)
+ raise ex
ensure
duration = (Time.now - start)