Class: Hallmonitor::Outputters::Datadog

Inherits:
Hallmonitor::Outputter show all
Defined in:
lib/hallmonitor/outputters/datadog.rb

Overview

An outputter for Dogstatsd

Defined Under Namespace

Classes: EventData

Instance Attribute Summary

Attributes inherited from Hallmonitor::Outputter

#name

Instance Method Summary collapse

Constructor Details

#initialize(dogstatsd, tags: {}) ⇒ Datadog

Builds a new DogstatsdOutputter.

Parameters:

  • dogstatsd (Datadog::Statsd)

    Dogstatd client instance to use

  • tags (Hash) (defaults to: {})

    Default tags to apply to all metrics sent to this outputter



16
17
18
19
20
# File 'lib/hallmonitor/outputters/datadog.rb', line 16

def initialize(dogstatsd, tags: {})
  super('dogstatsd')
  @tags = {}.merge(tags)
  @statsd = dogstatsd
end

Instance Method Details

#process(event) ⇒ Object

Sends events to datadog statsd instance

If the event’s value field is a hash, this will send multiple events to statsd with the original name suffixed by the name of the events in the hash



27
28
29
30
# File 'lib/hallmonitor/outputters/datadog.rb', line 27

def process(event)
  event_data = build_event_data(event)
  write(event_data)
end