-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathbasic.mjs
36 lines (28 loc) · 886 Bytes
/
basic.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import * as assert from 'assert';
import * as crypto from 'crypto';
import * as Sentry from '@sentry/node';
global._sentryDebugIds = { [new Error().stack]: 'aaaaaaaa-aaaa-4aaa-aaaa-aaaaaaaaaa' };
setTimeout(() => {
process.exit();
}, 10000);
Sentry.init({
dsn: process.env.SENTRY_DSN,
release: '1.0',
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
});
Sentry.setUser({ email: '[email protected]' });
Sentry.addBreadcrumb({ message: 'important message!' });
function longWork() {
for (let i = 0; i < 20; i++) {
const salt = crypto.randomBytes(128).toString('base64');
const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512');
assert.ok(hash);
}
}
setTimeout(() => {
longWork();
}, 1000);
// Ensure we only send one event even with multiple blocking events
setTimeout(() => {
longWork();
}, 4000);