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
e6e11d90
Commit
e6e11d90
authored
Mar 25, 2020
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Custom fingerprint frequent, non-actionable exceptions
parent
5c215606
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
2 deletions
+36
-2
lib/gitlab/error_tracking.rb
lib/gitlab/error_tracking.rb
+36
-2
No files found.
lib/gitlab/error_tracking.rb
View file @
e6e11d90
...
@@ -2,6 +2,21 @@
...
@@ -2,6 +2,21 @@
module
Gitlab
module
Gitlab
module
ErrorTracking
module
ErrorTracking
# Exceptions in this group will receive custom Sentry fingerprinting
CUSTOM_FINGERPRINTING
=
%w[
Acme::Client::Error::BadNonce
Acme::Client::Error::NotFound
Acme::Client::Error::RateLimited
Acme::Client::Error::Timeout
Acme::Client::Error::UnsupportedOperation
ActiveRecord::ConnectionTimeoutError
ActiveRecord::QueryCanceled
Gitlab::RequestContext::RequestDeadlineExceeded
GRPC::DeadlineExceeded
JIRA::HTTPError
Rack::Timeout::RequestTimeoutException
]
.
freeze
class
<<
self
class
<<
self
def
configure
def
configure
Raven
.
configure
do
|
config
|
Raven
.
configure
do
|
config
|
...
@@ -14,8 +29,7 @@ module Gitlab
...
@@ -14,8 +29,7 @@ module Gitlab
# Sanitize authentication headers
# Sanitize authentication headers
config
.
sanitize_http_headers
=
%w[Authorization Private-Token]
config
.
sanitize_http_headers
=
%w[Authorization Private-Token]
config
.
tags
=
{
program:
Gitlab
.
process_name
}
config
.
tags
=
{
program:
Gitlab
.
process_name
}
# Debugging for https://gitlab.com/gitlab-org/gitlab-foss/issues/57727
config
.
before_send
=
method
(
:before_send
)
config
.
before_send
=
method
(
:add_context_from_exception_type
)
end
end
end
end
...
@@ -92,6 +106,13 @@ module Gitlab
...
@@ -92,6 +106,13 @@ module Gitlab
private
private
def
before_send
(
event
,
hint
)
event
=
add_context_from_exception_type
(
event
,
hint
)
event
=
custom_fingerprinting
(
event
,
hint
)
event
end
def
process_exception
(
exception
,
sentry:
false
,
logging:
true
,
extra
:)
def
process_exception
(
exception
,
sentry:
false
,
logging:
true
,
extra
:)
exception
.
try
(
:sentry_extra_data
)
&
.
tap
do
|
data
|
exception
.
try
(
:sentry_extra_data
)
&
.
tap
do
|
data
|
extra
=
extra
.
merge
(
data
)
if
data
.
is_a?
(
Hash
)
extra
=
extra
.
merge
(
data
)
if
data
.
is_a?
(
Hash
)
...
@@ -142,6 +163,7 @@ module Gitlab
...
@@ -142,6 +163,7 @@ module Gitlab
}
}
end
end
# Debugging for https://gitlab.com/gitlab-org/gitlab-foss/issues/57727
def
add_context_from_exception_type
(
event
,
hint
)
def
add_context_from_exception_type
(
event
,
hint
)
if
ActiveModel
::
MissingAttributeError
===
hint
[
:exception
]
if
ActiveModel
::
MissingAttributeError
===
hint
[
:exception
]
columns_hash
=
ActiveRecord
::
Base
columns_hash
=
ActiveRecord
::
Base
...
@@ -156,6 +178,18 @@ module Gitlab
...
@@ -156,6 +178,18 @@ module Gitlab
event
event
end
end
# Group common, mostly non-actionable exceptions by type and message,
# rather than cause
def
custom_fingerprinting
(
event
,
hint
)
ex
=
hint
[
:exception
]
return
event
unless
CUSTOM_FINGERPRINTING
.
include?
(
ex
.
class
.
name
)
event
.
fingerprint
=
[
'{{ default }}'
,
ex
.
class
.
name
,
ex
.
message
]
event
end
end
end
end
end
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