-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathsubject.js
53 lines (48 loc) · 1.71 KB
/
subject.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
fetchPojo.addEventListener('click', () => {
const fetchOptions = {
headers: {
'sentry-trace': '12312012123120121231201212312012-1121201211212012-1',
baggage: 'sentry-release=4.2.0',
},
};
// Make two fetch requests that reuse the same fetch object
Sentry.startSpan({ name: 'does-not-matter-1' }, () =>
fetch('http://example.com/fetch-pojo', fetchOptions)
.then(res => res.text())
.then(() =>
Sentry.startSpan({ name: 'does-not-matter-2' }, () => fetch('http://example.com/fetch-pojo', fetchOptions)),
),
);
});
fetchArray.addEventListener('click', () => {
const fetchOptions = {
headers: [
['sentry-trace', '12312012123120121231201212312012-1121201211212012-1'],
['baggage', 'sentry-release=4.2.0'],
],
};
// Make two fetch requests that reuse the same fetch object
Sentry.startSpan({ name: 'does-not-matter-1' }, () =>
fetch('http://example.com/fetch-array', fetchOptions)
.then(res => res.text())
.then(() =>
Sentry.startSpan({ name: 'does-not-matter-2' }, () => fetch('http://example.com/fetch-array', fetchOptions)),
),
);
});
fetchHeaders.addEventListener('click', () => {
const fetchOptions = {
headers: new Headers({
'sentry-trace': '12312012123120121231201212312012-1121201211212012-1',
baggage: 'sentry-release=4.2.0',
}),
};
// Make two fetch requests that reuse the same fetch object
Sentry.startSpan({ name: 'does-not-matter-1' }, () =>
fetch('http://example.com/fetch-headers', fetchOptions)
.then(res => res.text())
.then(() =>
Sentry.startSpan({ name: 'does-not-matter-2' }, () => fetch('http://example.com/fetch-headers', fetchOptions)),
),
);
});