Class: Ears::Middlewares::Appsignal
- Inherits:
-
Ears::Middleware
- Object
- Ears::Middleware
- Ears::Middlewares::Appsignal
- Defined in:
- lib/ears/middlewares/appsignal.rb
Overview
A middleware that automatically wraps Consumer#work in an Appsignal transaction.
Instance Method Summary collapse
- #call(delivery_info, metadata, payload, app) ⇒ Object
-
#initialize(opts) ⇒ Appsignal
constructor
A new instance of Appsignal.
Constructor Details
#initialize(opts) ⇒ Appsignal
Returns a new instance of Appsignal.
10 11 12 13 14 |
# File 'lib/ears/middlewares/appsignal.rb', line 10 def initialize(opts) super() @class_name = opts.fetch(:class_name) @namespace = opts.fetch(:namespace, 'background') end |
Instance Method Details
#call(delivery_info, metadata, payload, app) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ears/middlewares/appsignal.rb', line 16 def call(delivery_info, , payload, app) start_transaction do begin app.call(delivery_info, , payload) rescue => e ::Appsignal.set_error(e) raise end end end |