Module: Appsignal::Helpers::Metrics
- Included in:
- Appsignal
- Defined in:
- lib/appsignal/helpers/metrics.rb
Instance Method Summary collapse
-
#add_distribution_value(name, value, tags = {}) ⇒ Object
Report a distribution metric.
-
#increment_counter(name, value = 1.0, tags = {}) ⇒ Object
Report a counter metric.
-
#set_gauge(name, value, tags = {}) ⇒ Object
Report a gauge metric.
Instance Method Details
#add_distribution_value(name, value, tags = {}) ⇒ Object
Report a distribution metric.
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/appsignal/helpers/metrics.rb', line 61 def add_distribution_value(name, value, = {}) Appsignal::Extension.add_distribution_value( name.to_s, value.to_f, Appsignal::Utils::Data.generate() ) rescue RangeError Appsignal.internal_logger .warn("The distribution value '#{value}' for metric '#{name}' is too big") end |
#increment_counter(name, value = 1.0, tags = {}) ⇒ Object
Report a counter metric.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/appsignal/helpers/metrics.rb', line 39 def increment_counter(name, value = 1.0, = {}) Appsignal::Extension.increment_counter( name.to_s, value.to_f, Appsignal::Utils::Data.generate() ) rescue RangeError Appsignal.internal_logger .warn("The counter value '#{value}' for metric '#{name}' is too big") end |
#set_gauge(name, value, tags = {}) ⇒ Object
Report a gauge metric.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/appsignal/helpers/metrics.rb', line 17 def set_gauge(name, value, = {}) Appsignal::Extension.set_gauge( name.to_s, value.to_f, Appsignal::Utils::Data.generate() ) rescue RangeError Appsignal.internal_logger .warn("The gauge value '#{value}' for metric '#{name}' is too big") end |