Class: PagingDatadogClient

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/monitor/plugins/paging_datadog_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(datadog_recipient, datadog_client) ⇒ PagingDatadogClient

Returns a new instance of PagingDatadogClient.



4
5
6
7
# File 'lib/bosh/monitor/plugins/paging_datadog_client.rb', line 4

def initialize(datadog_recipient, datadog_client)
  @datadog_recipient = datadog_recipient
  @datadog_client = datadog_client
end

Instance Attribute Details

#datadog_recipientObject (readonly)

Returns the value of attribute datadog_recipient.



2
3
4
# File 'lib/bosh/monitor/plugins/paging_datadog_client.rb', line 2

def datadog_recipient
  @datadog_recipient
end

Instance Method Details

#emit_event(event) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bosh/monitor/plugins/paging_datadog_client.rb', line 13

def emit_event(event)
  event_hash = event.to_hash
  new_message = if event.priority == "normal"
                  "#{event.msg_text} @#{@datadog_recipient}"
                else
                  event.msg_text
                end
  new_event = Dogapi::Event.new(new_message, event_hash)

  @datadog_client.emit_event(new_event)
end

#emit_points(metric, points, options = {}) ⇒ Object



9
10
11
# File 'lib/bosh/monitor/plugins/paging_datadog_client.rb', line 9

def emit_points(metric, points, options={})
  @datadog_client.emit_points(metric, points, options)
end