Add gitaly_calls to API structured logs

This commit is contained in:
Andrew Newdigate 2018-09-04 17:14:22 +00:00 committed by Robert Speicher
parent 304f43c2fb
commit a62a65b869
3 changed files with 21 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
title: Add gitaly_calls attribute to API logs
merge_request: 21496
author:
type: other

View File

@ -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

View File

@ -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