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
35f57028
Commit
35f57028
authored
Apr 24, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'email-handler-metrics-ee' into 'master'
Make handler metric params more explicit See merge request !1696
parents
d2ec8706
3f5f10cb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
6 deletions
+30
-6
changelogs/unreleased/add-email-receiver-metrics.yml
changelogs/unreleased/add-email-receiver-metrics.yml
+4
-0
lib/gitlab/email/handler/base_handler.rb
lib/gitlab/email/handler/base_handler.rb
+4
-0
lib/gitlab/email/handler/create_issue_handler.rb
lib/gitlab/email/handler/create_issue_handler.rb
+4
-1
lib/gitlab/email/handler/create_note_handler.rb
lib/gitlab/email/handler/create_note_handler.rb
+6
-4
lib/gitlab/email/handler/ee/service_desk_handler.rb
lib/gitlab/email/handler/ee/service_desk_handler.rb
+4
-0
lib/gitlab/email/handler/unsubscribe_handler.rb
lib/gitlab/email/handler/unsubscribe_handler.rb
+6
-0
lib/gitlab/email/receiver.rb
lib/gitlab/email/receiver.rb
+2
-1
No files found.
changelogs/unreleased/add-email-receiver-metrics.yml
0 → 100644
View file @
35f57028
---
title
:
Add metrics events for incoming emails
merge_request
:
author
:
lib/gitlab/email/handler/base_handler.rb
View file @
35f57028
...
...
@@ -16,6 +16,10 @@ module Gitlab
def
execute
raise
NotImplementedError
end
def
metrics_params
{
handler:
self
.
class
.
name
}
end
end
end
end
...
...
lib/gitlab/email/handler/create_issue_handler.rb
View file @
35f57028
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
...
...
lib/gitlab/email/handler/create_note_handler.rb
View file @
35f57028
...
...
@@ -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
...
...
@@ -26,16 +28,16 @@ module Gitlab
record_name:
'comment'
)
end
def
metrics_params
super
.
merge
(
project:
project
)
end
private
def
author
sent_notification
.
recipient
end
def
project
sent_notification
.
project
end
def
sent_notification
@sent_notification
||=
SentNotification
.
for
(
mail_key
)
end
...
...
lib/gitlab/email/handler/ee/service_desk_handler.rb
View file @
35f57028
...
...
@@ -16,6 +16,10 @@ module Gitlab
send_thank_you_email!
if
from_address
end
def
metrics_params
super
.
merge
(
project:
project
)
end
private
def
service_desk_key
...
...
lib/gitlab/email/handler/unsubscribe_handler.rb
View file @
35f57028
...
...
@@ -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
...
...
@@ -17,6 +19,10 @@ module Gitlab
noteable
.
unsubscribe
(
sent_notification
.
recipient
)
end
def
metrics_params
super
.
merge
(
project:
project
)
end
private
def
sent_notification
...
...
lib/gitlab/email/receiver.rb
View file @
35f57028
require_dependency
'gitlab/email/handler'
# Inspired in great part by Discourse's Email::Receiver
...
...
@@ -32,6 +31,8 @@ module Gitlab
raise
UnknownIncomingEmail
unless
handler
Gitlab
::
Metrics
.
add_event
(
:receive_email
,
handler
.
metrics_params
)
handler
.
execute
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