Merge branch 'email-handler-metrics' into 'master'
Make handler metric params more explicit See merge request !10854
This commit is contained in:
commit
7e335d2024
5 changed files with 17 additions and 5 deletions
|
@ -16,6 +16,10 @@ module Gitlab
|
|||
def execute
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
||||
def metrics_params
|
||||
{ handler: self.class.name }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
require 'gitlab/email/handler/base_handler'
|
||||
|
||||
module Gitlab
|
||||
|
@ -37,6 +36,10 @@ module Gitlab
|
|||
@project ||= Project.find_by_full_path(project_path)
|
||||
end
|
||||
|
||||
def metrics_params
|
||||
super.merge(project: project)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_issue
|
||||
|
|
|
@ -28,6 +28,10 @@ module Gitlab
|
|||
record_name: 'comment')
|
||||
end
|
||||
|
||||
def metrics_params
|
||||
super.merge(project: project)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def author
|
||||
|
|
|
@ -19,6 +19,10 @@ module Gitlab
|
|||
noteable.unsubscribe(sent_notification.recipient)
|
||||
end
|
||||
|
||||
def metrics_params
|
||||
super.merge(project: project)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def sent_notification
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
require_dependency 'gitlab/email/handler'
|
||||
|
||||
# Inspired in great part by Discourse's Email::Receiver
|
||||
|
@ -32,9 +31,7 @@ module Gitlab
|
|||
|
||||
raise UnknownIncomingEmail unless handler
|
||||
|
||||
Gitlab::Metrics.add_event(:receive_email,
|
||||
project: handler.try(:project),
|
||||
handler: handler.class.name)
|
||||
Gitlab::Metrics.add_event(:receive_email, handler.metrics_params)
|
||||
|
||||
handler.execute
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue