-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modifying the filtering tranformation to filter out unwanted info #175
Changes from 1 commit
f7a70ca
54880aa
e00e163
58ebfb9
309ba04
db1ab24
00b30e2
5bd8c14
fcc0088
703c54d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ def run | |
end | ||
# rubocop:disable Lint/RescueException | ||
rescue Exception => e | ||
Rollbar.error(e) | ||
Rollbar.error(e, :use_exception_level_filters => true) | ||
raise e | ||
end | ||
# rubocop:enable Lint/RescueException | ||
|
@@ -59,13 +59,15 @@ def configure_rollbar | |
Rollbar.configure do |config| | ||
config.enabled = false unless options[:rollbar][:token].present? | ||
config.access_token = options[:rollbar][:token] | ||
|
||
config.exception_level_filters.merge!({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Performance/RedundantMerge: Use config.exception_level_filters['IOError'] = 'ignore' instead of config.exception_level_filters.merge!({ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add IOError as to be ignored so this particular error message will not be sent to Rollbar. |
||
'IOError' => 'ignore' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/IndentHash: Use 2 spaces for indentation in a hash, relative to the first position after the preceding left parenthesis. |
||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/IndentHash: Indent the right brace the same as the first position after the preceding left parenthesis. |
||
# add a filter after Rollbar has built the error payload but before it is delivered to the API, | ||
# in order to strip sensitive information out of certain error messages | ||
exception_message_transformer = proc do |payload| | ||
clean_message = payload[:exception].message.sub(/http:\/\/.+:.+@(.+)\/fedora\/rest\/prod\/(.*)/, | ||
clean_message = payload[:exception][:message].sub(/http:\/\/.+:.+@(.+)\/fedora\/rest\/prod\/(.*)/, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to Rollbar, the payload json structured like this: |
||
"http://\1/fedora/rest/prod/\2") | ||
payload[:exception] = payload[:exception].exception(clean_message) | ||
payload[:exception][:message] = clean_message | ||
payload[:message] = clean_message | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax. (https://github.com/bbatsov/ruby-style-guide#hash-literals)