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:
Diffstat (limited to 'lib/gitlab/instrumentation/redis_interceptor.rb')
-rw-r--r--lib/gitlab/instrumentation/redis_interceptor.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/gitlab/instrumentation/redis_interceptor.rb b/lib/gitlab/instrumentation/redis_interceptor.rb
index 8a64abb9f62..0f21a16793d 100644
--- a/lib/gitlab/instrumentation/redis_interceptor.rb
+++ b/lib/gitlab/instrumentation/redis_interceptor.rb
@@ -5,8 +5,21 @@ module Gitlab
module RedisInterceptor
APDEX_EXCLUDE = %w[brpop blpop brpoplpush bzpopmin bzpopmax xread xreadgroup].freeze
+ # These are temporary to help with investigating
+ # https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/1183
+ DURATION_ERROR_THRESHOLD = 1.25.seconds
+
+ class MysteryRedisDurationError < StandardError
+ attr_reader :backtrace
+
+ def initialize(backtrace)
+ @backtrace = backtrace
+ end
+ end
+
def call(*args, &block)
start = Gitlab::Metrics::System.monotonic_time # must come first so that 'start' is always defined
+ start_real_time = Time.now
instrumentation_class.instance_count_request
instrumentation_class.redis_cluster_validate!(args.first)
@@ -27,6 +40,13 @@ module Gitlab
instrumentation_class.add_duration(duration)
instrumentation_class.add_call_details(duration, args)
end
+
+ if duration > DURATION_ERROR_THRESHOLD && Feature.enabled?(:report_on_long_redis_durations, default_enabled: :yaml)
+ Gitlab::ErrorTracking.track_exception(MysteryRedisDurationError.new(caller),
+ command: command_from_args(args),
+ duration: duration,
+ timestamp: start_real_time.iso8601(5))
+ end
end
def write(command)