Set event fingerprint for exceptions relating to external services
This commit is contained in:
parent
7d5104d09d
commit
da9a170e67
|
@ -9,12 +9,21 @@ Sentry.init do |config|
|
|||
# We recommend adjusting this value in production
|
||||
config.traces_sample_rate = 0.25
|
||||
|
||||
exception_fingerprints = {
|
||||
Excon::Error::ServiceUnavailable => 'external-service',
|
||||
Twitter::Error::InternalServerError => 'external-service',
|
||||
}
|
||||
config.before_send do |event, hint|
|
||||
if hint[:exception].is_a?(Errors::Base)
|
||||
# These are used for user-facing errors, not when something goes wrong
|
||||
nil
|
||||
end
|
||||
|
||||
exception_class = hint[:exception].class.name
|
||||
if exception_fingerprints.key?(exception_class)
|
||||
event.fingerprint = [exception_fingerprints[hint[:exception].class.name]]
|
||||
end
|
||||
|
||||
event
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue