Skip to content

Commit

Permalink
Disambiguate repeated vs widespread error reports
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Oct 12, 2023
1 parent ba14811 commit b711394
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/error-tracking.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as path from 'path';
import { randomUUID } from 'crypto';
import * as child_process from 'child_process';
import * as Sentry from '@sentry/node';
import { RewriteFrames } from '@sentry/integrations';
Expand Down Expand Up @@ -86,6 +87,14 @@ export function initErrorTracking() {
scope.setTag('platform', process.platform);
});

Sentry.configureScope((scope) => {
// We use a random id to distinguish between many errors in one session vs
// one error in many sessions. This isn't persisted and can't be used to
// identify anybody between sessions.
const randomId = randomUUID();
scope.setUser({ id: randomId, username: `anon-${randomId}` });
});

// Include breadcrumbs for subprocess spawning, to trace interceptor startup details:
const rawSpawn = child_process.spawn;
(child_process as any).spawn = function (command: any, args?: any, options?: { [key: string]: string }) {
Expand Down

0 comments on commit b711394

Please sign in to comment.