Skip to content

Commit 78b0f82

Browse files
authored
Merge pull request #129 from getsentry/jb/trace/sampleRate
feat(samplerate): add sdk sample rate
2 parents 0d51498 + 46a8c79 commit 78b0f82

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

server/src/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if (!config.SENTRY_DSN) {
2020
throw new Error('SENTRY_DSN was not set in config.json');
2121
}
2222

23-
Sentry.init({ dsn: config.SENTRY_DSN });
23+
Sentry.init({ dsn: config.SENTRY_DSN, tracesSampleRate: 1 });
2424

2525
const storage = new Storage({
2626
projectId: config.PROJECT
@@ -63,14 +63,16 @@ export function validateGeneratedFile(req: Request, res: Response) {
6363
contentType: 'text/plain; charset=utf-8'
6464
}
6565
});
66-
stream.on('error', err => {
66+
stream.on('error', async err => {
6767
res.status(500).send(err.message);
6868
Sentry.captureException(err);
6969
if (transaction) transaction.finish();
70+
await Sentry.flush(5000);
7071
});
71-
stream.on('finish', () => {
72+
stream.on('finish', async () => {
7273
res.status(200).send(encodeURIComponent(objectName));
7374
if (transaction) transaction.finish();
75+
await Sentry.flush(5000);
7476
});
7577

7678
stream.end(JSON.stringify(report));

0 commit comments

Comments
 (0)