Sha256: eaa66aad9fd1bb92b88c591e3805cd627bc514adefee54ab3d0d5591fe53013c

Contents?: true

Size: 641 Bytes

Versions: 5

Compression:

Stored size: 641 Bytes

Contents

require 'prometheus/client/simple_value'

module Prometheus
  module Client
    # Module providing convenience methods for creating value_object
    module UsesValueType
      def value_class
        Prometheus::Client.configuration.value_class
      end

      def value_object(type, metric_name, name, labels, *args)
        value_class.new(type, metric_name, name, labels, *args)
      rescue StandardError => e
        Prometheus::Client.logger.info("error #{e} while creating instance of #{value_class} defaulting to SimpleValue")
        Prometheus::Client::SimpleValue.new(type, metric_name, name, labels)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
prometheus-client-mmap-0.7.0.beta19 lib/prometheus/client/uses_value_type.rb
prometheus-client-mmap-0.7.0.beta18 lib/prometheus/client/uses_value_type.rb
prometheus-client-mmap-0.7.0.beta17 lib/prometheus/client/uses_value_type.rb
prometheus-client-mmap-0.7.0.beta16 lib/prometheus/client/uses_value_type.rb
prometheus-client-mmap-0.7.0.beta15 lib/prometheus/client/uses_value_type.rb