Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cc9e92a0
Commit
cc9e92a0
authored
Apr 20, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'add-email-receiver-metrics' into 'master'
Add email receiver metrics See merge request !10814
parents
d5835016
19970e1d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
4 deletions
+12
-4
changelogs/unreleased/add-email-receiver-metrics.yml
changelogs/unreleased/add-email-receiver-metrics.yml
+4
-0
lib/gitlab/email/handler/create_note_handler.rb
lib/gitlab/email/handler/create_note_handler.rb
+2
-4
lib/gitlab/email/handler/unsubscribe_handler.rb
lib/gitlab/email/handler/unsubscribe_handler.rb
+2
-0
lib/gitlab/email/receiver.rb
lib/gitlab/email/receiver.rb
+4
-0
No files found.
changelogs/unreleased/add-email-receiver-metrics.yml
0 → 100644
View file @
cc9e92a0
---
title
:
Add metrics events for incoming emails
merge_request
:
author
:
lib/gitlab/email/handler/create_note_handler.rb
View file @
cc9e92a0
...
@@ -7,6 +7,8 @@ module Gitlab
...
@@ -7,6 +7,8 @@ module Gitlab
class
CreateNoteHandler
<
BaseHandler
class
CreateNoteHandler
<
BaseHandler
include
ReplyProcessing
include
ReplyProcessing
delegate
:project
,
to: :sent_notification
,
allow_nil:
true
def
can_handle?
def
can_handle?
mail_key
=~
/\A\w+\z/
mail_key
=~
/\A\w+\z/
end
end
...
@@ -32,10 +34,6 @@ module Gitlab
...
@@ -32,10 +34,6 @@ module Gitlab
sent_notification
.
recipient
sent_notification
.
recipient
end
end
def
project
sent_notification
.
project
end
def
sent_notification
def
sent_notification
@sent_notification
||=
SentNotification
.
for
(
mail_key
)
@sent_notification
||=
SentNotification
.
for
(
mail_key
)
end
end
...
...
lib/gitlab/email/handler/unsubscribe_handler.rb
View file @
cc9e92a0
...
@@ -4,6 +4,8 @@ module Gitlab
...
@@ -4,6 +4,8 @@ module Gitlab
module
Email
module
Email
module
Handler
module
Handler
class
UnsubscribeHandler
<
BaseHandler
class
UnsubscribeHandler
<
BaseHandler
delegate
:project
,
to: :sent_notification
,
allow_nil:
true
def
can_handle?
def
can_handle?
mail_key
=~
/\A\w+
#{
Regexp
.
escape
(
Gitlab
::
IncomingEmail
::
UNSUBSCRIBE_SUFFIX
)
}
\z/
mail_key
=~
/\A\w+
#{
Regexp
.
escape
(
Gitlab
::
IncomingEmail
::
UNSUBSCRIBE_SUFFIX
)
}
\z/
end
end
...
...
lib/gitlab/email/receiver.rb
View file @
cc9e92a0
...
@@ -32,6 +32,10 @@ module Gitlab
...
@@ -32,6 +32,10 @@ module Gitlab
raise
UnknownIncomingEmail
unless
handler
raise
UnknownIncomingEmail
unless
handler
Gitlab
::
Metrics
.
add_event
(
:receive_email
,
project:
handler
.
try
(
:project
),
handler:
handler
.
class
.
name
)
handler
.
execute
handler
.
execute
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment