diff --git a/lib/raven/base.rb b/lib/raven/base.rb index 3d747cd7e..e662cc972 100644 --- a/lib/raven/base.rb +++ b/lib/raven/base.rb @@ -25,7 +25,7 @@ require 'English' module Raven - AVAILABLE_INTEGRATIONS = %w[delayed_job railties sidekiq rack rake].freeze + AVAILABLE_INTEGRATIONS = %w[delayed_job railties sidekiq rack rack-timeout rake].freeze class << self extend Forwardable diff --git a/lib/raven/integrations/rack-timeout.rb b/lib/raven/integrations/rack-timeout.rb new file mode 100644 index 000000000..83a084885 --- /dev/null +++ b/lib/raven/integrations/rack-timeout.rb @@ -0,0 +1,16 @@ +# rubocop:disable Style/FileName +# We need to do this because of the way integration loading works +require 'rack-timeout' + +# This integration is a good example of how to change how exceptions +# get grouped by Sentry's UI. Simply override #raven_context in +# the exception class, and append something to the fingerprint +# that will distinguish exceptions in the way you desire. +module RackTimeoutExtensions + def raven_context + { :fingerprint => ["{{ default }}", env["REQUEST_URI"]] } + end +end + +Rack::Timeout::Error.include RackTimeoutExtensions +Rack::Timeout::RequestTimeoutException.include RackTimeoutExtensions diff --git a/spec/raven/raven_spec.rb b/spec/raven/raven_spec.rb index acac4d6d9..9d9f778b0 100644 --- a/spec/raven/raven_spec.rb +++ b/spec/raven/raven_spec.rb @@ -238,7 +238,7 @@ def ivars(object) it 'injects all integrations except those passed as an argument' do expect(Raven).to receive(:load_integration).once.with('rake') - Raven.inject_without(:delayed_job, :logger, :railties, :sidekiq, :rack) + Raven.inject_without(:delayed_job, :logger, :railties, :sidekiq, :rack, :"rack-timeout") end end