Ignore unnecessary airbrake notices (#2283)

This commit is contained in:
Ben Halpern 2019-04-01 17:40:50 -04:00 committed by GitHub
parent cc0e4b40dd
commit c90be27677
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View file

@ -687,9 +687,13 @@ var instantClick
airbrake.addFilter(function(notice) {
notice.context.environment = "<%= Rails.env %>";
var file = notice.errors[0].backtrace[0].file;
var randomNumber = Math.floor(Math.random() * 10);
if ((file || "").startsWith("https://stats.pusher.com")) {
return null;
}
if (randomNumber > 4) { // We don't need to collect every JS error.
return null;
}
return notice;
});
try {

View file

@ -57,4 +57,5 @@ end
Airbrake.add_filter do |notice|
notice.ignore! if notice[:errors].any? { |error| error[:type] == "Pundit::NotAuthorizedError" }
notice.ignore! if notice[:errors].any? { |error| error[:type] == "ActiveRecord::RecordNotFound" }
end