Skip to content

Commit

Permalink
Add custom Sentry grouping for Zinnia exit errors (#384)
Browse files Browse the repository at this point in the history
Before this change, Sentry was creating multiple issue for the same
error depending on the inner details (e.g. the module stderr).

After this change, Sentry should look only at the module name
and the exit reason (exit code or signal) to determine the group.

Signed-off-by: Miroslav Bajtoš <[email protected]>
  • Loading branch information
bajtos authored Mar 25, 2024
1 parent 57f9d31 commit 817e543
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/zinnia.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,13 @@ const catchChildProcessExit = async ({
const moduleErr = new Error(message, { cause: err })
// Store the full error message including stdout & stder in the top-level `details` property
Object.assign(moduleErr, { details: err.message })
maybeReportErrorToSentry(moduleErr)

// 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 {
Expand Down

0 comments on commit 817e543

Please sign in to comment.