Configuration Reference
Configuration options for rollbar-gem
Examples
# Set the access token, branch, code version, and project gems
Rollbar.configure do |config |
config.access_token = '...'
config.branch = 'master'
config.code_version = '3da541559918a808c2402bba5012f6c60b27661c'
config.project_gems = ['my_custom_gem', 'my_other_gem']
end
# Set an async_handler
config.use_async = true
config.async_handler = Proc.new { |payload|
Thread.new { Rollbar.process_from_async_handler(payload) }
}
Hooks
You can configure the SDK to trigger your additional custom logic in selected situations through the Rollbar::Configuration.hook
method.
Rollbar.configure do |config|
config.hook :on_error_response do |response|
...
end
end
:on_error_response
Triggered when Rollbar API responds with any status code different than 200. Parameters: response
.
:on_report_internal_error
Triggered when the SDK throws an internal unexpected error. Parameters: exception
.
Configuration Reference
| Sets the access token used to send payloads to Rollbar. Items sent through a given access token arrive in that access token's project and respect the rate limits set on that access token. |
---|---|
| If
|
| If Default: |
| Handler to be called before sending via an async handler. The handler should be a The received argument is the current job being processed. The handler should return Default: |
| Set with any instance of ActiveSupport::BacktraceCleaner or with any object that supports its interface. When set, it will be applied to all error stacks before sending to Rollbar. Default: |
| Handlers to be called before processing data sent. The handlers should be The received argument is a Hash object with these keys:
It supports ignoring items |
| The name of the branch of the code that is running. Used for linking filenames in stacktraces to GitHub. Default: |
| Report uncaught exceptions to Rollbar. Set to Default: |
| A string up to 40 characters describing the version control number (i.e. git SHA) of the current revision. Used for linking filenames in stacktraces to GitHub. Rollbar understands these formats:
|
| The method to call to gather custom data to send with each rollbar request.
|
| What logger to use for printing debugging and informational messages during operation. Default: |
| Disables Rollbar's monkey patches in the Ruby core. One mandatory monkey patch is left. Be careful using this option as it may cause unexpected behavior in some situations. Default: |
| Disables monkey patching all non-core monkey patches and automatic reporting. If you set this to true you will be responsible for rescuing and reporting all errors manually. Default: |
| Disables monkey patches on Rack classes, Default: |
| Set to false if you have Default: |
| The number of job failures before reporting the failure to Rollbar. Default: |
| If set to Default: |
| The environment that your code is running in. Default: unspecified |
| An array of backup handlers if the async handlers fails. Each should respond to |
| For use with |
| Indicates which framework you're using. Common options include 'Rails', 'Sinatra', and 'Rack' to name a few. Default: |
| The hostname (reported to Rollbar as Default: |
| Specify error class names to ignore for internal errors from rollbar-gem. This shouldn't need to be updated unless there is an excess of unwanted internal error reports. Set Default: |
| Ids of people whose reports you wish to ignore. Only works in conjunction with a properly defined Default: |
| Enable capture of local variables in error stack traces. Enable by setting Default: disabled |
| When Default: |
| The logger to use instead of the default logger. Especially useful when you wish to send log messages elsewhere. |
| Minimum level of logger messages to write to the log. Accepts Default: |
| Sets the number of retries caused by timeouts on the POST request. Default: |
| Default: |
| Extra data to send with the payload. |
| If not using Rails: Populate the Rails only: A string or symbol giving the name of the method on the controller. Should return an object with an |
| A string or symbol giving the name of the method on the user instance that returns the person's email. Gets called on the result of |
| A string or symbol giving the name of the method on the user instance that returns the person's id. Gets called on the result of |
| A string or symbol giving the name of the method on the user instance that returns the person's username. Gets called on the result of |
| Raising an exception in Ruby is what populates the backtraces. If you report a manually initialized exception instead of a raised and rescued exception, the backtraces will be empty. Set |
| In the Rollbar interface, stacktraces are shown with in-project code expanded and other code collapsed. Stack frames are counted as in-project if they occur in a file that is inside of the If you want code from some specific gems to start expanded as well, you can configure this in
|
| When Default: |
| When Default: |
| Set to Default: |
| Set the request timeout for sending POST data to Rollbar. Default: |
| Sets the server root. All stack frames outside that root are considered 'non-project' frames. Also used to setup GitHub linking. |
| When Default: |
| Fields to scrub out of the parsed request data. Will scrub from Default: |
| The headers to scrub. The value will be replaced with a Default: |
| Set to Default: |
| Set to Default: |
| An array of fields to not scrub, even if they also appear in Default: |
| The number of job re-tries before reporting an error to Rollbar via Sidekiq. Ignored unless you've called Default: |
| When Default: |
| When Default: |
| Invoking this method will instruct the SDK to use your Rails' configured ActiveJob implementation to deliver items to Rollbar. This will automatically set |
| When Default: |
| When enabled, sends Rollbar data on a separate Ruby thread. Default: |
use_exception_level_filters_default | When |
| A string used to hash IP addresses when obfuscating them. |
| Specifies the rack env key that provides the user IP address. For example, this may be set to the key used by Cloudflare ('HTTP_CF_CONNECTING_IP') or any other custom key that contains the IP address. |
| Use this field to select a different level for uncaught errors (like Default: |
| By default, the gem uses Default: |
| The root of the web app that serves your Rollbar data. Unless you're an Enterprise customer running Rollbar on-premise, this should never change. Default: |
| If Default: |
For more information on rollbar-gem, please see the docs here.
Updated 7 months ago