Sha256: 1a74e1bc232546510f124e2fc6e784129bbd5b03fe334d6023c0a192130032bc
Contents?: true
Size: 749 Bytes
Versions: 36
Compression:
Stored size: 749 Bytes
Contents
require 'test_helper' class LoggerBackendTest < Minitest::Test def setup logger = Logger.new(@io = StringIO.new) logger.formatter = lambda { |_,_,_, msg| "#{msg}\n" } @backend = StatsD::Instrument::Backends::LoggerBackend.new(logger) @metric1 = StatsD::Instrument::Metric::new(type: :c, name: 'mock.counter', tags: { a: 'b', c: 'd'}) @metric2 = StatsD::Instrument::Metric::new(type: :ms, name: 'mock.measure', value: 123, sample_rate: 0.3) end def test_logs_metrics @backend.collect_metric(@metric1) assert_equal @io.string, "[StatsD] increment mock.counter:1 #a:b #c:d\n" @io.string = "" @backend.collect_metric(@metric2) assert_equal @io.string, "[StatsD] measure mock.measure:123 @0.3\n" end end
Version data entries
36 entries across 36 versions & 2 rubygems