Sha256: 53a30427667d2cc2b934a00996adf584c89f0e88f8c727edebd3abcfdcac5de4

Contents?: true

Size: 814 Bytes

Versions: 15

Compression:

Stored size: 814 Bytes

Contents

# frozen_string_literal: true

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

def helper_function
  a = 10
  a += a
  a -= a
  a * a
end

Benchmark.ips do |bench|
  bench.report("increment metric benchmark") do
    StatsD.increment('GoogleBase.insert', 10)
  end

  bench.report("measure metric benchmark") do
    StatsD.measure('helper_function') do
      helper_function
    end
  end

  bench.report("gauge metric benchmark") do
    StatsD.gauge('GoogleBase.insert', 12)
  end

  bench.report("set metric benchmark") do
    StatsD.set('GoogleBase.customers', "12345", sample_rate: 1.0)
  end

  bench.report("event metric benchmark") do
    StatsD.event('Event Title', "12345")
  end

  bench.report("service check metric benchmark") do
    StatsD.service_check('shipit.redis_connection', 'ok')
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

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