-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathindex.ts
More file actions
36 lines (31 loc) · 913 Bytes
/
index.ts
File metadata and controls
36 lines (31 loc) · 913 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
34
35
36
import * as Sentry from '@sentry/cloudflare';
interface Env {
SENTRY_DSN: string;
}
export default Sentry.withSentry(
(env: Env) => ({
dsn: env.SENTRY_DSN,
tracesSampleRate: 1.0,
traceLifecycle: 'stream',
release: '1.0.0',
}),
{
async fetch(_request, _env, _ctx) {
Sentry.startSpan({ name: 'test-span', op: 'test' }, segmentSpan => {
Sentry.startSpan({ name: 'test-child-span', op: 'test-child' }, () => {
// noop
});
const inactiveSpan = Sentry.startInactiveSpan({ name: 'test-inactive-span' });
inactiveSpan.addLink({
context: segmentSpan.spanContext(),
attributes: { 'sentry.link.type': 'some_relation' },
});
inactiveSpan.end();
Sentry.startSpanManual({ name: 'test-manual-span' }, span => {
span.end();
});
});
return new Response('OK');
},
},
);