-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathinit.js
34 lines (29 loc) · 919 Bytes
/
init.js
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
import * as Sentry from '@sentry/browser';
window.Sentry = Sentry;
Sentry.init({
dsn: 'https://[email protected]/1337',
});
Sentry.metrics.increment('increment');
Sentry.metrics.increment('increment', 2);
Sentry.metrics.increment('increment', '3');
Sentry.metrics.distribution('distribution', 42);
Sentry.metrics.distribution('distribution', '45');
Sentry.metrics.gauge('gauge', 5);
Sentry.metrics.gauge('gauge', '15');
Sentry.metrics.set('set', 'nope');
Sentry.metrics.set('set', 'another');
Sentry.metrics.timing('timing', 99, 'hour');
Sentry.metrics.timing('timingSync', () => {
sleepSync(200);
});
Sentry.metrics.timing('timingAsync', async () => {
await new Promise(resolve => setTimeout(resolve, 200));
});
function sleepSync(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if (new Date().getTime() - start > milliseconds) {
break;
}
}
}