Skip to content

Instantly share code, notes, and snippets.

@jcreed
Created November 9, 2015 19:59
Show Gist options
  • Save jcreed/60034ec648e8fc34cbb1 to your computer and use it in GitHub Desktop.
Save jcreed/60034ec648e8fc34cbb1 to your computer and use it in GitHub Desktop.
namespace :airbrake_logs do
desc "Retreive all errors from Airbrake logs"
task :re_etl => [:environment] do |task|
display :notice, task.full_comment << " for WebAdMIT"
errors = ["PG::Error: ERROR: deadlock detected", 'PG::Error: ERROR: null value in column "program_id"']
errors.each do |group_error|
group = Cas3Logs::Api::Groups.new(group_error)
if group_key = group.group_key
pages = group.notice_pages
puts "WA: There are #{pages} page(s) for group: #{group_error} key: #{group_key}"
reetl_applicants = Cas3Logs::Api::Notices.new(group_key, pages, Date.new(2015,10,29), Date.today).notice_applicants
reetl_applicants.each do |k,v|
puts "Applicant: #{k} for Association: #{v}"
end
else
puts "WA: No group found for #{group_error}"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment