Sha256: b6432439af5510dd5eb23851c53af2465d667035e0510bccc270b9197947fe1b

Contents?: true

Size: 1.74 KB

Versions: 2

Compression:

Stored size: 1.74 KB

Contents

# frozen_string_literal: true

module Appsignal
  module Helpers
    module Metrics
      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

      def set_host_gauge(_key, _value)
        Appsignal::Utils::DeprecationMessage.message \
          "The `set_host_gauge` method has been deprecated. " \
            "Calling this method has no effect. " \
            "Please remove method call in the following file to remove " \
            "this message.\n#{caller.first}"
      end

      def set_process_gauge(_key, _value)
        Appsignal::Utils::DeprecationMessage.message \
          "The `set_process_gauge` method has been deprecated. " \
            "Calling this method has no effect. " \
            "Please remove method call in the following file to remove " \
            "this message.\n#{caller.first}"
      end

      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

      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
appsignal-3.5.4-java lib/appsignal/helpers/metrics.rb
appsignal-3.5.4 lib/appsignal/helpers/metrics.rb