Skip to content
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

fix: don't report SIGTERM & friends to Sentry #587

Merged
merged 6 commits into from
Sep 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions lib/zinnia.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const catchChildProcessExit = async ({
const exitReason = p.exitCode
? `with exit code ${p.exitCode}`
: p.signalCode ? `via signal ${p.signalCode}` : undefined
throw Object.assign(err, { moduleName: p.moduleName, exitReason })
throw Object.assign(err, { moduleName: p.moduleName, exitReason, signalCode: p.signalCode })
}
})())

Expand All @@ -187,14 +187,20 @@ const catchChildProcessExit = async ({
// Store the full error message including stdout & stder in the top-level `details` property
Object.assign(moduleErr, { details: err.message })

// Apply a custom rule to force Sentry to group all issues with the same module & exit code
// See https://docs.sentry.io/platforms/node/usage/sdk-fingerprinting/#basic-example
Sentry.withScope(scope => {
scope.setFingerprint([message])
maybeReportErrorToSentry(moduleErr)
})
if (err.signalCode && ['SIGTERM', 'SIGKILL', 'SIGINT'].includes(err.signalCode)) {
// These signal codes are triggered when somebody terminates the process from outside.
// It's not a problem in Zinnia, there is nothing we can do about this.
// Don't report this error to Sentry.
Object.assign(err, { reportToSentry: false })
} else {
// Apply a custom rule to force Sentry to group all issues with the same module & exit code
// See https://docs.sentry.io/platforms/node/usage/sdk-fingerprinting/#basic-example
Sentry.withScope(scope => {
scope.setFingerprint([message])
maybeReportErrorToSentry(moduleErr)
})
}
}
throw err
} finally {
controller.abort()
}
Expand Down
Loading