Class: GlassOctopus::Middleware::NewRelic
- Inherits:
-
Object
- Object
- GlassOctopus::Middleware::NewRelic
- Includes:
- NewRelic::Agent::Instrumentation::ControllerInstrumentation
- Defined in:
- lib/glass_octopus/middleware/new_relic.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ :name => "call", :category => "OtherTransaction/GlassOctopus", }.freeze
Instance Method Summary collapse
- #call(ctx) ⇒ Object
-
#initialize(app, klass, options = {}) ⇒ NewRelic
constructor
A new instance of NewRelic.
Constructor Details
#initialize(app, klass, options = {}) ⇒ NewRelic
Returns a new instance of NewRelic.
17 18 19 20 |
# File 'lib/glass_octopus/middleware/new_relic.rb', line 17 def initialize(app, klass, ={}) @app = app @options = DEFAULT_OPTIONS.merge(class_name: klass.name).merge() end |
Instance Method Details
#call(ctx) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/glass_octopus/middleware/new_relic.rb', line 22 def call(ctx) = @options.merge(params: { topic: ctx..topic, partition: ctx..partition, offset: ctx..offset, }) perform_action_with_newrelic_trace() do @app.call(ctx) end rescue Exception => ex ::NewRelic::Agent.notice_error(ex, :custom_params => { :message => ctx..to_h }) raise end |