@sentry/cloudflare 8.22.0 → 8.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -1
- package/build/cjs/d1.js +157 -0
- package/build/cjs/d1.js.map +1 -0
- package/build/cjs/handler.js +50 -0
- package/build/cjs/handler.js.map +1 -1
- package/build/cjs/index.js +5 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/pages-plugin.js +26 -7
- package/build/cjs/pages-plugin.js.map +1 -1
- package/build/cjs/request.js +4 -28
- package/build/cjs/request.js.map +1 -1
- package/build/cjs/scope-utils.js +33 -0
- package/build/cjs/scope-utils.js.map +1 -0
- package/build/cjs/sdk.js.map +1 -1
- package/build/esm/d1.js +155 -0
- package/build/esm/d1.js.map +1 -0
- package/build/esm/handler.js +50 -0
- package/build/esm/handler.js.map +1 -1
- package/build/esm/index.js +3 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/pages-plugin.js +26 -7
- package/build/esm/pages-plugin.js.map +1 -1
- package/build/esm/request.js +2 -26
- package/build/esm/request.js.map +1 -1
- package/build/esm/scope-utils.js +29 -0
- package/build/esm/scope-utils.js.map +1 -0
- package/build/esm/sdk.js.map +1 -1
- package/build/types/d1.d.ts +17 -0
- package/build/types/d1.d.ts.map +1 -0
- package/build/types/handler.d.ts +2 -2
- package/build/types/handler.d.ts.map +1 -1
- package/build/types/index.d.ts +3 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/pages-plugin.d.ts +18 -6
- package/build/types/pages-plugin.d.ts.map +1 -1
- package/build/types/request.d.ts.map +1 -1
- package/build/types/scope-utils.d.ts +15 -0
- package/build/types/scope-utils.d.ts.map +1 -0
- package/build/types/sdk.d.ts +4 -3
- package/build/types/sdk.d.ts.map +1 -1
- package/build/types-ts3.8/d1.d.ts +17 -0
- package/build/types-ts3.8/handler.d.ts +2 -2
- package/build/types-ts3.8/index.d.ts +3 -1
- package/build/types-ts3.8/pages-plugin.d.ts +18 -6
- package/build/types-ts3.8/scope-utils.d.ts +15 -0
- package/build/types-ts3.8/sdk.d.ts +4 -3
- package/package.json +6 -7
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
- [Official SDK Docs](https://docs.sentry.io/quickstart/)
|
|
16
16
|
- [TypeDoc](http://getsentry.github.io/sentry-javascript/)
|
|
17
17
|
|
|
18
|
-
**Note: This SDK is
|
|
18
|
+
**Note: This SDK is in an alpha state. Please follow the
|
|
19
19
|
[tracking GH issue](https://github.com/getsentry/sentry-javascript/issues/12620) for updates.**
|
|
20
20
|
|
|
21
21
|
## Install
|
|
@@ -72,6 +72,37 @@ export const onRequest = [
|
|
|
72
72
|
];
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
+
If you need to access the `context` object (for example to grab environmental variables), you can pass a function to
|
|
76
|
+
`sentryPagesPlugin` that takes the `context` object as an argument and returns `init` options:
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
export const onRequest = Sentry.sentryPagesPlugin(context => ({
|
|
80
|
+
dsn: context.env.SENTRY_DSN,
|
|
81
|
+
tracesSampleRate: 1.0,
|
|
82
|
+
}));
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
If you do not have access to the `onRequest` middleware API, you can use the `wrapRequestHandler` API instead.
|
|
86
|
+
|
|
87
|
+
Here is an example with SvelteKit:
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
// hooks.server.js
|
|
91
|
+
import * as Sentry from '@sentry/cloudflare';
|
|
92
|
+
|
|
93
|
+
export const handle = ({ event, resolve }) => {
|
|
94
|
+
const requestHandlerOptions = {
|
|
95
|
+
options: {
|
|
96
|
+
dsn: event.platform.env.SENTRY_DSN,
|
|
97
|
+
tracesSampleRate: 1.0,
|
|
98
|
+
},
|
|
99
|
+
request: event.request,
|
|
100
|
+
context: event.platform.ctx,
|
|
101
|
+
};
|
|
102
|
+
return Sentry.wrapRequestHandler(requestHandlerOptions, () => resolve(event));
|
|
103
|
+
};
|
|
104
|
+
```
|
|
105
|
+
|
|
75
106
|
## Setup (Cloudflare Workers)
|
|
76
107
|
|
|
77
108
|
To use this SDK, wrap your handler with the `withSentry` function. This will initialize the SDK and hook into the
|
|
@@ -136,3 +167,57 @@ Sentry.captureEvent({
|
|
|
136
167
|
],
|
|
137
168
|
});
|
|
138
169
|
```
|
|
170
|
+
|
|
171
|
+
## Cloudflare D1 Instrumentation
|
|
172
|
+
|
|
173
|
+
You can use the `instrumentD1WithSentry` method to instrument [Cloudflare D1](https://developers.cloudflare.com/d1/),
|
|
174
|
+
Cloudflare's serverless SQL database with Sentry.
|
|
175
|
+
|
|
176
|
+
```javascript
|
|
177
|
+
import * as Sentry from '@sentry/cloudflare';
|
|
178
|
+
|
|
179
|
+
// env.DB is the D1 DB binding configured in your `wrangler.toml`
|
|
180
|
+
const db = Sentry.instrumentD1WithSentry(env.DB);
|
|
181
|
+
// Now you can use the database as usual
|
|
182
|
+
await db.prepare('SELECT * FROM table WHERE id = ?').bind(1).run();
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Cron Monitoring (Cloudflare Workers)
|
|
186
|
+
|
|
187
|
+
[Sentry Crons](https://docs.sentry.io/product/crons/) allows you to monitor the uptime and performance of any scheduled,
|
|
188
|
+
recurring job in your application.
|
|
189
|
+
|
|
190
|
+
To instrument your cron triggers, use the `Sentry.withMonitor` API in your
|
|
191
|
+
[`Scheduled` handler](https://developers.cloudflare.com/workers/runtime-apis/handlers/scheduled/).
|
|
192
|
+
|
|
193
|
+
```js
|
|
194
|
+
export default {
|
|
195
|
+
async scheduled(event, env, ctx) {
|
|
196
|
+
ctx.waitUntil(
|
|
197
|
+
Sentry.withMonitor('your-cron-name', () => {
|
|
198
|
+
return doSomeTaskOnASchedule();
|
|
199
|
+
}),
|
|
200
|
+
);
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
You can also use supply a monitor config to upsert cron monitors with additional metadata:
|
|
206
|
+
|
|
207
|
+
```js
|
|
208
|
+
const monitorConfig = {
|
|
209
|
+
schedule: {
|
|
210
|
+
type: 'crontab',
|
|
211
|
+
value: '* * * * *',
|
|
212
|
+
},
|
|
213
|
+
checkinMargin: 2, // In minutes. Optional.
|
|
214
|
+
maxRuntime: 10, // In minutes. Optional.
|
|
215
|
+
timezone: 'America/Los_Angeles', // Optional.
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export default {
|
|
219
|
+
async scheduled(event, env, ctx) {
|
|
220
|
+
Sentry.withMonitor('your-cron-name', () => doSomeTaskOnASchedule(), monitorConfig);
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
```
|
package/build/cjs/d1.js
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
|
|
3
|
+
const core = require('@sentry/core');
|
|
4
|
+
|
|
5
|
+
// Patching is based on internal Cloudflare D1 API
|
|
6
|
+
// https://github.com/cloudflare/workerd/blob/cd5279e7b305003f1d9c851e73efa9d67e4b68b2/src/cloudflare/internal/d1-api.ts
|
|
7
|
+
|
|
8
|
+
const patchedStatement = new WeakSet();
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Patches the query methods of a Cloudflare D1 prepared statement with Sentry.
|
|
12
|
+
*/
|
|
13
|
+
function instrumentD1PreparedStatementQueries(statement, query) {
|
|
14
|
+
if (patchedStatement.has(statement)) {
|
|
15
|
+
return statement;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
19
|
+
statement.first = new Proxy(statement.first, {
|
|
20
|
+
apply(target, thisArg, args) {
|
|
21
|
+
return core.startSpan(createStartSpanOptions(query, 'first'), async () => {
|
|
22
|
+
const res = await Reflect.apply(target, thisArg, args);
|
|
23
|
+
createD1Breadcrumb(query, 'first');
|
|
24
|
+
return res;
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
30
|
+
statement.run = new Proxy(statement.run, {
|
|
31
|
+
apply(target, thisArg, args) {
|
|
32
|
+
return core.startSpan(createStartSpanOptions(query, 'run'), async span => {
|
|
33
|
+
const d1Response = await Reflect.apply(target, thisArg, args);
|
|
34
|
+
applyD1ReturnObjectToSpan(span, d1Response);
|
|
35
|
+
createD1Breadcrumb(query, 'run', d1Response);
|
|
36
|
+
return d1Response;
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
42
|
+
statement.all = new Proxy(statement.all, {
|
|
43
|
+
apply(target, thisArg, args) {
|
|
44
|
+
return core.startSpan(createStartSpanOptions(query, 'all'), async span => {
|
|
45
|
+
const d1Result = await Reflect.apply(target, thisArg, args);
|
|
46
|
+
applyD1ReturnObjectToSpan(span, d1Result);
|
|
47
|
+
createD1Breadcrumb(query, 'all', d1Result);
|
|
48
|
+
return d1Result;
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
54
|
+
statement.raw = new Proxy(statement.raw, {
|
|
55
|
+
apply(target, thisArg, args) {
|
|
56
|
+
return core.startSpan(createStartSpanOptions(query, 'raw'), async () => {
|
|
57
|
+
const res = await Reflect.apply(target, thisArg, args);
|
|
58
|
+
createD1Breadcrumb(query, 'raw');
|
|
59
|
+
return res;
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
patchedStatement.add(statement);
|
|
65
|
+
|
|
66
|
+
return statement;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Instruments a Cloudflare D1 prepared statement with Sentry.
|
|
71
|
+
*
|
|
72
|
+
* This is meant to be used as a top-level call, under the hood it calls `instrumentD1PreparedStatementQueries`
|
|
73
|
+
* to patch the query methods. The reason for this abstraction is to ensure that the `bind` method is also patched.
|
|
74
|
+
*/
|
|
75
|
+
function instrumentD1PreparedStatement(statement, query) {
|
|
76
|
+
// statement.bind() returns a new instance of D1PreparedStatement, so we have to patch it as well.
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
78
|
+
statement.bind = new Proxy(statement.bind, {
|
|
79
|
+
apply(target, thisArg, args) {
|
|
80
|
+
return instrumentD1PreparedStatementQueries(Reflect.apply(target, thisArg, args), query);
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return instrumentD1PreparedStatementQueries(statement, query);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Add D1Response meta information to a span.
|
|
89
|
+
*
|
|
90
|
+
* See: https://developers.cloudflare.com/d1/build-with-d1/d1-client-api/#return-object
|
|
91
|
+
*/
|
|
92
|
+
function applyD1ReturnObjectToSpan(span, d1Result) {
|
|
93
|
+
if (!d1Result.success) {
|
|
94
|
+
span.setStatus({ code: core.SPAN_STATUS_ERROR });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
span.setAttributes(getAttributesFromD1Response(d1Result));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function getAttributesFromD1Response(d1Result) {
|
|
101
|
+
return {
|
|
102
|
+
'cloudflare.d1.duration': d1Result.meta.duration,
|
|
103
|
+
'cloudflare.d1.rows_read': d1Result.meta.rows_read,
|
|
104
|
+
'cloudflare.d1.rows_written': d1Result.meta.rows_written,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function createD1Breadcrumb(query, type, d1Result) {
|
|
109
|
+
core.addBreadcrumb({
|
|
110
|
+
category: 'query',
|
|
111
|
+
message: query,
|
|
112
|
+
data: {
|
|
113
|
+
...(d1Result ? getAttributesFromD1Response(d1Result) : {}),
|
|
114
|
+
'cloudflare.d1.query_type': type,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function createStartSpanOptions(query, type) {
|
|
120
|
+
return {
|
|
121
|
+
op: 'db.query',
|
|
122
|
+
name: query,
|
|
123
|
+
attributes: {
|
|
124
|
+
'cloudflare.d1.query_type': type,
|
|
125
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.d1',
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Instruments Cloudflare D1 bindings with Sentry.
|
|
132
|
+
*
|
|
133
|
+
* Currently, only prepared statements are instrumented. `db.exec` and `db.batch` are not instrumented.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
*
|
|
137
|
+
* ```js
|
|
138
|
+
* // env.DB is the D1 DB binding configured in your `wrangler.toml`
|
|
139
|
+
* const db = instrumentD1WithSentry(env.DB);
|
|
140
|
+
* // Now you can use the database as usual
|
|
141
|
+
* await db.prepare('SELECT * FROM table WHERE id = ?').bind(1).run();
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
function instrumentD1WithSentry(db) {
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
146
|
+
db.prepare = new Proxy(db.prepare, {
|
|
147
|
+
apply(target, thisArg, args) {
|
|
148
|
+
const [query] = args;
|
|
149
|
+
return instrumentD1PreparedStatement(Reflect.apply(target, thisArg, args), query);
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
return db;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
exports.instrumentD1WithSentry = instrumentD1WithSentry;
|
|
157
|
+
//# sourceMappingURL=d1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"d1.js","sources":["../../src/d1.ts"],"sourcesContent":["import type { D1Database, D1PreparedStatement, D1Response } from '@cloudflare/workers-types';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, addBreadcrumb, startSpan } from '@sentry/core';\nimport type { Span, SpanAttributes, StartSpanOptions } from '@sentry/types';\n\n// Patching is based on internal Cloudflare D1 API\n// https://github.com/cloudflare/workerd/blob/cd5279e7b305003f1d9c851e73efa9d67e4b68b2/src/cloudflare/internal/d1-api.ts\n\nconst patchedStatement = new WeakSet<D1PreparedStatement>();\n\n/**\n * Patches the query methods of a Cloudflare D1 prepared statement with Sentry.\n */\nfunction instrumentD1PreparedStatementQueries(statement: D1PreparedStatement, query: string): D1PreparedStatement {\n if (patchedStatement.has(statement)) {\n return statement;\n }\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n statement.first = new Proxy(statement.first, {\n apply(target, thisArg, args: Parameters<typeof statement.first>) {\n return startSpan(createStartSpanOptions(query, 'first'), async () => {\n const res = await Reflect.apply(target, thisArg, args);\n createD1Breadcrumb(query, 'first');\n return res;\n });\n },\n });\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n statement.run = new Proxy(statement.run, {\n apply(target, thisArg, args: Parameters<typeof statement.run>) {\n return startSpan(createStartSpanOptions(query, 'run'), async span => {\n const d1Response = await Reflect.apply(target, thisArg, args);\n applyD1ReturnObjectToSpan(span, d1Response);\n createD1Breadcrumb(query, 'run', d1Response);\n return d1Response;\n });\n },\n });\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n statement.all = new Proxy(statement.all, {\n apply(target, thisArg, args: Parameters<typeof statement.all>) {\n return startSpan(createStartSpanOptions(query, 'all'), async span => {\n const d1Result = await Reflect.apply(target, thisArg, args);\n applyD1ReturnObjectToSpan(span, d1Result);\n createD1Breadcrumb(query, 'all', d1Result);\n return d1Result;\n });\n },\n });\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n statement.raw = new Proxy(statement.raw, {\n apply(target, thisArg, args: Parameters<typeof statement.raw>) {\n return startSpan(createStartSpanOptions(query, 'raw'), async () => {\n const res = await Reflect.apply(target, thisArg, args);\n createD1Breadcrumb(query, 'raw');\n return res;\n });\n },\n });\n\n patchedStatement.add(statement);\n\n return statement;\n}\n\n/**\n * Instruments a Cloudflare D1 prepared statement with Sentry.\n *\n * This is meant to be used as a top-level call, under the hood it calls `instrumentD1PreparedStatementQueries`\n * to patch the query methods. The reason for this abstraction is to ensure that the `bind` method is also patched.\n */\nfunction instrumentD1PreparedStatement(statement: D1PreparedStatement, query: string): D1PreparedStatement {\n // statement.bind() returns a new instance of D1PreparedStatement, so we have to patch it as well.\n // eslint-disable-next-line @typescript-eslint/unbound-method\n statement.bind = new Proxy(statement.bind, {\n apply(target, thisArg, args: Parameters<typeof statement.bind>) {\n return instrumentD1PreparedStatementQueries(Reflect.apply(target, thisArg, args), query);\n },\n });\n\n return instrumentD1PreparedStatementQueries(statement, query);\n}\n\n/**\n * Add D1Response meta information to a span.\n *\n * See: https://developers.cloudflare.com/d1/build-with-d1/d1-client-api/#return-object\n */\nfunction applyD1ReturnObjectToSpan(span: Span, d1Result: D1Response): void {\n if (!d1Result.success) {\n span.setStatus({ code: SPAN_STATUS_ERROR });\n }\n\n span.setAttributes(getAttributesFromD1Response(d1Result));\n}\n\nfunction getAttributesFromD1Response(d1Result: D1Response): SpanAttributes {\n return {\n 'cloudflare.d1.duration': d1Result.meta.duration,\n 'cloudflare.d1.rows_read': d1Result.meta.rows_read,\n 'cloudflare.d1.rows_written': d1Result.meta.rows_written,\n };\n}\n\nfunction createD1Breadcrumb(query: string, type: 'first' | 'run' | 'all' | 'raw', d1Result?: D1Response): void {\n addBreadcrumb({\n category: 'query',\n message: query,\n data: {\n ...(d1Result ? getAttributesFromD1Response(d1Result) : {}),\n 'cloudflare.d1.query_type': type,\n },\n });\n}\n\nfunction createStartSpanOptions(query: string, type: 'first' | 'run' | 'all' | 'raw'): StartSpanOptions {\n return {\n op: 'db.query',\n name: query,\n attributes: {\n 'cloudflare.d1.query_type': type,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.d1',\n },\n };\n}\n\n/**\n * Instruments Cloudflare D1 bindings with Sentry.\n *\n * Currently, only prepared statements are instrumented. `db.exec` and `db.batch` are not instrumented.\n *\n * @example\n *\n * ```js\n * // env.DB is the D1 DB binding configured in your `wrangler.toml`\n * const db = instrumentD1WithSentry(env.DB);\n * // Now you can use the database as usual\n * await db.prepare('SELECT * FROM table WHERE id = ?').bind(1).run();\n * ```\n */\nexport function instrumentD1WithSentry(db: D1Database): D1Database {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n db.prepare = new Proxy(db.prepare, {\n apply(target, thisArg, args: Parameters<typeof db.prepare>) {\n const [query] = args;\n return instrumentD1PreparedStatement(Reflect.apply(target, thisArg, args), query);\n },\n });\n\n return db;\n}\n"],"names":["startSpan","SPAN_STATUS_ERROR","addBreadcrumb","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN"],"mappings":";;;;AAIA;AACA;AACA;AACA,MAAM,gBAAiB,GAAE,IAAI,OAAO,EAAuB,CAAA;AAC3D;AACA;AACA;AACA;AACA,SAAS,oCAAoC,CAAC,SAAS,EAAuB,KAAK,EAA+B;AAClH,EAAE,IAAI,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;AACvC,IAAI,OAAO,SAAS,CAAA;AACpB,GAAE;AACF;AACA;AACA,EAAE,SAAS,CAAC,KAAA,GAAQ,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE;AAC/C,IAAI,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAsC;AACrE,MAAM,OAAOA,cAAS,CAAC,sBAAsB,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,YAAY;AAC3E,QAAQ,MAAM,GAAA,GAAM,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;AAC9D,QAAQ,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;AAC1C,QAAQ,OAAO,GAAG,CAAA;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iC;AAChE,MAAM,MAAM,CAAC,KAAK,CAAA,GAAI,IAAI,CAAA;AAC1B,MAAM,OAAO,6BAA6B,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAAA;AACvF,KAAK;AACL,GAAG,CAAC,CAAA;AACJ;AACA,EAAE,OAAO,EAAE,CAAA;AACX;;;;"}
|
package/build/cjs/handler.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
|
|
3
|
+
const core = require('@sentry/core');
|
|
3
4
|
const async = require('./async.js');
|
|
4
5
|
const request = require('./request.js');
|
|
6
|
+
const scopeUtils = require('./scope-utils.js');
|
|
7
|
+
const sdk = require('./sdk.js');
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* Extract environment generic from exported handler.
|
|
@@ -39,6 +42,53 @@ function withSentry(
|
|
|
39
42
|
(handler.fetch ).__SENTRY_INSTRUMENTED__ = true;
|
|
40
43
|
}
|
|
41
44
|
|
|
45
|
+
if (
|
|
46
|
+
'scheduled' in handler &&
|
|
47
|
+
typeof handler.scheduled === 'function' &&
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
|
49
|
+
!(handler.scheduled ).__SENTRY_INSTRUMENTED__
|
|
50
|
+
) {
|
|
51
|
+
handler.scheduled = new Proxy(handler.scheduled, {
|
|
52
|
+
apply(target, thisArg, args) {
|
|
53
|
+
const [event, env, context] = args;
|
|
54
|
+
return core.withIsolationScope(isolationScope => {
|
|
55
|
+
const options = optionsCallback(env);
|
|
56
|
+
const client = sdk.init(options);
|
|
57
|
+
isolationScope.setClient(client);
|
|
58
|
+
|
|
59
|
+
scopeUtils.addCloudResourceContext(isolationScope);
|
|
60
|
+
|
|
61
|
+
return core.startSpan(
|
|
62
|
+
{
|
|
63
|
+
op: 'faas.cron',
|
|
64
|
+
name: `Scheduled Cron ${event.cron}`,
|
|
65
|
+
attributes: {
|
|
66
|
+
'faas.cron': event.cron,
|
|
67
|
+
'faas.time': new Date(event.scheduledTime).toISOString(),
|
|
68
|
+
'faas.trigger': 'timer',
|
|
69
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare',
|
|
70
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
async () => {
|
|
74
|
+
try {
|
|
75
|
+
return await (target.apply(thisArg, args) );
|
|
76
|
+
} catch (e) {
|
|
77
|
+
core.captureException(e, { mechanism: { handled: false, type: 'cloudflare' } });
|
|
78
|
+
throw e;
|
|
79
|
+
} finally {
|
|
80
|
+
context.waitUntil(core.flush(2000));
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
|
89
|
+
(handler.scheduled ).__SENTRY_INSTRUMENTED__ = true;
|
|
90
|
+
}
|
|
91
|
+
|
|
42
92
|
return handler;
|
|
43
93
|
}
|
|
44
94
|
|
package/build/cjs/handler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.js","sources":["../../src/handler.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"handler.js","sources":["../../src/handler.ts"],"sourcesContent":["import type {\n ExportedHandler,\n ExportedHandlerFetchHandler,\n ExportedHandlerScheduledHandler,\n} from '@cloudflare/workers-types';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n captureException,\n flush,\n startSpan,\n withIsolationScope,\n} from '@sentry/core';\nimport { setAsyncLocalStorageAsyncContextStrategy } from './async';\nimport type { CloudflareOptions } from './client';\nimport { wrapRequestHandler } from './request';\nimport { addCloudResourceContext } from './scope-utils';\nimport { init } from './sdk';\n\n/**\n * Extract environment generic from exported handler.\n */\ntype ExtractEnv<P> = P extends ExportedHandler<infer Env> ? Env : never;\n\n/**\n * Wrapper for Cloudflare handlers.\n *\n * Initializes the SDK and wraps the handler with Sentry instrumentation.\n *\n * Automatically instruments the `fetch` method of the handler.\n *\n * @param optionsCallback Function that returns the options for the SDK initialization.\n * @param handler {ExportedHandler} The handler to wrap.\n * @returns The wrapped handler.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function withSentry<E extends ExportedHandler<any>>(\n optionsCallback: (env: ExtractEnv<E>) => CloudflareOptions,\n handler: E,\n): E {\n setAsyncLocalStorageAsyncContextStrategy();\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n if ('fetch' in handler && typeof handler.fetch === 'function' && !(handler.fetch as any).__SENTRY_INSTRUMENTED__) {\n handler.fetch = new Proxy(handler.fetch, {\n apply(target, thisArg, args: Parameters<ExportedHandlerFetchHandler<ExtractEnv<E>>>) {\n const [request, env, context] = args;\n const options = optionsCallback(env);\n return wrapRequestHandler({ options, request, context }, () => target.apply(thisArg, args));\n },\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n (handler.fetch as any).__SENTRY_INSTRUMENTED__ = true;\n }\n\n if (\n 'scheduled' in handler &&\n typeof handler.scheduled === 'function' &&\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n !(handler.scheduled as any).__SENTRY_INSTRUMENTED__\n ) {\n handler.scheduled = new Proxy(handler.scheduled, {\n apply(target, thisArg, args: Parameters<ExportedHandlerScheduledHandler<ExtractEnv<E>>>) {\n const [event, env, context] = args;\n return withIsolationScope(isolationScope => {\n const options = optionsCallback(env);\n const client = init(options);\n isolationScope.setClient(client);\n\n addCloudResourceContext(isolationScope);\n\n return startSpan(\n {\n op: 'faas.cron',\n name: `Scheduled Cron ${event.cron}`,\n attributes: {\n 'faas.cron': event.cron,\n 'faas.time': new Date(event.scheduledTime).toISOString(),\n 'faas.trigger': 'timer',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task',\n },\n },\n async () => {\n try {\n return await (target.apply(thisArg, args) as ReturnType<typeof target>);\n } catch (e) {\n captureException(e, { mechanism: { handled: false, type: 'cloudflare' } });\n throw e;\n } finally {\n context.waitUntil(flush(2000));\n }\n },\n );\n });\n },\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n (handler.scheduled as any).__SENTRY_INSTRUMENTED__ = true;\n }\n\n return handler;\n}\n"],"names":["setAsyncLocalStorageAsyncContextStrategy","request","wrapRequestHandler","withIsolationScope","init","addCloudResourceContext","startSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","captureException","flush"],"mappings":";;;;;;;;AAmBA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,UAAU;AAC1B,EAAE,eAAe;AACjB,EAAE,OAAO;AACT,EAAK;AACL,EAAEA,8CAAwC,EAAE,CAAA;AAC5C;AACA;AACA,EAAE,IAAI,OAAQ,IAAG,WAAW,OAAO,OAAO,CAAC,KAAA,KAAU,UAAW,IAAG,CAAC,CAAC,OAAO,CAAC,KAAM,GAAQ,uBAAuB,EAAE;AACpH,IAAI,OAAO,CAAC,KAAA,GAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE;AAC7C,MAAM,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAA0D;AAC3F,QAAQ,MAAM,CAACC,SAAO,EAAE,GAAG,EAAE,OAAO,CAAE,GAAE,IAAI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BAAA,WAAA,EAAA,IAAA,IAAA,CAAA,KAAA,CAAA,aAAA,CAAA,CAAA,WAAA,EAAA;AACA,gBAAA,cAAA,EAAA,OAAA;AACA,gBAAA,CAAAC,qCAAA,GAAA,sBAAA;AACA,gBAAA,CAAAC,qCAAA,GAAA,MAAA;AACA,eAAA;AACA,aAAA;AACA,YAAA,YAAA;AACA,cAAA,IAAA;AACA,gBAAA,OAAA,OAAA,MAAA,CAAA,KAAA,CAAA,OAAA,EAAA,IAAA,CAAA,EAAA,CAAA;AACA,eAAA,CAAA,OAAA,CAAA,EAAA;AACA,gBAAAC,qBAAA,CAAA,CAAA,EAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,KAAA,EAAA,IAAA,EAAA,YAAA,EAAA,EAAA,CAAA,CAAA;AACA,gBAAA,MAAA,CAAA,CAAA;AACA,eAAA,SAAA;AACA,gBAAA,OAAA,CAAA,SAAA,CAAAC,UAAA,CAAA,IAAA,CAAA,CAAA,CAAA;AACA,eAAA;AACA,aAAA;AACA,WAAA,CAAA;AACA,SAAA,CAAA,CAAA;AACA,OAAA;AACA,KAAA,CAAA,CAAA;AACA;AACA;AACA,IAAA,CAAA,OAAA,CAAA,SAAA,GAAA,uBAAA,GAAA,IAAA,CAAA;AACA,GAAA;AACA;AACA,EAAA,OAAA,OAAA,CAAA;AACA;;;;"}
|
package/build/cjs/index.js
CHANGED
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
3
3
|
const core = require('@sentry/core');
|
|
4
4
|
const handler = require('./handler.js');
|
|
5
5
|
const pagesPlugin = require('./pages-plugin.js');
|
|
6
|
+
const request = require('./request.js');
|
|
6
7
|
const client = require('./client.js');
|
|
7
8
|
const sdk = require('./sdk.js');
|
|
8
9
|
const fetch = require('./integrations/fetch.js');
|
|
10
|
+
const d1 = require('./d1.js');
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
|
|
@@ -40,6 +42,7 @@ exports.getIsolationScope = core.getIsolationScope;
|
|
|
40
42
|
exports.getRootSpan = core.getRootSpan;
|
|
41
43
|
exports.getSpanDescendants = core.getSpanDescendants;
|
|
42
44
|
exports.getSpanStatusFromHttpCode = core.getSpanStatusFromHttpCode;
|
|
45
|
+
exports.getTraceData = core.getTraceData;
|
|
43
46
|
exports.inboundFiltersIntegration = core.inboundFiltersIntegration;
|
|
44
47
|
exports.isInitialized = core.isInitialized;
|
|
45
48
|
exports.lastEventId = core.lastEventId;
|
|
@@ -72,7 +75,9 @@ exports.withScope = core.withScope;
|
|
|
72
75
|
exports.zodErrorsIntegration = core.zodErrorsIntegration;
|
|
73
76
|
exports.withSentry = handler.withSentry;
|
|
74
77
|
exports.sentryPagesPlugin = pagesPlugin.sentryPagesPlugin;
|
|
78
|
+
exports.wrapRequestHandler = request.wrapRequestHandler;
|
|
75
79
|
exports.CloudflareClient = client.CloudflareClient;
|
|
76
80
|
exports.getDefaultIntegrations = sdk.getDefaultIntegrations;
|
|
77
81
|
exports.fetchIntegration = fetch.fetchIntegration;
|
|
82
|
+
exports.instrumentD1WithSentry = d1.instrumentD1WithSentry;
|
|
78
83
|
//# sourceMappingURL=index.js.map
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -8,25 +8,44 @@ const request = require('./request.js');
|
|
|
8
8
|
*
|
|
9
9
|
* Initializes the SDK and wraps cloudflare pages requests with SDK instrumentation.
|
|
10
10
|
*
|
|
11
|
-
* @example
|
|
11
|
+
* @example Simple usage
|
|
12
|
+
*
|
|
12
13
|
* ```javascript
|
|
13
14
|
* // functions/_middleware.js
|
|
14
15
|
* import * as Sentry from '@sentry/cloudflare';
|
|
15
16
|
*
|
|
16
17
|
* export const onRequest = Sentry.sentryPagesPlugin({
|
|
17
|
-
*
|
|
18
|
-
*
|
|
18
|
+
* dsn: process.env.SENTRY_DSN,
|
|
19
|
+
* tracesSampleRate: 1.0,
|
|
19
20
|
* });
|
|
20
21
|
* ```
|
|
21
22
|
*
|
|
22
|
-
* @
|
|
23
|
-
*
|
|
23
|
+
* @example Usage with handler function to access context for environmental variables
|
|
24
|
+
*
|
|
25
|
+
* ```javascript
|
|
26
|
+
* import * as Sentry from '@sentry/cloudflare';
|
|
27
|
+
*
|
|
28
|
+
* const const onRequest = Sentry.sentryPagesPlugin((context) => ({
|
|
29
|
+
* dsn: context.env.SENTRY_DSN,
|
|
30
|
+
* tracesSampleRate: 1.0,
|
|
31
|
+
* })
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param handlerOrOptions Configuration options or a function that returns configuration options.
|
|
35
|
+
* @returns A plugin function that can be used in Cloudflare Pages.
|
|
24
36
|
*/
|
|
25
37
|
function sentryPagesPlugin
|
|
26
38
|
|
|
27
|
-
(
|
|
39
|
+
(
|
|
40
|
+
handlerOrOptions
|
|
41
|
+
|
|
42
|
+
,
|
|
43
|
+
) {
|
|
28
44
|
async.setAsyncLocalStorageAsyncContextStrategy();
|
|
29
|
-
return context =>
|
|
45
|
+
return context => {
|
|
46
|
+
const options = typeof handlerOrOptions === 'function' ? handlerOrOptions(context) : handlerOrOptions;
|
|
47
|
+
return request.wrapRequestHandler({ options, request: context.request, context }, () => context.next());
|
|
48
|
+
};
|
|
30
49
|
}
|
|
31
50
|
|
|
32
51
|
exports.sentryPagesPlugin = sentryPagesPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages-plugin.js","sources":["../../src/pages-plugin.ts"],"sourcesContent":["import { setAsyncLocalStorageAsyncContextStrategy } from './async';\nimport type { CloudflareOptions } from './client';\nimport { wrapRequestHandler } from './request';\n\n/**\n * Plugin middleware for Cloudflare Pages.\n *\n * Initializes the SDK and wraps cloudflare pages requests with SDK instrumentation.\n *\n * @example\n * ```javascript\n * // functions/_middleware.js\n * import * as Sentry from '@sentry/cloudflare';\n *\n * export const onRequest = Sentry.sentryPagesPlugin({\n *
|
|
1
|
+
{"version":3,"file":"pages-plugin.js","sources":["../../src/pages-plugin.ts"],"sourcesContent":["import { setAsyncLocalStorageAsyncContextStrategy } from './async';\nimport type { CloudflareOptions } from './client';\nimport { wrapRequestHandler } from './request';\n\n/**\n * Plugin middleware for Cloudflare Pages.\n *\n * Initializes the SDK and wraps cloudflare pages requests with SDK instrumentation.\n *\n * @example Simple usage\n *\n * ```javascript\n * // functions/_middleware.js\n * import * as Sentry from '@sentry/cloudflare';\n *\n * export const onRequest = Sentry.sentryPagesPlugin({\n * dsn: process.env.SENTRY_DSN,\n * tracesSampleRate: 1.0,\n * });\n * ```\n *\n * @example Usage with handler function to access context for environmental variables\n *\n * ```javascript\n * import * as Sentry from '@sentry/cloudflare';\n *\n * const const onRequest = Sentry.sentryPagesPlugin((context) => ({\n * dsn: context.env.SENTRY_DSN,\n * tracesSampleRate: 1.0,\n * })\n * ```\n *\n * @param handlerOrOptions Configuration options or a function that returns configuration options.\n * @returns A plugin function that can be used in Cloudflare Pages.\n */\nexport function sentryPagesPlugin<\n Env = unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Params extends string = any,\n Data extends Record<string, unknown> = Record<string, unknown>,\n // Although it is not ideal to use `any` here, it makes usage more flexible for different setups.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n PluginParams = any,\n>(\n handlerOrOptions:\n | CloudflareOptions\n | ((context: EventPluginContext<Env, Params, Data, PluginParams>) => CloudflareOptions),\n): PagesPluginFunction<Env, Params, Data, PluginParams> {\n setAsyncLocalStorageAsyncContextStrategy();\n return context => {\n const options = typeof handlerOrOptions === 'function' ? handlerOrOptions(context) : handlerOrOptions;\n return wrapRequestHandler({ options, request: context.request, context }, () => context.next());\n };\n}\n"],"names":["setAsyncLocalStorageAsyncContextStrategy","wrapRequestHandler"],"mappings":";;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB;;AAQjC;AACA,EAAE,gBAAgB;AACd;AACA;AACJ,EAAwD;AACxD,EAAEA,8CAAwC,EAAE,CAAA;AAC5C,EAAE,OAAO,WAAW;AACpB,IAAI,MAAM,OAAA,GAAU,OAAO,gBAAiB,KAAI,UAAW,GAAE,gBAAgB,CAAC,OAAO,CAAA,GAAI,gBAAgB,CAAA;AACzG,IAAI,OAAOC,0BAAkB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAQ,EAAC,EAAE,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;AACnG,GAAG,CAAA;AACH;;;;"}
|
package/build/cjs/request.js
CHANGED
|
@@ -2,6 +2,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
2
2
|
|
|
3
3
|
const core = require('@sentry/core');
|
|
4
4
|
const utils = require('@sentry/utils');
|
|
5
|
+
const scopeUtils = require('./scope-utils.js');
|
|
5
6
|
const sdk = require('./sdk.js');
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -39,11 +40,11 @@ function wrapRequestHandler(
|
|
|
39
40
|
// skip
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
addCloudResourceContext(isolationScope);
|
|
43
|
+
scopeUtils.addCloudResourceContext(isolationScope);
|
|
43
44
|
if (request) {
|
|
44
|
-
addRequest(isolationScope, request);
|
|
45
|
+
scopeUtils.addRequest(isolationScope, request);
|
|
45
46
|
if (request.cf) {
|
|
46
|
-
addCultureContext(isolationScope, request.cf);
|
|
47
|
+
scopeUtils.addCultureContext(isolationScope, request.cf);
|
|
47
48
|
attributes['network.protocol.name'] = request.cf.httpProtocol;
|
|
48
49
|
}
|
|
49
50
|
}
|
|
@@ -79,30 +80,5 @@ function wrapRequestHandler(
|
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
/**
|
|
83
|
-
* Set cloud resource context on scope.
|
|
84
|
-
*/
|
|
85
|
-
function addCloudResourceContext(scope) {
|
|
86
|
-
scope.setContext('cloud_resource', {
|
|
87
|
-
'cloud.provider': 'cloudflare',
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Set culture context on scope
|
|
93
|
-
*/
|
|
94
|
-
function addCultureContext(scope, cf) {
|
|
95
|
-
scope.setContext('culture', {
|
|
96
|
-
timezone: cf.timezone,
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Set request data on scope
|
|
102
|
-
*/
|
|
103
|
-
function addRequest(scope, request) {
|
|
104
|
-
scope.setSDKProcessingMetadata({ request: utils.winterCGRequestToRequestData(request) });
|
|
105
|
-
}
|
|
106
|
-
|
|
107
83
|
exports.wrapRequestHandler = wrapRequestHandler;
|
|
108
84
|
//# sourceMappingURL=request.js.map
|
package/build/cjs/request.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sources":["../../src/request.ts"],"sourcesContent":["import type { ExecutionContext, IncomingRequestCfProperties } from '@cloudflare/workers-types';\n\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n captureException,\n continueTrace,\n flush,\n setHttpStatus,\n startSpan,\n withIsolationScope,\n} from '@sentry/core';\nimport type {
|
|
1
|
+
{"version":3,"file":"request.js","sources":["../../src/request.ts"],"sourcesContent":["import type { ExecutionContext, IncomingRequestCfProperties } from '@cloudflare/workers-types';\n\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n captureException,\n continueTrace,\n flush,\n setHttpStatus,\n startSpan,\n withIsolationScope,\n} from '@sentry/core';\nimport type { SpanAttributes } from '@sentry/types';\nimport { stripUrlQueryAndFragment } from '@sentry/utils';\nimport type { CloudflareOptions } from './client';\nimport { addCloudResourceContext, addCultureContext, addRequest } from './scope-utils';\nimport { init } from './sdk';\n\ninterface RequestHandlerWrapperOptions {\n options: CloudflareOptions;\n request: Request<unknown, IncomingRequestCfProperties<unknown>>;\n context: ExecutionContext;\n}\n\n/**\n * Wraps a cloudflare request handler in Sentry instrumentation\n */\nexport function wrapRequestHandler(\n wrapperOptions: RequestHandlerWrapperOptions,\n handler: (...args: unknown[]) => Response | Promise<Response>,\n): Promise<Response> {\n return withIsolationScope(async isolationScope => {\n const { options, request, context } = wrapperOptions;\n const client = init(options);\n isolationScope.setClient(client);\n\n const attributes: SpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.cloudflare',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server',\n ['http.request.method']: request.method,\n ['url.full']: request.url,\n };\n\n const contentLength = request.headers.get('content-length');\n if (contentLength) {\n attributes['http.request.body.size'] = parseInt(contentLength, 10);\n }\n\n let pathname = '';\n try {\n const url = new URL(request.url);\n pathname = url.pathname;\n attributes['server.address'] = url.hostname;\n attributes['url.scheme'] = url.protocol.replace(':', '');\n } catch {\n // skip\n }\n\n addCloudResourceContext(isolationScope);\n if (request) {\n addRequest(isolationScope, request);\n if (request.cf) {\n addCultureContext(isolationScope, request.cf);\n attributes['network.protocol.name'] = request.cf.httpProtocol;\n }\n }\n\n const routeName = `${request.method} ${pathname ? stripUrlQueryAndFragment(pathname) : '/'}`;\n\n return continueTrace(\n { sentryTrace: request.headers.get('sentry-trace') || '', baggage: request.headers.get('baggage') },\n () => {\n // Note: This span will not have a duration unless I/O happens in the handler. This is\n // because of how the cloudflare workers runtime works.\n // See: https://developers.cloudflare.com/workers/runtime-apis/performance/\n return startSpan(\n {\n name: routeName,\n attributes,\n },\n async span => {\n try {\n const res = await handler();\n setHttpStatus(span, res.status);\n return res;\n } catch (e) {\n captureException(e, { mechanism: { handled: false, type: 'cloudflare' } });\n throw e;\n } finally {\n context.waitUntil(flush(2000));\n }\n },\n );\n },\n );\n });\n}\n"],"names":["withIsolationScope","init","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","SEMANTIC_ATTRIBUTE_SENTRY_OP","addCloudResourceContext","addRequest","addCultureContext","stripUrlQueryAndFragment","continueTrace","startSpan","setHttpStatus","captureException","flush"],"mappings":";;;;;;;AAyBA;AACA;AACA;AACO,SAAS,kBAAkB;AAClC,EAAE,cAAc;AAChB,EAAE,OAAO;AACT,EAAqB;AACrB,EAAE,OAAOA,uBAAkB,CAAC,MAAM,kBAAkB;AACpD,IAAI,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAA,EAAU,GAAE,cAAc,CAAA;AACxD,IAAI,MAAM,MAAO,GAAEC,QAAI,CAAC,OAAO,CAAC,CAAA;AAChC,IAAI,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;AACpC;AACA,IAAI,MAAM,UAAU,GAAmB;AACvC,MAAM,CAACC,qCAAgC,GAAG,sBAAsB;AAChE,MAAM,CAACC,qCAAgC,GAAG,KAAK;AAC/C,MAAM,CAACC,iCAA4B,GAAG,aAAa;AACnD,MAAM,CAAC,qBAAqB,GAAG,OAAO,CAAC,MAAM;AAC7C,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,GAAG;AAC/B,KAAK,CAAA;AACL;AACA,IAAI,MAAM,aAAc,GAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;AAC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;AACA,MAAA,MAAA;AACA;AACA;AACA;AACA,QAAA,OAAAC,cAAA;AACA,UAAA;AACA,YAAA,IAAA,EAAA,SAAA;AACA,YAAA,UAAA;AACA,WAAA;AACA,UAAA,MAAA,IAAA,IAAA;AACA,YAAA,IAAA;AACA,cAAA,MAAA,GAAA,GAAA,MAAA,OAAA,EAAA,CAAA;AACA,cAAAC,kBAAA,CAAA,IAAA,EAAA,GAAA,CAAA,MAAA,CAAA,CAAA;AACA,cAAA,OAAA,GAAA,CAAA;AACA,aAAA,CAAA,OAAA,CAAA,EAAA;AACA,cAAAC,qBAAA,CAAA,CAAA,EAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,KAAA,EAAA,IAAA,EAAA,YAAA,EAAA,EAAA,CAAA,CAAA;AACA,cAAA,MAAA,CAAA,CAAA;AACA,aAAA,SAAA;AACA,cAAA,OAAA,CAAA,SAAA,CAAAC,UAAA,CAAA,IAAA,CAAA,CAAA,CAAA;AACA,aAAA;AACA,WAAA;AACA,SAAA,CAAA;AACA,OAAA;AACA,KAAA,CAAA;AACA,GAAA,CAAA,CAAA;AACA;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
|
|
3
|
+
const utils = require('@sentry/utils');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Set cloud resource context on scope.
|
|
7
|
+
*/
|
|
8
|
+
function addCloudResourceContext(scope) {
|
|
9
|
+
scope.setContext('cloud_resource', {
|
|
10
|
+
'cloud.provider': 'cloudflare',
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Set culture context on scope
|
|
16
|
+
*/
|
|
17
|
+
function addCultureContext(scope, cf) {
|
|
18
|
+
scope.setContext('culture', {
|
|
19
|
+
timezone: cf.timezone,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Set request data on scope
|
|
25
|
+
*/
|
|
26
|
+
function addRequest(scope, request) {
|
|
27
|
+
scope.setSDKProcessingMetadata({ request: utils.winterCGRequestToRequestData(request) });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.addCloudResourceContext = addCloudResourceContext;
|
|
31
|
+
exports.addCultureContext = addCultureContext;
|
|
32
|
+
exports.addRequest = addRequest;
|
|
33
|
+
//# sourceMappingURL=scope-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-utils.js","sources":["../../src/scope-utils.ts"],"sourcesContent":["import type { IncomingRequestCfProperties } from '@cloudflare/workers-types';\n\nimport type { Scope } from '@sentry/types';\nimport { winterCGRequestToRequestData } from '@sentry/utils';\n\n/**\n * Set cloud resource context on scope.\n */\nexport function addCloudResourceContext(scope: Scope): void {\n scope.setContext('cloud_resource', {\n 'cloud.provider': 'cloudflare',\n });\n}\n\n/**\n * Set culture context on scope\n */\nexport function addCultureContext(scope: Scope, cf: IncomingRequestCfProperties): void {\n scope.setContext('culture', {\n timezone: cf.timezone,\n });\n}\n\n/**\n * Set request data on scope\n */\nexport function addRequest(scope: Scope, request: Request): void {\n scope.setSDKProcessingMetadata({ request: winterCGRequestToRequestData(request) });\n}\n"],"names":["winterCGRequestToRequestData"],"mappings":";;;;AAKA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,KAAK,EAAe;AAC5D,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,EAAE;AACrC,IAAI,gBAAgB,EAAE,YAAY;AAClC,GAAG,CAAC,CAAA;AACJ,CAAA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,KAAK,EAAS,EAAE,EAAqC;AACvF,EAAE,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE;AAC9B,IAAI,QAAQ,EAAE,EAAE,CAAC,QAAQ;AACzB,GAAG,CAAC,CAAA;AACJ,CAAA;AACA;AACA;AACA;AACA;AACO,SAAS,UAAU,CAAC,KAAK,EAAS,OAAO,EAAiB;AACjE,EAAE,KAAK,CAAC,wBAAwB,CAAC,EAAE,OAAO,EAAEA,kCAA4B,CAAC,OAAO,CAAE,EAAC,CAAC,CAAA;AACpF;;;;;;"}
|
package/build/cjs/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import {\n dedupeIntegration,\n functionToStringIntegration,\n getIntegrationsToSetup,\n inboundFiltersIntegration,\n initAndBind,\n linkedErrorsIntegration,\n requestDataIntegration,\n} from '@sentry/core';\nimport type { Integration
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import {\n dedupeIntegration,\n functionToStringIntegration,\n getIntegrationsToSetup,\n inboundFiltersIntegration,\n initAndBind,\n linkedErrorsIntegration,\n requestDataIntegration,\n} from '@sentry/core';\nimport type { Integration } from '@sentry/types';\nimport { stackParserFromStackParserOptions } from '@sentry/utils';\nimport type { CloudflareClientOptions, CloudflareOptions } from './client';\nimport { CloudflareClient } from './client';\n\nimport { fetchIntegration } from './integrations/fetch';\nimport { makeCloudflareTransport } from './transport';\nimport { defaultStackParser } from './vendor/stacktrace';\n\n/** Get the default integrations for the Cloudflare SDK. */\nexport function getDefaultIntegrations(options: CloudflareOptions): Integration[] {\n const sendDefaultPii = options.sendDefaultPii ?? false;\n return [\n dedupeIntegration(),\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n linkedErrorsIntegration(),\n fetchIntegration(),\n requestDataIntegration(sendDefaultPii ? undefined : { include: { cookies: false } }),\n ];\n}\n\n/**\n * Initializes the cloudflare SDK.\n */\nexport function init(options: CloudflareOptions): CloudflareClient | undefined {\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = getDefaultIntegrations(options);\n }\n\n const clientOptions: CloudflareClientOptions = {\n ...options,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup(options),\n transport: options.transport || makeCloudflareTransport,\n };\n\n return initAndBind(CloudflareClient, clientOptions) as CloudflareClient;\n}\n"],"names":["dedupeIntegration","inboundFiltersIntegration","functionToStringIntegration","linkedErrorsIntegration","fetchIntegration","requestDataIntegration","stackParserFromStackParserOptions","defaultStackParser","getIntegrationsToSetup","makeCloudflareTransport","initAndBind","CloudflareClient"],"mappings":";;;;;;;;;;;;;AAkBA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA;AACO,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsB,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,EAAoC;EAChF,CAAM,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAe,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,UAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;EACtD,CAAO,CAAA,CAAA,CAAA,CAAA,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