Skip to content

Commit 11d5750

Browse files
committed
fix(rollbar): Enable error reporting to Rollbar
1 parent be177a3 commit 11d5750

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

config/initializers/rollbar.rb

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
Rollbar.configure do |config|
2+
# Without configuration, Rollbar is enabled in all environments.
3+
# To disable in specific environments, set config.enabled=false.
4+
5+
config.access_token = ENV["ROLLBAR_ACCESS_TOKEN"]
6+
7+
# Rollbar is only enabled in 'production' outside of rake tasks
8+
# Note: 'rake rollbar:test' will not properly test the setup since
9+
# Rollbar is now disabled in rake tasks.
10+
if !Rails.env.production? || /rake/ =~ File.split($PROGRAM_NAME).last
11+
config.enabled = false
12+
end
13+
14+
# By default, Rollbar will try to call the `current_user` controller method
15+
# to fetch the logged-in user object, and then call that object's `id`
16+
# method to fetch this property. To customize:
17+
# config.person_method = "my_current_user"
18+
# config.person_id_method = "my_id"
19+
20+
# Additionally, you may specify the following:
21+
# config.person_username_method = "username"
22+
# config.person_email_method = "email"
23+
24+
# If you want to attach custom data to all exception and message reports,
25+
# provide a lambda like the following. It should return a hash.
26+
# config.custom_data_method = lambda { {:some_key => "some_value" } }
27+
28+
# Add exception class names to the exception_level_filters hash to
29+
# change the level that exception is reported at. Note that if an exception
30+
# has already been reported and logged the level will need to be changed
31+
# via the rollbar interface.
32+
# Valid levels: 'critical', 'error', 'warning', 'info', 'debug', 'ignore'
33+
# 'ignore' will cause the exception to not be reported at all.
34+
# config.exception_level_filters.merge!('MyCriticalException' => 'critical')
35+
#
36+
# You can also specify a callable, which will be called with the exception instance.
37+
# config.exception_level_filters.merge!('MyCriticalException' => lambda { |e| 'critical' })
38+
39+
config.exception_level_filters.merge!("ActionController::RoutingError" => "ignore")
40+
41+
# Enable asynchronous reporting (uses girl_friday or Threading if girl_friday
42+
# is not installed)
43+
# config.use_async = true
44+
# Supply your own async handler:
45+
# config.async_handler = Proc.new { |payload|
46+
# Thread.new { Rollbar.process_from_async_handler(payload) }
47+
# }
48+
49+
# Enable asynchronous reporting (using sucker_punch)
50+
# config.use_sucker_punch
51+
52+
# Enable delayed reporting (using Sidekiq)
53+
# config.use_sidekiq
54+
# You can supply custom Sidekiq options:
55+
# config.use_sidekiq 'queue' => 'default'
56+
57+
# If your application runs behind a proxy server, you can set proxy parameters here.
58+
# If https_proxy is set in your environment, that will be used. Settings here have precedence.
59+
# The :host key is mandatory and must include the URL scheme (e.g. 'http://'), all other fields
60+
# are optional.
61+
#
62+
# config.proxy = {
63+
# host: 'http://some.proxy.server',
64+
# port: 80,
65+
# user: 'username_if_auth_required',
66+
# password: 'password_if_auth_required'
67+
# }
68+
69+
# If you run your staging application instance in production environment then
70+
# you'll want to override the environment reported by `Rails.env` with an
71+
# environment variable like this: `ROLLBAR_ENV=staging`. This is a recommended
72+
# setup for Heroku. See:
73+
# https://devcenter.heroku.com/articles/deploying-to-a-custom-rails-environment
74+
config.environment = ENV["ROLLBAR_ENV"].presence || Rails.env
75+
end

0 commit comments

Comments
 (0)