class ResqueToCloudwatch::CloudwatchSender
Public Class Methods
new(config)
click to toggle source
Pass an instance of CloudwatchToResque::Config
# File lib/resque_to_cloudwatch/cloudwatch_sender.rb, line 7 def initialize(config) @config = config end
Public Instance Methods
inspect()
click to toggle source
# File lib/resque_to_cloudwatch/cloudwatch_sender.rb, line 30 def inspect to_s end
send_value(value, metric_name)
click to toggle source
# File lib/resque_to_cloudwatch/cloudwatch_sender.rb, line 11 def send_value(value, metric_name) @config.region.each do |region| dimensions = [] dimensions << {:name => 'project', :value => @config.project} dimensions << {:name => 'hostname', :value => @config.hostname} unless @config.hostname.nil? cw = AWS::CloudWatch.new(region: region) cw.client.put_metric_data({ :namespace => "#{@config.namespace}/resque", :metric_data => [ :metric_name => metric_name, :dimensions => dimensions, :value => value, :unit => 'Count' ] }) $log.info "CloudwatchSender: Sent metric value #{value} for #{metric_name} to region #{region}" end end
to_s()
click to toggle source
# File lib/resque_to_cloudwatch/cloudwatch_sender.rb, line 34 def to_s "CloudwatchSender" end