Module: Appsignal::Helpers::Metrics
- Included in:
- Appsignal
- Defined in:
- lib/appsignal/helpers/metrics.rb,
sig/appsignal.rbs
Instance Method Summary collapse
-
#add_distribution_value(name, value, tags = {}) ⇒ void
Report a distribution metric.
-
#increment_counter(name, value = 1.0, tags = {}) ⇒ void
Report a counter metric.
-
#set_gauge(name, value, tags = {}) ⇒ void
Report a gauge metric.
Instance Method Details
#add_distribution_value(name, value, tags = {}) ⇒ void
This method returns an undefined value.
Report a distribution metric.
@param name — The name of the metric.
@param value — The value of the metric.
@param tags — The tags for the metric. The Hash keys can be either a String or a Symbol. The tag values can be a String, Symbol, Integer, Float, TrueClass or FalseClass.
@see https://docs.appsignal.com/metrics/custom.html — Metrics documentation
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/appsignal/helpers/metrics.rb', line 64 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 = {}) ⇒ void
This method returns an undefined value.
Report a counter metric.
@param name — The name of the metric.
@param value — The value of the metric.
@param tags — The tags for the metric. The Hash keys can be either a String or a Symbol. The tag values can be a String, Symbol, Integer, Float, TrueClass or FalseClass.
@see https://docs.appsignal.com/metrics/custom.html — Metrics documentation
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/appsignal/helpers/metrics.rb', line 41 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 = {}) ⇒ void
This method returns an undefined value.
Report a gauge metric.
@param name — The name of the metric.
@param value — The value of the metric.
@param tags — The tags for the metric. The Hash keys can be either a String or a Symbol. The tag values can be a String, Symbol, Integer, Float, TrueClass or FalseClass.
@see https://docs.appsignal.com/metrics/custom.html — Metrics documentation
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/appsignal/helpers/metrics.rb', line 18 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 |