2021-12-28 09:32:03 -08:00
|
|
|
Sentry.init do |config|
|
2022-04-15 18:48:09 -07:00
|
|
|
config.release = Retrospring::Version.to_s
|
|
|
|
|
2021-12-28 09:32:03 -08:00
|
|
|
config.dsn = APP_CONFIG[:sentry_dsn]
|
|
|
|
config.breadcrumbs_logger = [:active_support_logger, :http_logger]
|
|
|
|
|
|
|
|
# Set tracesSampleRate to 1.0 to capture 100%
|
|
|
|
# of transactions for performance monitoring.
|
|
|
|
# We recommend adjusting this value in production
|
2021-12-31 02:59:07 -08:00
|
|
|
config.traces_sample_rate = 0.25
|
2023-01-28 13:10:14 -08:00
|
|
|
|
2023-01-28 13:14:02 -08:00
|
|
|
exception_fingerprints = {
|
|
|
|
Excon::Error::ServiceUnavailable => 'external-service',
|
|
|
|
}
|
2023-01-28 13:18:43 -08:00
|
|
|
config.before_send = lambda do |event, hint|
|
2023-01-28 13:29:41 -08:00
|
|
|
# These are used for user-facing errors, not when something goes wrong
|
|
|
|
next if hint[:exception].is_a?(Errors::Base)
|
2023-01-28 13:10:14 -08:00
|
|
|
|
2023-01-28 13:30:03 -08:00
|
|
|
exception_class = hint[:exception].class
|
2023-01-28 13:14:02 -08:00
|
|
|
if exception_fingerprints.key?(exception_class)
|
2023-01-28 13:30:03 -08:00
|
|
|
event.fingerprint = [exception_fingerprints[exception_class]]
|
2023-01-28 13:14:02 -08:00
|
|
|
end
|
|
|
|
|
2023-01-28 13:10:14 -08:00
|
|
|
event
|
|
|
|
end
|
2021-12-28 09:32:03 -08:00
|
|
|
end
|