Sha256: 4529e405260cd3f9a2abfd94c5e9d4c2f742f5ced23c00972e7a909221822674

Contents?: true

Size: 848 Bytes

Versions: 3

Compression:

Stored size: 848 Bytes

Contents

# We need to do this because of the way integration loading works
require "rack/timeout/base" unless defined?(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
    # Only rack-timeout 0.3.0+ provides the request environment, but we can't
    # gate this based on a gem version constant because rack-timeout does
    # not provide one.
    if defined?(env)
      { :fingerprint => ["{{ default }}", env["REQUEST_URI"]] }
    else
      {}
    end
  end
end

Rack::Timeout::Error.include(RackTimeoutExtensions)
Rack::Timeout::RequestTimeoutException.include(RackTimeoutExtensions)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sentry-raven-3.1.2 lib/raven/integrations/rack-timeout.rb
sentry-raven-3.1.1 lib/raven/integrations/rack-timeout.rb
sentry-raven-3.1.0 lib/raven/integrations/rack-timeout.rb