Skip to content

Commit

Permalink
Add configurable regex pattern for Sentry's ingoreErrors to match on. (
Browse files Browse the repository at this point in the history
…#293)

This will ignore 404, validation and permissions errors from being sent to Sentry.
  • Loading branch information
conorseabrook committed Dec 3, 2018
1 parent b5c7d34 commit 9edb6b8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/config.js
Expand Up @@ -13,7 +13,7 @@ module.exports = Object.freeze({
web3Rpc: process.env.WEB3_RPC,
nodePrivateKey: process.env.WEB3_NODEPRIVATEKEY,
sentryDSN: process.env.SENTRY_DSN,

sentryIgnoreRegex: process.env.SENTRY_IGNORE_ERRORS_REGEX,
// Required, one or more hosts delimited with comma, e.g
// 'mongo1:27107,mongo2:27017'
mongoHosts: process.env.MONGO_HOSTS,
Expand Down
1 change: 1 addition & 0 deletions dev.env
Expand Up @@ -11,4 +11,5 @@ export BUNDLE_SIZE_LIMIT="16384"
export WEB3_DEPLOYER_PRIVATEKEY="0x4d5db4107d237df6a3d58ee5f70ae63d73d7658d4026f2eefd2f204c81682cb7"
export DEFAULT_STAKE="10000000000000000000000"
export SENTRY_DSN=""
export SENTRY_IGNORE_ERRORS_REGEX='^(NotFoundError|ValidationError|JsonValidationError|PermissionError)'
export LOW_FUNDS_WARNING=1000
6 changes: 5 additions & 1 deletion src/workers/server_worker.js
Expand Up @@ -40,7 +40,11 @@ export default class ServerWorker extends Worker {
async work() {
this.logger.info('starting server');

Sentry.init({dsn: this.config.sentryDSN, environment: process.env.NODE_ENV});
Sentry.init({
dsn: this.config.sentryDSN,
environment: process.env.NODE_ENV,
ignoreErrors: this.config.sentryIgnoreRegex ? new RegExp(this.config.sentryIgnoreRegex) : []
});

this.collectMetricsInterval = promClient.collectDefaultMetrics({timeout: 10000});
const app = express();
Expand Down

0 comments on commit 9edb6b8

Please sign in to comment.