diff options
author | Andrew Newdigate <andrew@gitlab.com> | 2018-09-04 20:14:22 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2018-09-04 20:14:22 +0300 |
commit | a62a65b869946db25e94ac6d250883cfe2d8758c (patch) | |
tree | fc302f2c309b12f8d98c92268b2ca536133c56c4 /lib | |
parent | 304f43c2fbe319720c7c372adea997be14aed9e9 (diff) |
Add gitaly_calls to API structured logs
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/api.rb | 3 | ||||
-rw-r--r-- | lib/gitlab/grape_logging/loggers/perf_logger.rb | 14 |
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/api/api.rb b/lib/api/api.rb index c000666d992..850cef26449 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -16,7 +16,8 @@ module API GrapeLogging::Loggers::FilterParameters.new, GrapeLogging::Loggers::ClientEnv.new, Gitlab::GrapeLogging::Loggers::UserLogger.new, - Gitlab::GrapeLogging::Loggers::QueueDurationLogger.new + Gitlab::GrapeLogging::Loggers::QueueDurationLogger.new, + Gitlab::GrapeLogging::Loggers::PerfLogger.new ] allow_access_with_scope :api diff --git a/lib/gitlab/grape_logging/loggers/perf_logger.rb b/lib/gitlab/grape_logging/loggers/perf_logger.rb new file mode 100644 index 00000000000..e3b9c59bd6e --- /dev/null +++ b/lib/gitlab/grape_logging/loggers/perf_logger.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This module adds additional performance metrics to the grape logger +module Gitlab + module GrapeLogging + module Loggers + class PerfLogger < ::GrapeLogging::Loggers::Base + def parameters(_, _) + { gitaly_calls: Gitlab::GitalyClient.get_request_count } + end + end + end + end +end |