Class: Hallmonitor::Outputters::NewRelic

Inherits:
Hallmonitor::Outputter show all
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

#name

Instance Method Summary collapse

Constructor Details

#initialize(prefix = '') ⇒ NewRelic

Initializes a new instance

Parameters:

  • prefix (String) (defaults to: '')

    String to prefix all metrics with

Raises:

  • String if NewRelic::Agent isn’t defined (Library isn’t loaded)



8
9
10
11
12
13
# File 'lib/hallmonitor/outputters/new_relic.rb', line 8

def initialize(prefix = '')
  unless defined?(::NewRelic::Agent)
    fail 'In order to use NewRelic, new_relic gem must be installed'
  end
  super(prefix)
end

Instance Method Details

#process(event) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/hallmonitor/outputters/new_relic.rb', line 15

def process(event)
  if event.is_a?(Hallmonitor::TimedEvent)
    process_timed_event(event)
  elsif event.is_a?(Hallmonitor::GaugeEvent)
    process_gauge_event(event)
  else
    process_event(event)
  end
end