Sha256: ec6f1464bab920e8f5bb7a226a8489247d91f909a4d32f4cba4307e57d1d4959

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

require 'statsd-instrument'
require 'benchmark/ips'

StatsD.logger = Logger.new('/dev/null')

class Suite
  def warming(*args)
    StatsD.default_tags = if args[0] == "with default tags"
      { first_tag: 'first_value', second_tag: 'second_value' }
    end
    puts "warming with default tags: #{StatsD.default_tags}"
  end

  def running(*args)
    StatsD.default_tags = if args[0] == "with default tags"
      { first_tag: 'first_value', second_tag: 'second_value' }
    end
    puts "running with default tags: #{StatsD.default_tags}"
  end

  def warmup_stats(*)
  end

  def add_report(*)
  end
end

suite = Suite.new

Benchmark.ips do |bench|
  bench.config(suite: suite)
  bench.report("without default tags") do
    StatsD.increment('GoogleBase.insert', tags: {
      first_tag: 'first_value',
      second_tag: 'second_value',
      third_tag: 'third_value',
    })
  end

  bench.report("with default tags") do
    StatsD.increment('GoogleBase.insert', tags: { third_tag: 'third_value' })
  end

  bench.compare!
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
statsd-instrument-2.4.0 test/benchmark/default_tags.rb