Class: Harness::LibratoAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/harness/adapters/librato_adapter.rb

Defined Under Namespace

Classes: Config, NameTooLong

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configObject



16
17
18
# File 'lib/harness/adapters/librato_adapter.rb', line 16

def self.config
  @config ||= Config.new
end

Instance Method Details

#log_counter(counter) ⇒ Object

Raises:



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/harness/adapters/librato_adapter.rb', line 33

def log_counter(counter)
  raise NameTooLong if counter.id.length > 63

  post({:counters => [{
    :name => sanitize(counter.id),
    :display_name => counter.name,
    :value => counter.value,
    :measure_time => counter.time.to_i,
    :source => counter.source,
    :attributes => { :display_units_short => counter.units }
  }]})
end

#log_gauge(gauge) ⇒ Object

Raises:



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/harness/adapters/librato_adapter.rb', line 20

def log_gauge(gauge)
  raise NameTooLong if gauge.id.length > 63

  post({:gauges => [{
    :name => sanitize(gauge.id),
    :display_name => gauge.name,
    :value => gauge.value,
    :measure_time => gauge.time.to_i,
    :source => gauge.source,
    :attributes => { :display_units_short => gauge.units }
  }]})
end