Last active
December 11, 2015 03:48
-
-
Save afeld/4539970 to your computer and use it in GitHub Desktop.
Jux: emails 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
# We had introduced a bug that was causing user registration errors in Rails for certain email addresses. | |
# Fetch the list of unique emails that had failed registration (that produced a particular exception). | |
require 'open-uri' | |
require 'nokogiri' | |
require 'set' | |
AUTH_TOKEN = 'XXX' | |
ERROR_ID = '54425478' | |
notice_ids = [] | |
# fetch all the notice IDs | |
page = 1 | |
while true do | |
print "fetching notices page #{page}..." | |
doc = Nokogiri::XML(open("http://jux.airbrake.io/groups/#{ERROR_ID}/notices.xml?page=#{page}&auth_token=#{AUTH_TOKEN}")) | |
ids_els = doc.css('notice id') | |
if ids_els.empty? | |
break | |
else | |
doc.css('notice id').each do |el| | |
notice_ids << el.content | |
end | |
end | |
page += 1 | |
puts "done" | |
end | |
emails = Set.new | |
# collect the email addresses | |
notice_ids.each do |notice_id| | |
print "fetching notice #{notice_id}..." | |
doc = Nokogiri::XML(open("http://jux.airbrake.io/groups/#{ERROR_ID}/notices/#{notice_id}.xml?auth_token=#{AUTH_TOKEN}")) | |
email = doc.css('request params user email').first.content.strip.downcase rescue '' | |
if email.empty? | |
puts "\nERROR: missing email, notice #{notice_id}" | |
else | |
emails << email | |
end | |
puts "done" | |
end | |
puts emails.to_a.sort.join(",\n") | |
puts "registrations failed from #{emails.size} users" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment