Last active
January 2, 2016 14:38
-
-
Save boblail/8317597 to your computer and use it in GitHub Desktop.
Configure Airbrake to inform Errbit of GIT_COMMIT
This file contains hidden or 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
Airbrake.configure do |config| | |
# ... | |
config.user_attributes = %w{id email} # the default is just 'id' | |
config.async = true # requires the gem 'sucker_punch' and 'airbrake ~> 3.1.15' | |
end | |
# Inform Errbit of the version of the codebase checked out | |
GIT_COMMIT = ENV.fetch('COMMIT_HASH', `git log -n1 --format='%H'`.chomp).freeze | |
module SendCommitWithNotice | |
def cgi_data | |
(super || {}).merge("GIT_COMMIT" => GIT_COMMIT) | |
end | |
end | |
Airbrake::Notice.send :prepend, SendCommitWithNotice # <-- NB: requires Ruby 2.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment