Module: Appsignal::Helpers::Metrics

Included in:
Appsignal
Defined in:
lib/appsignal/helpers/metrics.rb

Instance Method Summary collapse

Instance Method Details

#add_distribution_value(key, value, tags = {}) ⇒ Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/appsignal/helpers/metrics.rb', line 42

def add_distribution_value(key, value, tags = {})
  Appsignal::Extension.add_distribution_value(
    key.to_s,
    value.to_f,
    Appsignal::Utils::Data.generate(tags)
  )
rescue RangeError
  Appsignal.logger
    .warn("Distribution value #{value} for key '#{key}' is too big")
end

#increment_counter(key, value = 1.0, tags = {}) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/appsignal/helpers/metrics.rb', line 31

def increment_counter(key, value = 1.0, tags = {})
  Appsignal::Extension.increment_counter(
    key.to_s,
    value.to_f,
    Appsignal::Utils::Data.generate(tags)
  )
rescue RangeError
  Appsignal.logger
    .warn("Counter value #{value} for key '#{key}' is too big")
end

#set_gauge(key, value, tags = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/appsignal/helpers/metrics.rb', line 6

def set_gauge(key, value, tags = {})
  Appsignal::Extension.set_gauge(
    key.to_s,
    value.to_f,
    Appsignal::Utils::Data.generate(tags)
  )
rescue RangeError
  Appsignal.logger
    .warn("Gauge value #{value} for key '#{key}' is too big")
end

#set_host_gauge(key, value) ⇒ Object



17
18
19
20
21
22
# File 'lib/appsignal/helpers/metrics.rb', line 17

def set_host_gauge(key, value)
  Appsignal::Extension.set_host_gauge(key.to_s, value.to_f)
rescue RangeError
  Appsignal.logger
    .warn("Host gauge value #{value} for key '#{key}' is too big")
end

#set_process_gauge(key, value) ⇒ Object



24
25
26
27
28
29
# File 'lib/appsignal/helpers/metrics.rb', line 24

def set_process_gauge(key, value)
  Appsignal::Extension.set_process_gauge(key.to_s, value.to_f)
rescue RangeError
  Appsignal.logger
    .warn("Process gauge value #{value} for key '#{key}' is too big")
end