Sha256: 6ed0917177e0aadcac63e210867c8538fd3686cac6b7b648f4f94d680e1dfae6

Contents?: true

Size: 1.55 KB

Versions: 32

Compression:

Stored size: 1.55 KB

Contents

# frozen_string_literal: true

module Appsignal
  module Helpers
    # @api private
    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

32 entries across 32 versions & 1 rubygems

Version Path
appsignal-2.9.13-java lib/appsignal/helpers/metrics.rb
appsignal-2.9.13 lib/appsignal/helpers/metrics.rb
appsignal-2.9.12-java lib/appsignal/helpers/metrics.rb
appsignal-2.9.12 lib/appsignal/helpers/metrics.rb
appsignal-2.9.12.beta.0-java lib/appsignal/helpers/metrics.rb
appsignal-2.9.12.beta.0 lib/appsignal/helpers/metrics.rb
appsignal-2.9.11 lib/appsignal/helpers/metrics.rb
appsignal-2.9.11-java lib/appsignal/helpers/metrics.rb
appsignal-2.9.10 lib/appsignal/helpers/metrics.rb
appsignal-2.9.10-java lib/appsignal/helpers/metrics.rb
appsignal-2.9.9-java lib/appsignal/helpers/metrics.rb
appsignal-2.9.9 lib/appsignal/helpers/metrics.rb
appsignal-2.9.8-java lib/appsignal/helpers/metrics.rb
appsignal-2.9.8 lib/appsignal/helpers/metrics.rb
appsignal-2.9.7-java lib/appsignal/helpers/metrics.rb
appsignal-2.9.7 lib/appsignal/helpers/metrics.rb
appsignal-2.9.6-java lib/appsignal/helpers/metrics.rb
appsignal-2.9.6 lib/appsignal/helpers/metrics.rb
appsignal-2.9.5 lib/appsignal/helpers/metrics.rb
appsignal-2.9.5-java lib/appsignal/helpers/metrics.rb