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:
-rw-r--r--changelogs/unreleased/an-ap_log_gitaly_calls.yml5
-rw-r--r--lib/api/api.rb3
-rw-r--r--lib/gitlab/grape_logging/loggers/perf_logger.rb14
3 files changed, 21 insertions, 1 deletions
diff --git a/changelogs/unreleased/an-ap_log_gitaly_calls.yml b/changelogs/unreleased/an-ap_log_gitaly_calls.yml
new file mode 100644
index 00000000000..65bac55a73e
--- /dev/null
+++ b/changelogs/unreleased/an-ap_log_gitaly_calls.yml
@@ -0,0 +1,5 @@
+---
+title: Add gitaly_calls attribute to API logs
+merge_request: 21496
+author:
+type: other
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