Class: Hallmonitor::Outputters::NewRelic
- Inherits:
-
Hallmonitor::Outputter
- Object
- Hallmonitor::Outputter
- Hallmonitor::Outputters::NewRelic
- Defined in:
- lib/hallmonitor/outputters/new_relic.rb
Overview
Outputs events to NewRelic using their custom metrics API
Instance Attribute Summary
Attributes inherited from Hallmonitor::Outputter
Instance Method Summary collapse
-
#initialize(prefix = '') ⇒ NewRelic
constructor
Initializes a new instance.
- #process(event) ⇒ Object
Constructor Details
#initialize(prefix = '') ⇒ NewRelic
Initializes a new instance
8 9 10 11 |
# File 'lib/hallmonitor/outputters/new_relic.rb', line 8 def initialize(prefix='') raise "In order to use NewRelic, new_relic gem must be installed" unless defined?(::NewRelic::Agent) super(prefix) end |
Instance Method Details
#process(event) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/hallmonitor/outputters/new_relic.rb', line 13 def process(event) if(event.respond_to?(:duration)) ::NewRelic::Agent.record_metric(new_relic_name(event), event.duration) elsif(event.respond_to?(:value)) ::NewRelic::Agent.record_metric(new_relic_name(event), event.value) else ::NewRelic::Agent.increment_metric(new_relic_name(event), event.count) end end |