-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathscenario-addLink-nested.ts
More file actions
33 lines (28 loc) · 1009 Bytes
/
scenario-addLink-nested.ts
File metadata and controls
33 lines (28 loc) · 1009 Bytes
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
import { loggingTransport } from '@sentry-internal/node-integration-tests';
import * as Sentry from '@sentry/node';
Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
release: '1.0',
tracesSampleRate: 1.0,
integrations: [],
transport: loggingTransport,
});
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Sentry.startSpan({ name: 'parent1' }, async parentSpan1 => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Sentry.startSpan({ name: 'child1.1' }, async childSpan1 => {
childSpan1.addLink({
context: parentSpan1.spanContext(),
attributes: { 'sentry.link.type': 'previous_trace' },
});
childSpan1.end();
});
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Sentry.startSpan({ name: 'child1.2' }, async childSpan2 => {
childSpan2.addLink({
context: parentSpan1.spanContext(),
attributes: { 'sentry.link.type': 'previous_trace' },
});
childSpan2.end();
});
});