Created
March 1, 2012 02:42
-
-
Save danivovich/1946835 to your computer and use it in GitHub Desktop.
Count deploys from airbrake
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
require 'nokogiri' | |
require 'open-uri' | |
auth_token = 'AUTH_TOKEN' | |
site = 'https://ACCOUNT_NAME.airbrake.io/projects/PROJECT_NUMBER' | |
counts = { | |
:staging => 0, | |
:production => 0 | |
} | |
pages = PAGES_OF_DEPLOYS_FROM_WEB_UI | |
(1..pages).each do |page| | |
doc = Nokogiri::XML(open("#{site}/deploys.xml?page=#{page}&auth_token=#{auth_token}")) | |
counts[:staging] += doc.xpath('//rails-env').map(&:text).count { |e| e == 'staging' } | |
counts[:production] += doc.xpath('//rails-env').map(&:text).count { |e| e == 'production' } | |
end | |
puts "#{counts[:staging]} staging deploys" | |
puts "#{counts[:production]} production deploys" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment