Sha256: 00c37e21b05958b88b4a60b9250b471426261d443b6d175d1805fb8f0f0257a0

Contents?: true

Size: 744 Bytes

Versions: 1

Compression:

Stored size: 744 Bytes

Contents

require 'archimedes/config'
require 'archimedes/version'
require 'statsd'

class Archimedes

  attr_reader :service

  def initialize(config)
    @config  = config
    @service = Statsd.new(@config.host, @config.port)
    @service.namespace = @config.namespace
  end

  def increment(metric, rate = 1)
    count(metric, 1, rate)
  end

  def decrement(metric, rate = 1)
    count(metric, -1, rate)
  end

  def count(metric, delta, rate = 1)
    service.count(metric, delta, rate)
  end

  def gauge(metric, value, rate = 1)
    service.gauge(metric, value, rate)
  end

  def time(metric, rate = 1)
    service.time(metric, rate) do
      yield
    end
  end

  def timing(metric, duration = 1)
    service.timing(metric, duration)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
archimedes-1.0.0 lib/archimedes.rb