Skip to content
Snippets Groups Projects
Commit 08edb752 authored by Douwe Maan's avatar Douwe Maan Committed by Lin Jen-Shin
Browse files

Merge branch 'add-email-receiver-metrics' into 'master'

Add email receiver metrics

See merge request !10814
parent 91b1f03d
No related branches found
No related tags found
No related merge requests found
---
title: Add metrics events for incoming emails
merge_request:
author:
Loading
Loading
@@ -7,6 +7,8 @@ module Gitlab
class CreateNoteHandler < BaseHandler
include ReplyProcessing
 
delegate :project, to: :sent_notification, allow_nil: true
def can_handle?
mail_key =~ /\A\w+\z/
end
Loading
Loading
@@ -32,10 +34,6 @@ module Gitlab
sent_notification.recipient
end
 
def project
sent_notification.project
end
def sent_notification
@sent_notification ||= SentNotification.for(mail_key)
end
Loading
Loading
Loading
Loading
@@ -4,6 +4,8 @@ module Gitlab
module Email
module Handler
class UnsubscribeHandler < BaseHandler
delegate :project, to: :sent_notification, allow_nil: true
def can_handle?
mail_key =~ /\A\w+#{Regexp.escape(Gitlab::IncomingEmail::UNSUBSCRIBE_SUFFIX)}\z/
end
Loading
Loading
Loading
Loading
@@ -32,6 +32,10 @@ module Gitlab
 
raise UnknownIncomingEmail unless handler
 
Gitlab::Metrics.add_event(:receive_email,
project: handler.try(:project),
handler: handler.class.name)
handler.execute
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment