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
|
# We recommend adjusting this value in production
|
||||||
config.traces_sample_rate = 0.25
|
config.traces_sample_rate = 0.25
|
||||||
|
|
||||||
|
exception_fingerprints = {
|
||||||
|
Excon::Error::ServiceUnavailable => 'external-service',
|
||||||
|
Twitter::Error::InternalServerError => 'external-service',
|
||||||
|
}
|
||||||
config.before_send do |event, hint|
|
config.before_send do |event, hint|
|
||||||
if hint[:exception].is_a?(Errors::Base)
|
if hint[:exception].is_a?(Errors::Base)
|
||||||
# These are used for user-facing errors, not when something goes wrong
|
# These are used for user-facing errors, not when something goes wrong
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
exception_class = hint[:exception].class.name
|
||||||
|
if exception_fingerprints.key?(exception_class)
|
||||||
|
event.fingerprint = [exception_fingerprints[hint[:exception].class.name]]
|
||||||
|
end
|
||||||
|
|
||||||
event
|
event
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue