Skip to content

Instantly share code, notes, and snippets.

@jcreed
Last active November 3, 2015 14:38
Show Gist options
  • Save jcreed/88ca20e861baa9df8214 to your computer and use it in GitHub Desktop.
Save jcreed/88ca20e861baa9df8214 to your computer and use it in GitHub Desktop.
namespace :airbrake_logs do
desc "Load all errors from Airbrake logs"
task :re_etl => [:environment] do |task|
display :notice, task.full_comment
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 "There are #{pages} pages for group: #{group_key}"
else
puts "No group found for #{group_error}"
end
end
display :success, "#{task}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment