slack exception notifications
This commit is contained in:
parent
134d4171f8
commit
fb80f56a7d
4 changed files with 50 additions and 2 deletions
|
@ -23,6 +23,9 @@ export DEVISE_SECRET_KEY='f71c467e526f23d614b3b08866cad4788c502bed869c282f06e73e
|
|||
# export SMTP_SERVER
|
||||
# export SMTP_USERNAME
|
||||
|
||||
# # send exception notifications to a slack incoming webhook
|
||||
# export SLACK_EN_WEBHOOK_URL
|
||||
|
||||
# ruby garbage collection stuff
|
||||
|
||||
export RUBY_GC_TUNE=0 #set to 1 to enable GC test
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -11,6 +11,7 @@ gem 'delayed_job_active_record', '~> 4.0.1'
|
|||
gem 'devise'
|
||||
gem 'doorkeeper'
|
||||
gem 'dotenv'
|
||||
gem 'exception_notification'
|
||||
gem 'formtastic'
|
||||
gem 'formula'
|
||||
gem 'httparty'
|
||||
|
@ -23,6 +24,7 @@ gem 'pundit_extra'
|
|||
gem 'rack-cors'
|
||||
gem 'rails3-jquery-autocomplete'
|
||||
gem 'redis'
|
||||
gem 'slack-notifier'
|
||||
gem 'snorlax'
|
||||
gem 'uservoice-ruby'
|
||||
|
||||
|
|
|
@ -89,6 +89,9 @@ GEM
|
|||
railties (>= 3.2)
|
||||
dotenv (2.1.0)
|
||||
erubis (2.7.0)
|
||||
exception_notification (4.1.4)
|
||||
actionmailer (~> 4.0)
|
||||
activesupport (~> 4.0)
|
||||
execjs (2.6.0)
|
||||
ezcrypto (0.7.2)
|
||||
factory_girl (4.5.0)
|
||||
|
@ -229,6 +232,7 @@ GEM
|
|||
json (~> 1.8)
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.0)
|
||||
slack-notifier (1.5.1)
|
||||
slop (3.6.0)
|
||||
snorlax (0.1.5)
|
||||
rails (> 4.1)
|
||||
|
@ -270,6 +274,7 @@ DEPENDENCIES
|
|||
devise
|
||||
doorkeeper
|
||||
dotenv
|
||||
exception_notification
|
||||
factory_girl_rails
|
||||
formtastic
|
||||
formula
|
||||
|
@ -296,6 +301,7 @@ DEPENDENCIES
|
|||
sass-rails
|
||||
shoulda-matchers
|
||||
simplecov
|
||||
slack-notifier
|
||||
snorlax
|
||||
tunemygc
|
||||
uglifier
|
||||
|
|
37
config/initializers/exception_notification.rb
Normal file
37
config/initializers/exception_notification.rb
Normal file
|
@ -0,0 +1,37 @@
|
|||
require 'exception_notification/rails'
|
||||
|
||||
ExceptionNotification.configure do |config|
|
||||
# Ignore additional exception types.
|
||||
# ActiveRecord::RecordNotFound, AbstractController::ActionNotFound and
|
||||
# ActionController::RoutingError are already added.
|
||||
config.ignored_exceptions += %w(
|
||||
ActionView::TemplateError CustomError UnauthorizedException
|
||||
InvalidArgumentException InvalidEntityException InvalidRequestException
|
||||
NotFoundException ValidationException
|
||||
)
|
||||
|
||||
# Adds a condition to decide when an exception must be ignored or not.
|
||||
# The ignore_if method can be invoked multiple times to add extra conditions.
|
||||
config.ignore_if do |_exception, _options|
|
||||
!Rails.env.production?
|
||||
end
|
||||
|
||||
# Notifiers ######
|
||||
|
||||
if ENV['SLACK_EN_WEBHOOK_URL']
|
||||
config.add_notifier :slack, webhook_url: ENV['SLACK_EN_WEBHOOK_URL']
|
||||
end
|
||||
|
||||
# Email notifier sends notifications by email.
|
||||
# config.add_notifier :email, {
|
||||
# :email_prefix => "[ERROR] ",
|
||||
# :sender_address => %{"Notifier" <notifier@example.com>},
|
||||
# :exception_recipients => %w{exceptions@example.com}
|
||||
# }
|
||||
|
||||
# Webhook notifier sends notifications over HTTP protocol. Requires 'httparty' gem.
|
||||
# config.add_notifier :webhook, {
|
||||
# :url => 'http://example.com:5555/hubot/path',
|
||||
# :http_method => :post
|
||||
# }
|
||||
end
|
Loading…
Reference in a new issue