Class: GlassOctopus::Middleware::Sentry
- Inherits:
-
Object
- Object
- GlassOctopus::Middleware::Sentry
- Defined in:
- lib/glass_octopus/middleware/sentry.rb
Instance Method Summary collapse
-
#call(ctx) ⇒ Object
Based on Raven::Rack integration.
-
#initialize(app) ⇒ Sentry
constructor
A new instance of Sentry.
Constructor Details
#initialize(app) ⇒ Sentry
Returns a new instance of Sentry.
10 11 12 |
# File 'lib/glass_octopus/middleware/sentry.rb', line 10 def initialize(app) @app = app end |
Instance Method Details
#call(ctx) ⇒ Object
Based on Raven::Rack integration
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/glass_octopus/middleware/sentry.rb', line 15 def call(ctx) # clear context at the beginning of the processing to ensure a clean slate Raven::Context.clear! started_at = Time.now begin @app.call(ctx) rescue Raven::Error raise # Don't capture Raven errors rescue Exception => ex Raven.logger.debug("Collecting %p: %s" % [ ex.class, ex. ]) Raven.capture_exception(ex, :extra => { :message => ctx..to_h }, :time_spent => Time.now - started_at) raise end end |