Sha256: 5ccbcce2b12975c50b3811a5160eef4a26ccebfd82884302c311119391add458

Contents?: true

Size: 1.03 KB

Versions: 14

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

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

StatsD.logger = Logger.new(File::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

14 entries across 14 versions & 1 rubygems

Version Path
statsd-instrument-3.0.2 test/benchmark/default_tags.rb
statsd-instrument-3.0.1 test/benchmark/default_tags.rb
statsd-instrument-3.0.0 test/benchmark/default_tags.rb
statsd-instrument-3.0.0.pre2 test/benchmark/default_tags.rb
statsd-instrument-2.9.2 test/benchmark/default_tags.rb
statsd-instrument-3.0.0.pre1 test/benchmark/default_tags.rb
statsd-instrument-2.9.1 test/benchmark/default_tags.rb
statsd-instrument-2.9.0 test/benchmark/default_tags.rb
statsd-instrument-2.8.0 test/benchmark/default_tags.rb
statsd-instrument-2.7.1 test/benchmark/default_tags.rb
statsd-instrument-2.7.0 test/benchmark/default_tags.rb
statsd-instrument-2.6.0 test/benchmark/default_tags.rb
statsd-instrument-2.5.1 test/benchmark/default_tags.rb
statsd-instrument-2.5.0 test/benchmark/default_tags.rb