@sentry/cloudflare 10.53.1 → 10.54.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/build/cjs/async.js +4 -30
- package/build/cjs/async.js.map +1 -1
- package/build/cjs/client.js +31 -58
- package/build/cjs/client.js.map +1 -1
- package/build/cjs/d1.js +26 -80
- package/build/cjs/d1.js.map +1 -1
- package/build/cjs/debug-build.js +0 -5
- package/build/cjs/debug-build.js.map +1 -1
- package/build/cjs/durableobject.js +44 -131
- package/build/cjs/durableobject.js.map +1 -1
- package/build/cjs/flush.js +47 -34
- package/build/cjs/flush.js.map +1 -1
- package/build/cjs/instrument.js +7 -48
- package/build/cjs/instrument.js.map +1 -1
- package/build/cjs/instrumentations/instrumentDurableObjectNamespace.js +9 -34
- package/build/cjs/instrumentations/instrumentDurableObjectNamespace.js.map +1 -1
- package/build/cjs/instrumentations/instrumentDurableObjectStorage.js +20 -54
- package/build/cjs/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
- package/build/cjs/instrumentations/instrumentWorkerEntrypoint.js +12 -66
- package/build/cjs/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
- package/build/cjs/instrumentations/worker/instrumentEmail.js +21 -43
- package/build/cjs/instrumentations/worker/instrumentEmail.js.map +1 -1
- package/build/cjs/instrumentations/worker/instrumentEnv.js +12 -42
- package/build/cjs/instrumentations/worker/instrumentEnv.js.map +1 -1
- package/build/cjs/instrumentations/worker/instrumentFetch.js +20 -34
- package/build/cjs/instrumentations/worker/instrumentFetch.js.map +1 -1
- package/build/cjs/instrumentations/worker/instrumentFetcher.js +5 -19
- package/build/cjs/instrumentations/worker/instrumentFetcher.js.map +1 -1
- package/build/cjs/instrumentations/worker/instrumentQueue.js +30 -62
- package/build/cjs/instrumentations/worker/instrumentQueue.js.map +1 -1
- package/build/cjs/instrumentations/worker/instrumentQueueProducer.js +31 -57
- package/build/cjs/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
- package/build/cjs/instrumentations/worker/instrumentScheduled.js +25 -54
- package/build/cjs/instrumentations/worker/instrumentScheduled.js.map +1 -1
- package/build/cjs/instrumentations/worker/instrumentTail.js +16 -43
- package/build/cjs/instrumentations/worker/instrumentTail.js.map +1 -1
- package/build/cjs/integrations/fetch.js +24 -56
- package/build/cjs/integrations/fetch.js.map +1 -1
- package/build/cjs/integrations/hono.js +7 -38
- package/build/cjs/integrations/hono.js.map +1 -1
- package/build/cjs/integrations/httpServer.js +6 -39
- package/build/cjs/integrations/httpServer.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai.js +3 -31
- package/build/cjs/integrations/tracing/vercelai.js.map +1 -1
- package/build/cjs/opentelemetry/tracer.js +17 -45
- package/build/cjs/opentelemetry/tracer.js.map +1 -1
- package/build/cjs/options.js +10 -46
- package/build/cjs/options.js.map +1 -1
- package/build/cjs/pages-plugin.js +9 -42
- package/build/cjs/pages-plugin.js.map +1 -1
- package/build/cjs/request.js +21 -67
- package/build/cjs/request.js.map +1 -1
- package/build/cjs/scope-utils.js +4 -15
- package/build/cjs/scope-utils.js.map +1 -1
- package/build/cjs/sdk.js +8 -25
- package/build/cjs/sdk.js.map +1 -1
- package/build/cjs/transport.js +14 -48
- package/build/cjs/transport.js.map +1 -1
- package/build/cjs/utils/instrumentContext.js +16 -52
- package/build/cjs/utils/instrumentContext.js.map +1 -1
- package/build/cjs/utils/isBinding.js +3 -23
- package/build/cjs/utils/isBinding.js.map +1 -1
- package/build/cjs/utils/isCloudflareClass.js +2 -8
- package/build/cjs/utils/isCloudflareClass.js.map +1 -1
- package/build/cjs/utils/rpcMeta.js +8 -32
- package/build/cjs/utils/rpcMeta.js.map +1 -1
- package/build/cjs/utils/rpcOptions.js +9 -32
- package/build/cjs/utils/rpcOptions.js.map +1 -1
- package/build/cjs/utils/streaming.js +3 -29
- package/build/cjs/utils/streaming.js.map +1 -1
- package/build/cjs/utils/traceLinks.js +8 -33
- package/build/cjs/utils/traceLinks.js.map +1 -1
- package/build/cjs/vendor/stacktrace.js +6 -27
- package/build/cjs/vendor/stacktrace.js.map +1 -1
- package/build/cjs/withSentry.js +16 -47
- package/build/cjs/withSentry.js.map +1 -1
- package/build/cjs/workflows.js +40 -100
- package/build/cjs/workflows.js.map +1 -1
- package/build/cjs/wrapMethodWithSentry.js +110 -167
- package/build/cjs/wrapMethodWithSentry.js.map +1 -1
- package/build/esm/async.js +4 -30
- package/build/esm/async.js.map +1 -1
- package/build/esm/client.js +31 -58
- package/build/esm/client.js.map +1 -1
- package/build/esm/d1.js +26 -80
- package/build/esm/d1.js.map +1 -1
- package/build/esm/debug-build.js +0 -5
- package/build/esm/debug-build.js.map +1 -1
- package/build/esm/durableobject.js +44 -131
- package/build/esm/durableobject.js.map +1 -1
- package/build/esm/flush.js +47 -34
- package/build/esm/flush.js.map +1 -1
- package/build/esm/instrument.js +7 -48
- package/build/esm/instrument.js.map +1 -1
- package/build/esm/instrumentations/instrumentDurableObjectNamespace.js +9 -34
- package/build/esm/instrumentations/instrumentDurableObjectNamespace.js.map +1 -1
- package/build/esm/instrumentations/instrumentDurableObjectStorage.js +20 -54
- package/build/esm/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
- package/build/esm/instrumentations/instrumentWorkerEntrypoint.js +12 -66
- package/build/esm/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
- package/build/esm/instrumentations/worker/instrumentEmail.js +21 -43
- package/build/esm/instrumentations/worker/instrumentEmail.js.map +1 -1
- package/build/esm/instrumentations/worker/instrumentEnv.js +12 -42
- package/build/esm/instrumentations/worker/instrumentEnv.js.map +1 -1
- package/build/esm/instrumentations/worker/instrumentFetch.js +20 -34
- package/build/esm/instrumentations/worker/instrumentFetch.js.map +1 -1
- package/build/esm/instrumentations/worker/instrumentFetcher.js +5 -19
- package/build/esm/instrumentations/worker/instrumentFetcher.js.map +1 -1
- package/build/esm/instrumentations/worker/instrumentQueue.js +30 -62
- package/build/esm/instrumentations/worker/instrumentQueue.js.map +1 -1
- package/build/esm/instrumentations/worker/instrumentQueueProducer.js +31 -57
- package/build/esm/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
- package/build/esm/instrumentations/worker/instrumentScheduled.js +25 -54
- package/build/esm/instrumentations/worker/instrumentScheduled.js.map +1 -1
- package/build/esm/instrumentations/worker/instrumentTail.js +16 -43
- package/build/esm/instrumentations/worker/instrumentTail.js.map +1 -1
- package/build/esm/integrations/fetch.js +24 -56
- package/build/esm/integrations/fetch.js.map +1 -1
- package/build/esm/integrations/hono.js +7 -38
- package/build/esm/integrations/hono.js.map +1 -1
- package/build/esm/integrations/httpServer.js +6 -39
- package/build/esm/integrations/httpServer.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai.js +3 -31
- package/build/esm/integrations/tracing/vercelai.js.map +1 -1
- package/build/esm/opentelemetry/tracer.js +17 -45
- package/build/esm/opentelemetry/tracer.js.map +1 -1
- package/build/esm/options.js +10 -46
- package/build/esm/options.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/pages-plugin.js +9 -42
- package/build/esm/pages-plugin.js.map +1 -1
- package/build/esm/request.js +21 -67
- package/build/esm/request.js.map +1 -1
- package/build/esm/scope-utils.js +4 -15
- package/build/esm/scope-utils.js.map +1 -1
- package/build/esm/sdk.js +8 -25
- package/build/esm/sdk.js.map +1 -1
- package/build/esm/transport.js +14 -48
- package/build/esm/transport.js.map +1 -1
- package/build/esm/utils/instrumentContext.js +16 -52
- package/build/esm/utils/instrumentContext.js.map +1 -1
- package/build/esm/utils/isBinding.js +3 -23
- package/build/esm/utils/isBinding.js.map +1 -1
- package/build/esm/utils/isCloudflareClass.js +2 -8
- package/build/esm/utils/isCloudflareClass.js.map +1 -1
- package/build/esm/utils/rpcMeta.js +8 -32
- package/build/esm/utils/rpcMeta.js.map +1 -1
- package/build/esm/utils/rpcOptions.js +9 -32
- package/build/esm/utils/rpcOptions.js.map +1 -1
- package/build/esm/utils/streaming.js +3 -29
- package/build/esm/utils/streaming.js.map +1 -1
- package/build/esm/utils/traceLinks.js +8 -33
- package/build/esm/utils/traceLinks.js.map +1 -1
- package/build/esm/vendor/stacktrace.js +6 -27
- package/build/esm/vendor/stacktrace.js.map +1 -1
- package/build/esm/withSentry.js +16 -47
- package/build/esm/withSentry.js.map +1 -1
- package/build/esm/workflows.js +40 -100
- package/build/esm/workflows.js.map +1 -1
- package/build/esm/wrapMethodWithSentry.js +110 -167
- package/build/esm/wrapMethodWithSentry.js.map +1 -1
- package/build/types/client.d.ts.map +1 -1
- package/build/types/flush.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentFetch.d.ts.map +1 -1
- package/build/types/pages-plugin.d.ts.map +1 -1
- package/package.json +2 -2
package/build/esm/client.js
CHANGED
|
@@ -1,67 +1,51 @@
|
|
|
1
1
|
import { ServerRuntimeClient, applySdkMetadata, debug } from '@sentry/core';
|
|
2
2
|
import { DEBUG_BUILD } from './debug-build.js';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* The Sentry Cloudflare SDK Client.
|
|
6
|
-
*
|
|
7
|
-
* @see CloudflareClientOptions for documentation on configuration options.
|
|
8
|
-
* @see ServerRuntimeClient for usage documentation.
|
|
9
|
-
*/
|
|
10
4
|
class CloudflareClient extends ServerRuntimeClient {
|
|
11
|
-
|
|
12
|
-
__init() {this._pendingSpans = new Set();}
|
|
13
|
-
__init2() {this._spanCompletionPromise = null;}
|
|
14
|
-
__init3() {this._resolveSpanCompletion = null;}
|
|
15
|
-
|
|
16
|
-
__init4() {this._unsubscribeSpanStart = null;}
|
|
17
|
-
__init5() {this._unsubscribeSpanEnd = null;}
|
|
18
|
-
|
|
19
5
|
/**
|
|
20
6
|
* Creates a new Cloudflare SDK instance.
|
|
21
7
|
* @param options Configuration options for this SDK.
|
|
22
8
|
*/
|
|
23
|
-
|
|
24
|
-
applySdkMetadata(options,
|
|
9
|
+
constructor(options) {
|
|
10
|
+
applySdkMetadata(options, "cloudflare");
|
|
25
11
|
options._metadata = options._metadata || {};
|
|
26
12
|
const { flushLock, ...serverOptions } = options;
|
|
27
|
-
|
|
28
13
|
const clientOptions = {
|
|
29
14
|
...serverOptions,
|
|
30
|
-
platform:
|
|
15
|
+
platform: "javascript",
|
|
31
16
|
// TODO: Grab version information
|
|
32
|
-
runtime: { name:
|
|
17
|
+
runtime: { name: "cloudflare" },
|
|
33
18
|
// TODO: Add server name
|
|
19
|
+
_flushInterval: 0
|
|
34
20
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this._unsubscribeSpanStart =
|
|
21
|
+
super(clientOptions);
|
|
22
|
+
this._pendingSpans = /* @__PURE__ */ new Set();
|
|
23
|
+
this._spanCompletionPromise = null;
|
|
24
|
+
this._resolveSpanCompletion = null;
|
|
25
|
+
this._unsubscribeSpanStart = null;
|
|
26
|
+
this._unsubscribeSpanEnd = null;
|
|
27
|
+
this._flushLock = flushLock;
|
|
28
|
+
this._unsubscribeSpanStart = this.on("spanStart", (span) => {
|
|
40
29
|
const spanId = span.spanContext().spanId;
|
|
41
|
-
DEBUG_BUILD && debug.log(
|
|
30
|
+
DEBUG_BUILD && debug.log("[CloudflareClient] Span started:", spanId);
|
|
42
31
|
this._pendingSpans.add(spanId);
|
|
43
|
-
|
|
44
32
|
if (!this._spanCompletionPromise) {
|
|
45
|
-
this._spanCompletionPromise = new Promise(resolve => {
|
|
33
|
+
this._spanCompletionPromise = new Promise((resolve) => {
|
|
46
34
|
this._resolveSpanCompletion = resolve;
|
|
47
35
|
});
|
|
48
36
|
}
|
|
49
37
|
});
|
|
50
|
-
|
|
51
|
-
this._unsubscribeSpanEnd = this.on('spanEnd', span => {
|
|
38
|
+
this._unsubscribeSpanEnd = this.on("spanEnd", (span) => {
|
|
52
39
|
const spanId = span.spanContext().spanId;
|
|
53
|
-
DEBUG_BUILD && debug.log(
|
|
40
|
+
DEBUG_BUILD && debug.log("[CloudflareClient] Span ended:", spanId);
|
|
54
41
|
this._pendingSpans.delete(spanId);
|
|
55
|
-
|
|
56
|
-
// If no more pending spans, resolve the completion promise
|
|
57
42
|
if (this._pendingSpans.size === 0 && this._resolveSpanCompletion) {
|
|
58
|
-
DEBUG_BUILD && debug.log(
|
|
43
|
+
DEBUG_BUILD && debug.log("[CloudflareClient] All spans completed, resolving promise");
|
|
59
44
|
this._resolveSpanCompletion();
|
|
60
45
|
this._resetSpanCompletionPromise();
|
|
61
46
|
}
|
|
62
47
|
});
|
|
63
48
|
}
|
|
64
|
-
|
|
65
49
|
/**
|
|
66
50
|
* Flushes pending operations and ensures all data is processed.
|
|
67
51
|
* If a timeout is provided, the operation will be completed within the specified time limit.
|
|
@@ -71,33 +55,26 @@ class CloudflareClient extends ServerRuntimeClient {
|
|
|
71
55
|
* @param {number} [timeout] - Optional timeout in milliseconds to force the completion of the flush operation.
|
|
72
56
|
* @return {Promise<boolean>} A promise that resolves to a boolean indicating whether the flush operation was successful.
|
|
73
57
|
*/
|
|
74
|
-
|
|
58
|
+
async flush(timeout) {
|
|
75
59
|
if (this._flushLock) {
|
|
76
60
|
await this._flushLock.finalize();
|
|
77
61
|
}
|
|
78
|
-
|
|
79
62
|
if (this._pendingSpans.size > 0 && this._spanCompletionPromise) {
|
|
80
|
-
DEBUG_BUILD &&
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const timeoutMs = timeout ?? 5000;
|
|
63
|
+
DEBUG_BUILD && debug.log("[CloudflareClient] Waiting for", this._pendingSpans.size, "pending spans to complete...");
|
|
64
|
+
const timeoutMs = timeout ?? 5e3;
|
|
84
65
|
const spanCompletionRace = Promise.race([
|
|
85
66
|
this._spanCompletionPromise,
|
|
86
|
-
new Promise(
|
|
87
|
-
setTimeout(() => {
|
|
88
|
-
DEBUG_BUILD &&
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
),
|
|
67
|
+
new Promise(
|
|
68
|
+
(resolve) => setTimeout(() => {
|
|
69
|
+
DEBUG_BUILD && debug.log("[CloudflareClient] Span completion timeout after", timeoutMs, "ms, flushing anyway");
|
|
70
|
+
resolve(void 0);
|
|
71
|
+
}, timeoutMs)
|
|
72
|
+
)
|
|
93
73
|
]);
|
|
94
|
-
|
|
95
74
|
await spanCompletionRace;
|
|
96
75
|
}
|
|
97
|
-
|
|
98
76
|
return super.flush(timeout);
|
|
99
77
|
}
|
|
100
|
-
|
|
101
78
|
/**
|
|
102
79
|
* Disposes of the client and releases all resources.
|
|
103
80
|
*
|
|
@@ -107,11 +84,9 @@ class CloudflareClient extends ServerRuntimeClient {
|
|
|
107
84
|
* Call this method after flushing to allow the client to be garbage collected.
|
|
108
85
|
* After calling dispose(), the client should not be used anymore.
|
|
109
86
|
*/
|
|
110
|
-
|
|
111
|
-
DEBUG_BUILD && debug.log(
|
|
112
|
-
|
|
87
|
+
dispose() {
|
|
88
|
+
DEBUG_BUILD && debug.log("[CloudflareClient] Disposing client...");
|
|
113
89
|
super.dispose();
|
|
114
|
-
|
|
115
90
|
if (this._unsubscribeSpanStart) {
|
|
116
91
|
this._unsubscribeSpanStart();
|
|
117
92
|
this._unsubscribeSpanStart = null;
|
|
@@ -120,15 +95,13 @@ class CloudflareClient extends ServerRuntimeClient {
|
|
|
120
95
|
this._unsubscribeSpanEnd();
|
|
121
96
|
this._unsubscribeSpanEnd = null;
|
|
122
97
|
}
|
|
123
|
-
|
|
124
98
|
this._resetSpanCompletionPromise();
|
|
125
|
-
|
|
99
|
+
this._flushLock = void 0;
|
|
126
100
|
}
|
|
127
|
-
|
|
128
101
|
/**
|
|
129
102
|
* Resets the span completion promise and resolve function.
|
|
130
103
|
*/
|
|
131
|
-
|
|
104
|
+
_resetSpanCompletionPromise() {
|
|
132
105
|
this._pendingSpans.clear();
|
|
133
106
|
this._spanCompletionPromise = null;
|
|
134
107
|
this._resolveSpanCompletion = null;
|
package/build/esm/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../../src/client.ts"],"sourcesContent":["import type { ClientOptions, Options, ServerRuntimeClientOptions } from '@sentry/core';\nimport { applySdkMetadata, debug, ServerRuntimeClient } from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build';\nimport type { makeFlushLock } from './flush';\nimport type { CloudflareTransportOptions } from './transport';\n\n/**\n * The Sentry Cloudflare SDK Client.\n *\n * @see CloudflareClientOptions for documentation on configuration options.\n * @see ServerRuntimeClient for usage documentation.\n */\nexport class CloudflareClient extends ServerRuntimeClient {\n private readonly _flushLock: ReturnType<typeof makeFlushLock> | void;\n private _pendingSpans: Set<string> = new Set();\n private _spanCompletionPromise: Promise<void> | null = null;\n private _resolveSpanCompletion: (() => void) | null = null;\n\n private _unsubscribeSpanStart: (() => void) | null = null;\n private _unsubscribeSpanEnd: (() => void) | null = null;\n\n /**\n * Creates a new Cloudflare SDK instance.\n * @param options Configuration options for this SDK.\n */\n public constructor(options: CloudflareClientOptions) {\n applySdkMetadata(options, 'cloudflare');\n options._metadata = options._metadata || {};\n const { flushLock, ...serverOptions } = options;\n\n const clientOptions: ServerRuntimeClientOptions = {\n ...serverOptions,\n platform: 'javascript',\n // TODO: Grab version information\n runtime: { name: 'cloudflare' },\n // TODO: Add server name\n };\n\n super(clientOptions);\n this._flushLock = flushLock;\n\n // Track span lifecycle to know when to flush\n this._unsubscribeSpanStart = this.on('spanStart', span => {\n const spanId = span.spanContext().spanId;\n DEBUG_BUILD && debug.log('[CloudflareClient] Span started:', spanId);\n this._pendingSpans.add(spanId);\n\n if (!this._spanCompletionPromise) {\n this._spanCompletionPromise = new Promise(resolve => {\n this._resolveSpanCompletion = resolve;\n });\n }\n });\n\n this._unsubscribeSpanEnd = this.on('spanEnd', span => {\n const spanId = span.spanContext().spanId;\n DEBUG_BUILD && debug.log('[CloudflareClient] Span ended:', spanId);\n this._pendingSpans.delete(spanId);\n\n // If no more pending spans, resolve the completion promise\n if (this._pendingSpans.size === 0 && this._resolveSpanCompletion) {\n DEBUG_BUILD && debug.log('[CloudflareClient] All spans completed, resolving promise');\n this._resolveSpanCompletion();\n this._resetSpanCompletionPromise();\n }\n });\n }\n\n /**\n * Flushes pending operations and ensures all data is processed.\n * If a timeout is provided, the operation will be completed within the specified time limit.\n *\n * It will wait for all pending spans to complete before flushing.\n *\n * @param {number} [timeout] - Optional timeout in milliseconds to force the completion of the flush operation.\n * @return {Promise<boolean>} A promise that resolves to a boolean indicating whether the flush operation was successful.\n */\n public async flush(timeout?: number): Promise<boolean> {\n if (this._flushLock) {\n await this._flushLock.finalize();\n }\n\n if (this._pendingSpans.size > 0 && this._spanCompletionPromise) {\n DEBUG_BUILD &&\n debug.log('[CloudflareClient] Waiting for', this._pendingSpans.size, 'pending spans to complete...');\n\n const timeoutMs = timeout ?? 5000;\n const spanCompletionRace = Promise.race([\n this._spanCompletionPromise,\n new Promise(resolve =>\n setTimeout(() => {\n DEBUG_BUILD &&\n debug.log('[CloudflareClient] Span completion timeout after', timeoutMs, 'ms, flushing anyway');\n resolve(undefined);\n }, timeoutMs),\n ),\n ]);\n\n await spanCompletionRace;\n }\n\n return super.flush(timeout);\n }\n\n /**\n * Disposes of the client and releases all resources.\n *\n * This method clears all Cloudflare-specific state in addition to the base client cleanup.\n * It unsubscribes from span lifecycle events and clears pending span tracking.\n *\n * Call this method after flushing to allow the client to be garbage collected.\n * After calling dispose(), the client should not be used anymore.\n */\n public override dispose(): void {\n DEBUG_BUILD && debug.log('[CloudflareClient] Disposing client...');\n\n super.dispose();\n\n if (this._unsubscribeSpanStart) {\n this._unsubscribeSpanStart();\n this._unsubscribeSpanStart = null;\n }\n if (this._unsubscribeSpanEnd) {\n this._unsubscribeSpanEnd();\n this._unsubscribeSpanEnd = null;\n }\n\n this._resetSpanCompletionPromise();\n (this as unknown as { _flushLock: ReturnType<typeof makeFlushLock> | void })._flushLock = undefined;\n }\n\n /**\n * Resets the span completion promise and resolve function.\n */\n private _resetSpanCompletionPromise(): void {\n this._pendingSpans.clear();\n this._spanCompletionPromise = null;\n this._resolveSpanCompletion = null;\n }\n}\n\ninterface BaseCloudflareOptions {\n /**\n * @ignore Used internally to disable the deDupeIntegration for workflows.\n * @hidden Used internally to disable the deDupeIntegration for workflows.\n * @default true\n */\n enableDedupe?: boolean;\n\n /**\n * The Cloudflare SDK is not OpenTelemetry native, however, we set up some OpenTelemetry compatibility\n * via a custom trace provider.\n * This ensures that any spans emitted via `@opentelemetry/api` will be captured by Sentry.\n * HOWEVER, big caveat: This does not handle custom context handling, it will always work off the current scope.\n * This should be good enough for many, but not all integrations.\n *\n * If you want to opt-out of setting up the OpenTelemetry compatibility tracer, set this to `true`.\n *\n * @default false\n */\n skipOpenTelemetrySetup?: boolean;\n\n /**\n * Enable trace propagation for RPC calls between Workers, Durable Objects, and Service Bindings.\n *\n * When enabled, trace context (sentry-trace + baggage) is propagated across:\n * - `stub.fetch()` calls to Durable Objects (via HTTP headers)\n * - Service binding `fetch()` calls (via HTTP headers)\n * - RPC method calls to Durable Objects (via trailing argument)\n *\n * When enabled on the **receiver side** (DurableObject), the SDK will also:\n * - Extract and continue traces from incoming RPC calls\n * - Create spans for each RPC method invocation\n * - Capture errors thrown by RPC methods\n *\n * **Important:** This option should be enabled on **both sides** for full trace propagation.\n *\n * @default false\n * @example\n * ```ts\n * // Worker side (caller)\n * export default Sentry.withSentry(\n * (env) => ({\n * dsn: env.SENTRY_DSN,\n * enableRpcTracePropagation: true,\n * }),\n * handler,\n * );\n *\n * // Durable Object side (receiver)\n * export const MyDO = Sentry.instrumentDurableObjectWithSentry(\n * (env) => ({\n * dsn: env.SENTRY_DSN,\n * enableRpcTracePropagation: true,\n * }),\n * MyDOBase,\n * );\n * ```\n */\n enableRpcTracePropagation?: boolean;\n\n /**\n * @deprecated Use `enableRpcTracePropagation` instead. This option will be removed in a future major version.\n *\n * Enable instrumentation of prototype methods for DurableObjects.\n *\n * When `true`, the SDK will wrap all methods on the DurableObject prototype chain\n * to automatically create spans and capture errors for RPC method calls.\n *\n * When an array of strings is provided, only the specified method names will be instrumented.\n *\n * @default false\n */\n instrumentPrototypeMethods?: boolean | string[];\n}\n\n/**\n * Configuration options for the Sentry Cloudflare SDK\n *\n * @see @sentry/core Options for more information.\n */\nexport interface CloudflareOptions extends Options<CloudflareTransportOptions>, BaseCloudflareOptions {\n ctx?: ExecutionContext;\n}\n\n/**\n * Configuration options for the Sentry Cloudflare SDK Client class\n *\n * @see CloudflareClient for more information.\n */\nexport interface CloudflareClientOptions extends ClientOptions<CloudflareTransportOptions>, BaseCloudflareOptions {\n flushLock?: ReturnType<typeof makeFlushLock>;\n}\n"],"names":[],"mappings":";;;AAMA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,gBAAA,SAAyB,mBAAA,CAAoB;;AAE1D,kBAAU,aAAa,GAAgB,IAAI,GAAG,GAAC;AAC/C,GAAE,OAAA,GAAA,CAAA,IAAA,CAAQ,sBAAsB,GAAyB,KAAA;AACzD,GAAE,OAAA,GAAA,CAAA,IAAA,CAAQ,sBAAsB,GAAwB,KAAA;;AAExD,GAAE,OAAA,GAAA,CAAA,IAAA,CAAQ,qBAAqB,GAAwB,KAAA;AACvD,GAAE,OAAA,GAAA,CAAA,IAAA,CAAQ,mBAAmB,GAAwB,KAAA;;AAErD;AACA;AACA;AACA;AACA,GAAS,WAAW,CAAC,OAAO,EAA2B;AACvD,IAAI,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC;AAC3C,IAAI,OAAO,CAAC,SAAA,GAAY,OAAO,CAAC,SAAA,IAAa,EAAE;AAC/C,IAAI,MAAM,EAAE,SAAS,EAAE,GAAG,aAAA,EAAc,GAAI,OAAO;;AAEnD,IAAI,MAAM,aAAa,GAA+B;AACtD,MAAM,GAAG,aAAa;AACtB,MAAM,QAAQ,EAAE,YAAY;AAC5B;AACA,MAAM,OAAO,EAAE,EAAE,IAAI,EAAE,cAAc;AACrC;AACA,KAAK;;AAEL,IAAI,KAAK,CAAC,aAAa,CAAA,CAAA,gBAAA,CAAA,SAAA,CAAA,MAAA,CAAA,IAAA,CAAA,IAAA,CAAA,CAAA,gBAAA,CAAA,SAAA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EAAE;;AAEnB,IAAI,IAAI,IAAI,CAAC,qBAAqB,EAAE;AACpC,MAAM,IAAI,CAAC,qBAAqB,EAAE;AAClC,MAAM,IAAI,CAAC,qBAAA,GAAwB,IAAI;AACvC,IAAI;AACJ,IAAI,IAAI,IAAI,CAAC,mBAAmB,EAAE;AAClC,MAAM,IAAI,CAAC,mBAAmB,EAAE;AAChC,MAAM,IAAI,CAAC,mBAAA,GAAsB,IAAI;AACrC,IAAI;;AAEJ,IAAI,IAAI,CAAC,2BAA2B,EAAE;AACtC,IAAI,CAAC,IAAA,GAA4E,UAAA,GAAa,SAAS;AACvG,EAAE;;AAEF;AACA;AACA;AACA,GAAU,2BAA2B,GAAS;AAC9C,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;AAC9B,IAAI,IAAI,CAAC,sBAAA,GAAyB,IAAI;AACtC,IAAI,IAAI,CAAC,sBAAA,GAAyB,IAAI;AACtC,EAAE;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"client.js","sources":["../../src/client.ts"],"sourcesContent":["import type { ClientOptions, Options, ServerRuntimeClientOptions } from '@sentry/core';\nimport { applySdkMetadata, debug, ServerRuntimeClient } from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build';\nimport type { makeFlushLock } from './flush';\nimport type { CloudflareTransportOptions } from './transport';\n\n/**\n * The Sentry Cloudflare SDK Client.\n *\n * @see CloudflareClientOptions for documentation on configuration options.\n * @see ServerRuntimeClient for usage documentation.\n */\nexport class CloudflareClient extends ServerRuntimeClient {\n private readonly _flushLock: ReturnType<typeof makeFlushLock> | void;\n private _pendingSpans: Set<string> = new Set();\n private _spanCompletionPromise: Promise<void> | null = null;\n private _resolveSpanCompletion: (() => void) | null = null;\n\n private _unsubscribeSpanStart: (() => void) | null = null;\n private _unsubscribeSpanEnd: (() => void) | null = null;\n\n /**\n * Creates a new Cloudflare SDK instance.\n * @param options Configuration options for this SDK.\n */\n public constructor(options: CloudflareClientOptions) {\n applySdkMetadata(options, 'cloudflare');\n options._metadata = options._metadata || {};\n const { flushLock, ...serverOptions } = options;\n\n const clientOptions: ServerRuntimeClientOptions = {\n ...serverOptions,\n platform: 'javascript',\n // TODO: Grab version information\n runtime: { name: 'cloudflare' },\n // TODO: Add server name\n _flushInterval: 0,\n };\n\n super(clientOptions);\n this._flushLock = flushLock;\n\n // Track span lifecycle to know when to flush\n this._unsubscribeSpanStart = this.on('spanStart', span => {\n const spanId = span.spanContext().spanId;\n DEBUG_BUILD && debug.log('[CloudflareClient] Span started:', spanId);\n this._pendingSpans.add(spanId);\n\n if (!this._spanCompletionPromise) {\n this._spanCompletionPromise = new Promise(resolve => {\n this._resolveSpanCompletion = resolve;\n });\n }\n });\n\n this._unsubscribeSpanEnd = this.on('spanEnd', span => {\n const spanId = span.spanContext().spanId;\n DEBUG_BUILD && debug.log('[CloudflareClient] Span ended:', spanId);\n this._pendingSpans.delete(spanId);\n\n // If no more pending spans, resolve the completion promise\n if (this._pendingSpans.size === 0 && this._resolveSpanCompletion) {\n DEBUG_BUILD && debug.log('[CloudflareClient] All spans completed, resolving promise');\n this._resolveSpanCompletion();\n this._resetSpanCompletionPromise();\n }\n });\n }\n\n /**\n * Flushes pending operations and ensures all data is processed.\n * If a timeout is provided, the operation will be completed within the specified time limit.\n *\n * It will wait for all pending spans to complete before flushing.\n *\n * @param {number} [timeout] - Optional timeout in milliseconds to force the completion of the flush operation.\n * @return {Promise<boolean>} A promise that resolves to a boolean indicating whether the flush operation was successful.\n */\n public async flush(timeout?: number): Promise<boolean> {\n if (this._flushLock) {\n await this._flushLock.finalize();\n }\n\n if (this._pendingSpans.size > 0 && this._spanCompletionPromise) {\n DEBUG_BUILD &&\n debug.log('[CloudflareClient] Waiting for', this._pendingSpans.size, 'pending spans to complete...');\n\n const timeoutMs = timeout ?? 5000;\n const spanCompletionRace = Promise.race([\n this._spanCompletionPromise,\n new Promise(resolve =>\n setTimeout(() => {\n DEBUG_BUILD &&\n debug.log('[CloudflareClient] Span completion timeout after', timeoutMs, 'ms, flushing anyway');\n resolve(undefined);\n }, timeoutMs),\n ),\n ]);\n\n await spanCompletionRace;\n }\n\n return super.flush(timeout);\n }\n\n /**\n * Disposes of the client and releases all resources.\n *\n * This method clears all Cloudflare-specific state in addition to the base client cleanup.\n * It unsubscribes from span lifecycle events and clears pending span tracking.\n *\n * Call this method after flushing to allow the client to be garbage collected.\n * After calling dispose(), the client should not be used anymore.\n */\n public override dispose(): void {\n DEBUG_BUILD && debug.log('[CloudflareClient] Disposing client...');\n\n super.dispose();\n\n if (this._unsubscribeSpanStart) {\n this._unsubscribeSpanStart();\n this._unsubscribeSpanStart = null;\n }\n if (this._unsubscribeSpanEnd) {\n this._unsubscribeSpanEnd();\n this._unsubscribeSpanEnd = null;\n }\n\n this._resetSpanCompletionPromise();\n (this as unknown as { _flushLock: ReturnType<typeof makeFlushLock> | void })._flushLock = undefined;\n }\n\n /**\n * Resets the span completion promise and resolve function.\n */\n private _resetSpanCompletionPromise(): void {\n this._pendingSpans.clear();\n this._spanCompletionPromise = null;\n this._resolveSpanCompletion = null;\n }\n}\n\ninterface BaseCloudflareOptions {\n /**\n * @ignore Used internally to disable the deDupeIntegration for workflows.\n * @hidden Used internally to disable the deDupeIntegration for workflows.\n * @default true\n */\n enableDedupe?: boolean;\n\n /**\n * The Cloudflare SDK is not OpenTelemetry native, however, we set up some OpenTelemetry compatibility\n * via a custom trace provider.\n * This ensures that any spans emitted via `@opentelemetry/api` will be captured by Sentry.\n * HOWEVER, big caveat: This does not handle custom context handling, it will always work off the current scope.\n * This should be good enough for many, but not all integrations.\n *\n * If you want to opt-out of setting up the OpenTelemetry compatibility tracer, set this to `true`.\n *\n * @default false\n */\n skipOpenTelemetrySetup?: boolean;\n\n /**\n * Enable trace propagation for RPC calls between Workers, Durable Objects, and Service Bindings.\n *\n * When enabled, trace context (sentry-trace + baggage) is propagated across:\n * - `stub.fetch()` calls to Durable Objects (via HTTP headers)\n * - Service binding `fetch()` calls (via HTTP headers)\n * - RPC method calls to Durable Objects (via trailing argument)\n *\n * When enabled on the **receiver side** (DurableObject), the SDK will also:\n * - Extract and continue traces from incoming RPC calls\n * - Create spans for each RPC method invocation\n * - Capture errors thrown by RPC methods\n *\n * **Important:** This option should be enabled on **both sides** for full trace propagation.\n *\n * @default false\n * @example\n * ```ts\n * // Worker side (caller)\n * export default Sentry.withSentry(\n * (env) => ({\n * dsn: env.SENTRY_DSN,\n * enableRpcTracePropagation: true,\n * }),\n * handler,\n * );\n *\n * // Durable Object side (receiver)\n * export const MyDO = Sentry.instrumentDurableObjectWithSentry(\n * (env) => ({\n * dsn: env.SENTRY_DSN,\n * enableRpcTracePropagation: true,\n * }),\n * MyDOBase,\n * );\n * ```\n */\n enableRpcTracePropagation?: boolean;\n\n /**\n * @deprecated Use `enableRpcTracePropagation` instead. This option will be removed in a future major version.\n *\n * Enable instrumentation of prototype methods for DurableObjects.\n *\n * When `true`, the SDK will wrap all methods on the DurableObject prototype chain\n * to automatically create spans and capture errors for RPC method calls.\n *\n * When an array of strings is provided, only the specified method names will be instrumented.\n *\n * @default false\n */\n instrumentPrototypeMethods?: boolean | string[];\n}\n\n/**\n * Configuration options for the Sentry Cloudflare SDK\n *\n * @see @sentry/core Options for more information.\n */\nexport interface CloudflareOptions extends Options<CloudflareTransportOptions>, BaseCloudflareOptions {\n ctx?: ExecutionContext;\n}\n\n/**\n * Configuration options for the Sentry Cloudflare SDK Client class\n *\n * @see CloudflareClient for more information.\n */\nexport interface CloudflareClientOptions extends ClientOptions<CloudflareTransportOptions>, BaseCloudflareOptions {\n flushLock?: ReturnType<typeof makeFlushLock>;\n}\n"],"names":[],"mappings":";;;AAYO,MAAM,yBAAyB,mBAAA,CAAoB;AAAA;AAAA;AAAA;AAAA;AAAA,EAajD,YAAY,OAAA,EAAkC;AACnD,IAAA,gBAAA,CAAiB,SAAS,YAAY,CAAA;AACtC,IAAA,OAAA,CAAQ,SAAA,GAAY,OAAA,CAAQ,SAAA,IAAa,EAAC;AAC1C,IAA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5B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWgB,OAAA,GAAgB;AAC9B,IAAA,WAAA,IAAe,KAAA,CAAM,IAAI,wCAAwC,CAAA;AAEjE,IAAA,KAAA,CAAM,OAAA,EAAQ;AAEd,IAAA,IAAI,KAAK,qBAAA,EAAuB;AAC9B,MAAA,IAAA,CAAK,qBAAA,EAAsB;AAC3B,MAAA,IAAA,CAAK,qBAAA,GAAwB,IAAA;AAAA,IAC/B;AACA,IAAA,IAAI,KAAK,mBAAA,EAAqB;AAC5B,MAAA,IAAA,CAAK,mBAAA,EAAoB;AACzB,MAAA,IAAA,CAAK,mBAAA,GAAsB,IAAA;AAAA,IAC7B;AAEA,IAAA,IAAA,CAAK,2BAAA,EAA4B;AACjC,IAAC,KAA4E,UAAA,GAAa,MAAA;AAAA,EAC5F;AAAA;AAAA;AAAA;AAAA,EAKQ,2BAAA,GAAoC;AAC1C,IAAA,IAAA,CAAK,cAAc,KAAA,EAAM;AACzB,IAAA,IAAA,CAAK,sBAAA,GAAyB,IAAA;AAC9B,IAAA,IAAA,CAAK,sBAAA,GAAyB,IAAA;AAAA,EAChC;AACF;;;;"}
|
package/build/esm/d1.js
CHANGED
|
@@ -1,153 +1,99 @@
|
|
|
1
1
|
import { startSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, addBreadcrumb, SPAN_STATUS_ERROR } from '@sentry/core';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
// https://github.com/cloudflare/workerd/blob/cd5279e7b305003f1d9c851e73efa9d67e4b68b2/src/cloudflare/internal/d1-api.ts
|
|
5
|
-
|
|
6
|
-
const patchedStatement = new WeakSet();
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Patches the query methods of a Cloudflare D1 prepared statement with Sentry.
|
|
10
|
-
*/
|
|
3
|
+
const patchedStatement = /* @__PURE__ */ new WeakSet();
|
|
11
4
|
function instrumentD1PreparedStatementQueries(statement, query) {
|
|
12
5
|
if (patchedStatement.has(statement)) {
|
|
13
6
|
return statement;
|
|
14
7
|
}
|
|
15
|
-
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
17
8
|
statement.first = new Proxy(statement.first, {
|
|
18
9
|
apply(target, thisArg, args) {
|
|
19
|
-
return startSpan(createStartSpanOptions(query,
|
|
10
|
+
return startSpan(createStartSpanOptions(query, "first"), async () => {
|
|
20
11
|
const res = await Reflect.apply(target, thisArg, args);
|
|
21
|
-
createD1Breadcrumb(query,
|
|
12
|
+
createD1Breadcrumb(query, "first");
|
|
22
13
|
return res;
|
|
23
14
|
});
|
|
24
|
-
}
|
|
15
|
+
}
|
|
25
16
|
});
|
|
26
|
-
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
28
17
|
statement.run = new Proxy(statement.run, {
|
|
29
18
|
apply(target, thisArg, args) {
|
|
30
|
-
return startSpan(createStartSpanOptions(query,
|
|
19
|
+
return startSpan(createStartSpanOptions(query, "run"), async (span) => {
|
|
31
20
|
const d1Response = await Reflect.apply(target, thisArg, args);
|
|
32
21
|
applyD1ReturnObjectToSpan(span, d1Response);
|
|
33
|
-
createD1Breadcrumb(query,
|
|
22
|
+
createD1Breadcrumb(query, "run", d1Response);
|
|
34
23
|
return d1Response;
|
|
35
24
|
});
|
|
36
|
-
}
|
|
25
|
+
}
|
|
37
26
|
});
|
|
38
|
-
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
40
27
|
statement.all = new Proxy(statement.all, {
|
|
41
28
|
apply(target, thisArg, args) {
|
|
42
|
-
return startSpan(createStartSpanOptions(query,
|
|
29
|
+
return startSpan(createStartSpanOptions(query, "all"), async (span) => {
|
|
43
30
|
const d1Result = await Reflect.apply(target, thisArg, args);
|
|
44
31
|
applyD1ReturnObjectToSpan(span, d1Result);
|
|
45
|
-
createD1Breadcrumb(query,
|
|
32
|
+
createD1Breadcrumb(query, "all", d1Result);
|
|
46
33
|
return d1Result;
|
|
47
34
|
});
|
|
48
|
-
}
|
|
35
|
+
}
|
|
49
36
|
});
|
|
50
|
-
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
52
37
|
statement.raw = new Proxy(statement.raw, {
|
|
53
38
|
apply(target, thisArg, args) {
|
|
54
|
-
return startSpan(createStartSpanOptions(query,
|
|
39
|
+
return startSpan(createStartSpanOptions(query, "raw"), async () => {
|
|
55
40
|
const res = await Reflect.apply(target, thisArg, args);
|
|
56
|
-
createD1Breadcrumb(query,
|
|
41
|
+
createD1Breadcrumb(query, "raw");
|
|
57
42
|
return res;
|
|
58
43
|
});
|
|
59
|
-
}
|
|
44
|
+
}
|
|
60
45
|
});
|
|
61
|
-
|
|
62
46
|
patchedStatement.add(statement);
|
|
63
|
-
|
|
64
47
|
return statement;
|
|
65
48
|
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Instruments a Cloudflare D1 prepared statement with Sentry.
|
|
69
|
-
*
|
|
70
|
-
* This is meant to be used as a top-level call, under the hood it calls `instrumentD1PreparedStatementQueries`
|
|
71
|
-
* to patch the query methods. The reason for this abstraction is to ensure that the `bind` method is also patched.
|
|
72
|
-
*/
|
|
73
49
|
function instrumentD1PreparedStatement(statement, query) {
|
|
74
|
-
// statement.bind() returns a new instance of D1PreparedStatement, so we have to patch it as well.
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
76
50
|
statement.bind = new Proxy(statement.bind, {
|
|
77
51
|
apply(target, thisArg, args) {
|
|
78
52
|
return instrumentD1PreparedStatementQueries(Reflect.apply(target, thisArg, args), query);
|
|
79
|
-
}
|
|
53
|
+
}
|
|
80
54
|
});
|
|
81
|
-
|
|
82
55
|
return instrumentD1PreparedStatementQueries(statement, query);
|
|
83
56
|
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Add D1Response meta information to a span.
|
|
87
|
-
*
|
|
88
|
-
* See: https://developers.cloudflare.com/d1/build-with-d1/d1-client-api/#return-object
|
|
89
|
-
*/
|
|
90
57
|
function applyD1ReturnObjectToSpan(span, d1Result) {
|
|
91
58
|
if (!d1Result.success) {
|
|
92
59
|
span.setStatus({ code: SPAN_STATUS_ERROR });
|
|
93
60
|
}
|
|
94
|
-
|
|
95
61
|
span.setAttributes(getAttributesFromD1Response(d1Result));
|
|
96
62
|
}
|
|
97
|
-
|
|
98
63
|
function getAttributesFromD1Response(d1Result) {
|
|
99
64
|
return {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
65
|
+
"cloudflare.d1.duration": d1Result.meta.duration,
|
|
66
|
+
"cloudflare.d1.rows_read": d1Result.meta.rows_read,
|
|
67
|
+
"cloudflare.d1.rows_written": d1Result.meta.rows_written
|
|
103
68
|
};
|
|
104
69
|
}
|
|
105
|
-
|
|
106
70
|
function createD1Breadcrumb(query, type, d1Result) {
|
|
107
71
|
addBreadcrumb({
|
|
108
|
-
category:
|
|
72
|
+
category: "query",
|
|
109
73
|
message: query,
|
|
110
74
|
data: {
|
|
111
|
-
...
|
|
112
|
-
|
|
113
|
-
}
|
|
75
|
+
...d1Result ? getAttributesFromD1Response(d1Result) : {},
|
|
76
|
+
"cloudflare.d1.query_type": type
|
|
77
|
+
}
|
|
114
78
|
});
|
|
115
79
|
}
|
|
116
|
-
|
|
117
80
|
function createStartSpanOptions(query, type) {
|
|
118
81
|
return {
|
|
119
|
-
op:
|
|
82
|
+
op: "db.query",
|
|
120
83
|
name: query,
|
|
121
84
|
attributes: {
|
|
122
|
-
|
|
123
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:
|
|
124
|
-
}
|
|
85
|
+
"cloudflare.d1.query_type": type,
|
|
86
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.db.cloudflare.d1"
|
|
87
|
+
}
|
|
125
88
|
};
|
|
126
89
|
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Instruments Cloudflare D1 bindings with Sentry.
|
|
130
|
-
*
|
|
131
|
-
* Currently, only prepared statements are instrumented. `db.exec` and `db.batch` are not instrumented.
|
|
132
|
-
*
|
|
133
|
-
* @example
|
|
134
|
-
*
|
|
135
|
-
* ```js
|
|
136
|
-
* // env.DB is the D1 DB binding configured in your `wrangler.toml`
|
|
137
|
-
* const db = instrumentD1WithSentry(env.DB);
|
|
138
|
-
* // Now you can use the database as usual
|
|
139
|
-
* await db.prepare('SELECT * FROM table WHERE id = ?').bind(1).run();
|
|
140
|
-
* ```
|
|
141
|
-
*/
|
|
142
90
|
function instrumentD1WithSentry(db) {
|
|
143
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
144
91
|
db.prepare = new Proxy(db.prepare, {
|
|
145
92
|
apply(target, thisArg, args) {
|
|
146
93
|
const [query] = args;
|
|
147
94
|
return instrumentD1PreparedStatement(Reflect.apply(target, thisArg, args), query);
|
|
148
|
-
}
|
|
95
|
+
}
|
|
149
96
|
});
|
|
150
|
-
|
|
151
97
|
return db;
|
|
152
98
|
}
|
|
153
99
|
|
package/build/esm/d1.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d1.js","sources":["../../src/d1.ts"],"sourcesContent":["import type { D1Database, D1PreparedStatement, D1Response } from '@cloudflare/workers-types';\nimport type { Span, SpanAttributes, StartSpanOptions } from '@sentry/core';\nimport { addBreadcrumb, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startSpan } from '@sentry/core';\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":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"d1.js","sources":["../../src/d1.ts"],"sourcesContent":["import type { D1Database, D1PreparedStatement, D1Response } from '@cloudflare/workers-types';\nimport type { Span, SpanAttributes, StartSpanOptions } from '@sentry/core';\nimport { addBreadcrumb, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startSpan } from '@sentry/core';\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":[],"mappings":";;AAOA,MAAM,gBAAA,uBAAuB,OAAA,EAA6B;AAK1D,SAAS,oCAAA,CAAqC,WAAgC,KAAA,EAAoC;AAChH,EAAA,IAAI,gBAAA,CAAiB,GAAA,CAAI,SAAS,CAAA,EAAG;AACnC,IAAA,OAAO,SAAA;AAAA,EACT;AAGA,EAAA,SAAA,CAAU,KAAA,GAAQ,IAAI,KAAA,CAAM,SAAA,CAAU,KAAA,EAAO;AAAA,IAC3C,KAAA,CAAM,MAAA,EAAQ,OAAA,EAAS,IAAA,EAA0C;AAC/D,MAAA,OAAO,SAAA,CAAU,sBAAA,CAAuB,KAAA,EAAO,OAAO,GAAG,YAAY;AACnE,QAAA,MAAM,MAAM,MAAM,OAAA,CAAQ,KAAA,CAAM,MAAA,EAAQ,SAAS,IAAI,CAAA;AACrD,QAAA,kBAAA,CAAmB,OAAO,OAAO,CAAA;AACjC,QAAA,OAAO,GAAA;AAAA,MACT,CAAC,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AA,EAAU,OAAA;AAAA,IACV,OAAA,EAAS,KAAA;AAAA,IACT,IAAA,EAAM;AAAA,MACJ,GAAI,QAAA,GAAW,2BAAA,CAA4B,QAAQ,IAAI,EAAC;AAAA,MACxD,0BAAA,EAA4B;AAAA;AAC9B,GACD,CAAA;AACH;AAEA,SAAS,sBAAA,CAAuB,OAAe,IAAA,EAAyD;AACtG,EAAA,OAAO;AAAA,IACL,EAAA,EAAI,UAAA;AAAA,IACJ,IAAA,EAAM,KAAA;AAAA,IACN,UAAA,EAAY;AAAA,MACV,0BAAA,EAA4B,IAAA;AAAA,MAC5B,CAAC,gCAAgC,GAAG;AAAA;AACtC,GACF;AACF;AAgBO,SAAS,uBAAuB,EAAA,EAA4B;AAEjE,EAAA,EAAA,CAAG,OAAA,GAAU,IAAI,KAAA,CAAM,EAAA,CAAG,OAAA,EAAS;AAAA,IACjC,KAAA,CAAM,MAAA,EAAQ,OAAA,EAAS,IAAA,EAAqC;AAC1D,MAAA,MAAM,CAAC,KAAK,CAAA,GAAI,IAAA;AAChB,MAAA,OAAO,8BAA8B,OAAA,CAAQ,KAAA,CAAM,QAAQ,OAAA,EAAS,IAAI,GAAG,KAAK,CAAA;AAAA,IAClF;AAAA,GACD,CAAA;AAED,EAAA,OAAO,EAAA;AACT;;;;"}
|
package/build/esm/debug-build.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
|
|
3
|
-
*
|
|
4
|
-
* ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
|
|
5
|
-
*/
|
|
6
1
|
const DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
|
|
7
2
|
|
|
8
3
|
export { DEBUG_BUILD };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-build.js","sources":["../../src/debug-build.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"debug-build.js","sources":["../../src/debug-build.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n"],"names":[],"mappings":"AAOO,MAAM,WAAA,IAAc,OAAA,gBAAA,KAAA,WAAA,IAAA,gBAAA;;;;"}
|