Skip to content

Commit b711394

Browse files
committed
Disambiguate repeated vs widespread error reports
1 parent ba14811 commit b711394

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/error-tracking.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as path from 'path';
2+
import { randomUUID } from 'crypto';
23
import * as child_process from 'child_process';
34
import * as Sentry from '@sentry/node';
45
import { RewriteFrames } from '@sentry/integrations';
@@ -86,6 +87,14 @@ export function initErrorTracking() {
8687
scope.setTag('platform', process.platform);
8788
});
8889

90+
Sentry.configureScope((scope) => {
91+
// We use a random id to distinguish between many errors in one session vs
92+
// one error in many sessions. This isn't persisted and can't be used to
93+
// identify anybody between sessions.
94+
const randomId = randomUUID();
95+
scope.setUser({ id: randomId, username: `anon-${randomId}` });
96+
});
97+
8998
// Include breadcrumbs for subprocess spawning, to trace interceptor startup details:
9099
const rawSpawn = child_process.spawn;
91100
(child_process as any).spawn = function (command: any, args?: any, options?: { [key: string]: string }) {

0 commit comments

Comments
 (0)