Skip to content

Instantly share code, notes, and snippets.

@mmcdaris
Created October 3, 2012 21:50
Show Gist options
  • Save mmcdaris/3830094 to your computer and use it in GitHub Desktop.
Save mmcdaris/3830094 to your computer and use it in GitHub Desktop.
airbrake - gather data from a project for a specified environment
require 'rest-client'
require 'json'
# ---- set up some variables ----
ab_auth_token = "asdf1234sdfg2345dfgh3456fghj4567ghjk5678hjkl6789"
# your auth token located in the settings page (NOT API KEY)
ab_subdomain = "subdomain"
# like http://subdomain.airbrake.io
ab_project_id = 55555
# you can list your projects with:
# projects = JSON::parse(RestClient.get("http://#{ab_subdomain}.airbrake.io/projects/auth_token=#{ab_auth_token}
target_env = "production"
#this will be the environment we want to return errors for
# ---- ---- ---- ---- ---- ---- ----
j = JSON::parse(RestClient.get("http://#{ab_subdomain}.airbrake.io/projects/#{ab_projet_id}/errors.json?auth_token=#{ab_auth_token}"))
j['groups'].each do |g|
if g['rails_env'] == target_env
puts g
end
end
@grosser
Copy link

grosser commented Oct 3, 2012

Nice to have a workaround, but a real solution like ?rails_env=staging would be nicer, with this interface I have to find all my errors and then pick out those on staging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment