mjac
February 10, 2019, 10:51am
1
Hi All,
I’m running a website which has URLs like:
https://domain.com/USERID-USERNAME
This page triggers errors when JS resources do not load properly, however these errors are grouped per page which means I have the same error repeated for every user affected.
Is it possible to set a Page Alias or similar so sentry groups all these errors under a more generic “profile page” rather than “profile for user X”?
Thanks all!
Michael
HazAT
February 11, 2019, 9:26am
2
You can use setFingerprint
as described in this blogpost: https://blog.sentry.io/2019/01/17/debug-tough-front-end-errors-sentry-clues
Sentry.withScope(scope => {
scope.setFingerprint(['https://domain.com/USERID']);
Sentry.captureException(error);
});
If you want to group all issues together globally on this specific site you can use:
Sentry.configureScope(scope => {
scope.setFingerprint(['https://domain.com/USERID']);
});
that means that all errors that occur afterward will have this fingerprint so be aware of that.
The fingerprint itself tells sentry how to group errors.
Hope this helps.
1 Like
mjac
February 11, 2019, 8:53pm
3
Thank you very much for the information about fingerprints, I will give it a try and report back.
mjac
February 16, 2019, 9:59am
4
This works really well, thanks for your help. Here’s the code I’m using in production when pages supply a fingerprint:
Sentry.configureScope(scope => {
scope.setFingerprint(<?= json_encode([$fullUrl . '/' . $fingerprint]) ?>);
});
1 Like