Class: Hallmonitor::Outputters::Influxdb
- Inherits:
-
Hallmonitor::Outputter
- Object
- Hallmonitor::Outputter
- Hallmonitor::Outputters::Influxdb
- Defined in:
- lib/hallmonitor/outputters/influxdb.rb
Overview
An outputter for InfluxDB
Defined Under Namespace
Classes: EventData
Instance Attribute Summary
Attributes inherited from Hallmonitor::Outputter
Instance Method Summary collapse
-
#initialize(influxdb_client, tags = {}, transformer = nil) ⇒ Influxdb
constructor
Builds a new Influxdb outputter.
-
#process(event) ⇒ Object
Sends events to InfluxDB instance.
Constructor Details
#initialize(influxdb_client, tags = {}, transformer = nil) ⇒ Influxdb
Builds a new Influxdb outputter
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/hallmonitor/outputters/influxdb.rb', line 25 def initialize(influxdb_client, = {}, transformer = nil) unless influxdb_client.respond_to?(:write_point) raise 'Supplied InfluxDB Client was not as expected' end if transformer && !transformer.respond_to?(:transform) raise 'Supplied transformer does not respond to :transform' end super('influxdb') @tags = {}.merge() @client = influxdb_client || raise('Must supply an InfluxDb client') @transformer = transformer end |
Instance Method Details
#process(event) ⇒ Object
Sends events to InfluxDB instance
42 43 44 45 |
# File 'lib/hallmonitor/outputters/influxdb.rb', line 42 def process(event) event_data = build_event_data(event) transform_and_write(event, event_data) end |