class ResqueToCloudwatch::GraphiteSender

Public Class Methods

new(config) click to toggle source

Pass an instance of ResqueToCloudwatch::Config

# File lib/resque_to_cloudwatch/graphite_sender.rb, line 7
def initialize(config)
  @config = config
end

Public Instance Methods

inspect() click to toggle source
# File lib/resque_to_cloudwatch/graphite_sender.rb, line 19
def inspect
  to_s
end
send_value(value, metric_name) click to toggle source
# File lib/resque_to_cloudwatch/graphite_sender.rb, line 11
def send_value(value, metric_name)
  graphite = Graphite.new({:host => @config.graphite_host, :port => @config.graphite_port})
  graphite.send_metrics({
    "resque_to_cloudwatch.#{@config.namespace}.#{metric_name}.#{@config.hostname}.#{@config.project}" => value
  })
  $log.info "GraphiteSender: sent metric value #{value} for #{metric_name}"
end
to_s() click to toggle source
# File lib/resque_to_cloudwatch/graphite_sender.rb, line 23
def to_s
  "GraphiteSender"
end