class Metrics::Backend::Test::Metric

Public Instance Methods

emit(value, tags: nil, sample_rate: 1.0) click to toggle source
# File lib/metrics/backend/test.rb, line 33
def emit(value, tags: nil, sample_rate: 1.0)
        unless value.is_a?(Numeric)
                raise ArgumentError, "Value must be numeric!"
        end
        
        tags&.each do |tag|
                raise ArgumentError, "Invalid tag (must be String): #{tag.inspect}!" unless tag.is_a?(String)
                
                unless tag =~ VALID_TAG
                        raise ArgumentError, "Invalid tag (must match #{VALID_TAG}): #{tag.inspect}!"
                end
        end
end