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
path: root/lib
diff options
context:
space:
mode:
authorAndrew Newdigate <andrew@gitlab.com>2018-09-04 20:14:22 +0300
committerRobert Speicher <robert@gitlab.com>2018-09-04 20:14:22 +0300
commita62a65b869946db25e94ac6d250883cfe2d8758c (patch)
treefc302f2c309b12f8d98c92268b2ca536133c56c4 /lib
parent304f43c2fbe319720c7c372adea997be14aed9e9 (diff)
Add gitaly_calls to API structured logs
Diffstat (limited to 'lib')
-rw-r--r--lib/api/api.rb3
-rw-r--r--lib/gitlab/grape_logging/loggers/perf_logger.rb14
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