Sha256: 6fa6a0a1cdb2ec4e60a4a8b0f7e9370568bea22df819be59fd01d0accc519b89

Contents?: true

Size: 1.77 KB

Versions: 42

Compression:

Stored size: 1.77 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.internal_logger
          .warn("Gauge value #{value} for key '#{key}' is too big")
      end

      def set_host_gauge(_key, _value)
        Appsignal::Utils::StdoutAndLoggerMessage.warning \
          "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::StdoutAndLoggerMessage.warning \
          "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.internal_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.internal_logger
          .warn("Distribution value #{value} for key '#{key}' is too big")
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
appsignal-3.13.1-java lib/appsignal/helpers/metrics.rb
appsignal-3.13.1 lib/appsignal/helpers/metrics.rb
appsignal-3.13.1.alpha.1-java lib/appsignal/helpers/metrics.rb
appsignal-3.13.1.alpha.1 lib/appsignal/helpers/metrics.rb
appsignal-3.13.0-java lib/appsignal/helpers/metrics.rb
appsignal-3.13.0 lib/appsignal/helpers/metrics.rb
appsignal-3.12.6-java lib/appsignal/helpers/metrics.rb
appsignal-3.12.6 lib/appsignal/helpers/metrics.rb
appsignal-3.12.5-java lib/appsignal/helpers/metrics.rb
appsignal-3.12.5 lib/appsignal/helpers/metrics.rb
appsignal-3.12.4-java lib/appsignal/helpers/metrics.rb
appsignal-3.12.4 lib/appsignal/helpers/metrics.rb
appsignal-3.12.3-java lib/appsignal/helpers/metrics.rb
appsignal-3.12.3 lib/appsignal/helpers/metrics.rb
appsignal-3.12.2-java lib/appsignal/helpers/metrics.rb
appsignal-3.12.2 lib/appsignal/helpers/metrics.rb
appsignal-3.12.1-java lib/appsignal/helpers/metrics.rb
appsignal-3.12.1 lib/appsignal/helpers/metrics.rb
appsignal-3.12.0-java lib/appsignal/helpers/metrics.rb
appsignal-3.12.0 lib/appsignal/helpers/metrics.rb