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.5.3-java lib/appsignal/helpers/metrics.rb
appsignal-3.5.3 lib/appsignal/helpers/metrics.rb
appsignal-3.5.2-java lib/appsignal/helpers/metrics.rb
appsignal-3.5.2 lib/appsignal/helpers/metrics.rb
appsignal-3.5.1-java lib/appsignal/helpers/metrics.rb
appsignal-3.5.1 lib/appsignal/helpers/metrics.rb
appsignal-3.5.0-java lib/appsignal/helpers/metrics.rb
appsignal-3.5.0 lib/appsignal/helpers/metrics.rb
appsignal-3.4.16-java lib/appsignal/helpers/metrics.rb
appsignal-3.4.16 lib/appsignal/helpers/metrics.rb
appsignal-3.4.15-java lib/appsignal/helpers/metrics.rb
appsignal-3.4.15 lib/appsignal/helpers/metrics.rb
appsignal-3.4.14-java lib/appsignal/helpers/metrics.rb
appsignal-3.4.14 lib/appsignal/helpers/metrics.rb
appsignal-3.4.13-java lib/appsignal/helpers/metrics.rb
appsignal-3.4.13 lib/appsignal/helpers/metrics.rb
appsignal-3.4.12-java lib/appsignal/helpers/metrics.rb
appsignal-3.4.12 lib/appsignal/helpers/metrics.rb
appsignal-3.4.11-java lib/appsignal/helpers/metrics.rb
appsignal-3.4.11 lib/appsignal/helpers/metrics.rb