Class: FastlyNsq::NewRelic
- Inherits:
-
Object
- Object
- FastlyNsq::NewRelic
- Includes:
- NewRelic::Agent::Instrumentation::ControllerInstrumentation
- Defined in:
- lib/fastly_nsq/new_relic.rb
Overview
FastlyNsq::NewRelic supports tracing methods with NewRelic if the newrelic_rpm
is enabled
Constant Summary collapse
- CATEGORY =
"OtherTransaction/FastlyNsqProcessor"
Instance Attribute Summary collapse
-
#agent ⇒ Object
readonly
Returns the value of attribute agent.
Instance Method Summary collapse
-
#enabled? ⇒ Boolean
Returns true if NewRelic is loaded and available.
-
#initialize(agent = nil) ⇒ NewRelic
constructor
Create a FastlyNsq::NewRelic instance.
-
#notice_error(exception) ⇒ Object
Notify NewRelic of an exception only if ‘enabled? == true` and an
agent
is defined. -
#trace_with_newrelic(**args) ⇒ Object
Trace passed block with new relic if ‘enabled? == true`.
Constructor Details
Instance Attribute Details
#agent ⇒ Object (readonly)
Returns the value of attribute agent.
16 17 18 |
# File 'lib/fastly_nsq/new_relic.rb', line 16 def agent @agent end |
Instance Method Details
#enabled? ⇒ Boolean
Returns true if NewRelic is loaded and available.
31 32 33 |
# File 'lib/fastly_nsq/new_relic.rb', line 31 def enabled? @enabled ||= Object.const_defined?(:NewRelic) end |
#notice_error(exception) ⇒ Object
Notify NewRelic of an exception only if ‘enabled? == true` and an agent
is defined
39 40 41 42 43 |
# File 'lib/fastly_nsq/new_relic.rb', line 39 def notice_error(exception) return unless enabled? && agent agent.notice_error(exception) end |
#trace_with_newrelic(**args) ⇒ Object
Trace passed block with new relic if ‘enabled? == true`
50 51 52 53 54 55 56 57 58 |
# File 'lib/fastly_nsq/new_relic.rb', line 50 def trace_with_newrelic(**args) if enabled? perform_action_with_newrelic_trace(trace_args(**args)) do yield end else yield end end |