module Riemann::Metrics

Constants

VERSION

Public Class Methods

gauge(args) click to toggle source
# File lib/riemann-metrics.rb, line 48
def self.gauge args
  handler_method = args[0].gsub(".","_").to_sym
  @handler.send handler_method, *args if @handler.respond_to?(handler_method)
end
initialize(host, port, service_name, riemann_env, ttl) click to toggle source
# File lib/riemann-metrics.rb, line 43
def self.initialize(host, port, service_name, riemann_env, ttl)
  @client = Riemann::Metrics::Client.new(host, port, service_name, riemann_env, ttl)
  @handler = Riemann::Metrics::NotificationsHandler.new(@client)
end
instrument(channel, tags, state, metric, &block) click to toggle source
# File lib/riemann-metrics.rb, line 31
def self.instrument channel, tags, state, metric, &block
  ActiveSupport::Notifications.instrument(channel, tags: tags, state: state, metric: metric) do
    block.call if block_given?
  end
end
subscribe(channel, &block) click to toggle source
# File lib/riemann-metrics.rb, line 37
def self.subscribe channel, &block
  ActiveSupport::Notifications.subscribe(channel) do |*args|
    block.call(@client, *args)
  end
end