-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathscenario.ts
More file actions
35 lines (26 loc) · 1.16 KB
/
scenario.ts
File metadata and controls
35 lines (26 loc) · 1.16 KB
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
import * as Sentry from '@sentry/node-core';
import { loggingTransport } from '@sentry-internal/node-integration-tests';
import { setupOtel } from '../../../utils/setupOtel';
const client = Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
release: '1.0.0',
environment: 'test',
_experiments: {
enableMetrics: true,
},
transport: loggingTransport,
});
setupOtel(client);
async function run(): Promise<void> {
Sentry.metrics.count('test.counter', 1, { attributes: { endpoint: '/api/test' } });
Sentry.metrics.gauge('test.gauge', 42, { unit: 'millisecond', attributes: { server: 'test-1' } });
Sentry.metrics.distribution('test.distribution', 200, { unit: 'second', attributes: { priority: 'high' } });
await Sentry.startSpan({ name: 'test-span', op: 'test' }, async () => {
Sentry.metrics.count('test.span.counter', 1, { attributes: { operation: 'test' } });
});
Sentry.setUser({ id: 'user-123', email: 'test@example.com', username: 'testuser' });
Sentry.metrics.count('test.user.counter', 1, { attributes: { action: 'click' } });
await Sentry.flush();
}
// eslint-disable-next-line @typescript-eslint/no-floating-promises
void run();