Created
October 10, 2014 11:46
-
-
Save maxguzenski/36e58b715cab60e56ef9 to your computer and use it in GitHub Desktop.
Send sidekiq metrics to aws cloudwatch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'aws' | |
require 'sidekiq' | |
require 'erb' | |
# ENV['REDIS_URL'] need to be setted | |
AWS_CW_NAMESPACE = 'MySite' | |
queues = Sidekiq::Stats.new.queues | |
metric = AWS::CloudWatch::Metric.new "#{AWS_CW_NAMESPACE}/Sidekiq", "QueueSize" | |
metric.put_data [{value: queues.values.inject(0, :+), unit: 'Count'}] | |
metric = AWS::CloudWatch::Metric.new "#{AWS_CW_NAMESPACE}/Sidekiq", "PaperclipQueueSize" | |
metric.put_data [{value: queues['paperclip'] || 0, unit: 'Count'}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment