Sha256: 0f7e9120c25ad371bad76ec5b693d7bf578165932d922548ea1a28caeaae1f73

Contents?: true

Size: 1.54 KB

Versions: 232

Compression:

Stored size: 1.54 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::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

      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

      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

232 entries across 232 versions & 1 rubygems

Version Path
appsignal-3.4.1-java lib/appsignal/helpers/metrics.rb
appsignal-3.4.1 lib/appsignal/helpers/metrics.rb
appsignal-3.4.0-java lib/appsignal/helpers/metrics.rb
appsignal-3.4.0 lib/appsignal/helpers/metrics.rb
appsignal-3.3.10-java lib/appsignal/helpers/metrics.rb
appsignal-3.3.10 lib/appsignal/helpers/metrics.rb
appsignal-3.3.9-java lib/appsignal/helpers/metrics.rb
appsignal-3.3.9 lib/appsignal/helpers/metrics.rb
appsignal-3.3.8-java lib/appsignal/helpers/metrics.rb
appsignal-3.3.8 lib/appsignal/helpers/metrics.rb
appsignal-3.3.7-java lib/appsignal/helpers/metrics.rb
appsignal-3.3.7 lib/appsignal/helpers/metrics.rb
appsignal-3.3.6-java lib/appsignal/helpers/metrics.rb
appsignal-3.3.6 lib/appsignal/helpers/metrics.rb
appsignal-3.3.5-java lib/appsignal/helpers/metrics.rb
appsignal-3.3.5 lib/appsignal/helpers/metrics.rb
appsignal-3.3.4-java lib/appsignal/helpers/metrics.rb
appsignal-3.3.4 lib/appsignal/helpers/metrics.rb
appsignal-3.3.3-java lib/appsignal/helpers/metrics.rb
appsignal-3.3.3 lib/appsignal/helpers/metrics.rb