Sha256: 5e85dd1549dd837689248bdd462f0df01322b6b89af2a1ed01fc18e05ec21166

Contents?: true

Size: 814 Bytes

Versions: 32

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

32 entries across 32 versions & 1 rubygems

Version Path
statsd-instrument-3.9.7 test/benchmark/metrics.rb
statsd-instrument-3.9.6 test/benchmark/metrics.rb
statsd-instrument-3.9.5 test/benchmark/metrics.rb
statsd-instrument-3.9.4 test/benchmark/metrics.rb
statsd-instrument-3.9.3 test/benchmark/metrics.rb
statsd-instrument-3.9.2 test/benchmark/metrics.rb
statsd-instrument-3.9.1 test/benchmark/metrics.rb
statsd-instrument-3.9.0 test/benchmark/metrics.rb
statsd-instrument-3.8.0 test/benchmark/metrics.rb
statsd-instrument-3.7.0 test/benchmark/metrics.rb
statsd-instrument-3.6.1 test/benchmark/metrics.rb
statsd-instrument-3.6.0 test/benchmark/metrics.rb
statsd-instrument-3.5.12 test/benchmark/metrics.rb
statsd-instrument-3.5.11 test/benchmark/metrics.rb
statsd-instrument-3.5.10 test/benchmark/metrics.rb
statsd-instrument-3.5.9 test/benchmark/metrics.rb
statsd-instrument-3.5.8 test/benchmark/metrics.rb
statsd-instrument-3.5.7 test/benchmark/metrics.rb
statsd-instrument-3.5.6 test/benchmark/metrics.rb
statsd-instrument-3.5.5 test/benchmark/metrics.rb