Created
October 3, 2012 21:50
-
-
Save mmcdaris/3830094 to your computer and use it in GitHub Desktop.
airbrake - gather data from a project for a specified environment
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 '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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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