Skip to content

Instantly share code, notes, and snippets.

@boblail
Last active January 2, 2016 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boblail/8317597 to your computer and use it in GitHub Desktop.
Save boblail/8317597 to your computer and use it in GitHub Desktop.
Configure Airbrake to inform Errbit of GIT_COMMIT
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