@sentry/cloudflare 10.40.0 → 10.41.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/client.js +33 -3
- package/build/cjs/client.js.map +1 -1
- package/build/cjs/flush.js +16 -0
- package/build/cjs/flush.js.map +1 -1
- package/build/cjs/handler.js +5 -4
- package/build/cjs/handler.js.map +1 -1
- package/build/cjs/index.js +1 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/request.js +14 -5
- package/build/cjs/request.js.map +1 -1
- package/build/cjs/workflows.js +2 -1
- package/build/cjs/workflows.js.map +1 -1
- package/build/cjs/wrapMethodWithSentry.js +11 -8
- package/build/cjs/wrapMethodWithSentry.js.map +1 -1
- package/build/esm/client.js +33 -3
- package/build/esm/client.js.map +1 -1
- package/build/esm/flush.js +16 -1
- package/build/esm/flush.js.map +1 -1
- package/build/esm/handler.js +6 -5
- package/build/esm/handler.js.map +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/request.js +15 -6
- package/build/esm/request.js.map +1 -1
- package/build/esm/workflows.js +3 -2
- package/build/esm/workflows.js.map +1 -1
- package/build/esm/wrapMethodWithSentry.js +12 -9
- package/build/esm/wrapMethodWithSentry.js.map +1 -1
- package/build/types/client.d.ts +12 -0
- package/build/types/client.d.ts.map +1 -1
- package/build/types/flush.d.ts +10 -0
- package/build/types/flush.d.ts.map +1 -1
- package/build/types/handler.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/request.d.ts.map +1 -1
- package/build/types/workflows.d.ts.map +1 -1
- package/build/types/wrapMethodWithSentry.d.ts.map +1 -1
- package/build/types-ts3.8/client.d.ts +12 -0
- package/build/types-ts3.8/flush.d.ts +10 -0
- package/build/types-ts3.8/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { getClient, withScope, withIsolationScope, isThenable,
|
|
1
|
+
import { getClient, withScope, withIsolationScope, isThenable, captureException, SEMANTIC_ATTRIBUTE_SENTRY_OP, startSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
2
|
+
import { flushAndDispose } from './flush.js';
|
|
2
3
|
import { isInstrumented, markAsInstrumented } from './instrument.js';
|
|
3
4
|
import { init } from './sdk.js';
|
|
4
5
|
|
|
@@ -47,6 +48,8 @@ function wrapMethodWithSentry(
|
|
|
47
48
|
scope.setClient(client);
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
const clientToDispose = currentClient || scope.getClient();
|
|
52
|
+
|
|
50
53
|
if (!wrapperOptions.spanName) {
|
|
51
54
|
try {
|
|
52
55
|
if (callback) {
|
|
@@ -57,7 +60,7 @@ function wrapMethodWithSentry(
|
|
|
57
60
|
if (isThenable(result)) {
|
|
58
61
|
return result.then(
|
|
59
62
|
(res) => {
|
|
60
|
-
waitUntil?.(
|
|
63
|
+
waitUntil?.(flushAndDispose(clientToDispose));
|
|
61
64
|
return res;
|
|
62
65
|
},
|
|
63
66
|
(e) => {
|
|
@@ -67,12 +70,12 @@ function wrapMethodWithSentry(
|
|
|
67
70
|
handled: false,
|
|
68
71
|
},
|
|
69
72
|
});
|
|
70
|
-
waitUntil?.(
|
|
73
|
+
waitUntil?.(flushAndDispose(clientToDispose));
|
|
71
74
|
throw e;
|
|
72
75
|
},
|
|
73
76
|
);
|
|
74
77
|
} else {
|
|
75
|
-
waitUntil?.(
|
|
78
|
+
waitUntil?.(flushAndDispose(clientToDispose));
|
|
76
79
|
return result;
|
|
77
80
|
}
|
|
78
81
|
} catch (e) {
|
|
@@ -82,7 +85,7 @@ function wrapMethodWithSentry(
|
|
|
82
85
|
handled: false,
|
|
83
86
|
},
|
|
84
87
|
});
|
|
85
|
-
waitUntil?.(
|
|
88
|
+
waitUntil?.(flushAndDispose(clientToDispose));
|
|
86
89
|
throw e;
|
|
87
90
|
}
|
|
88
91
|
}
|
|
@@ -101,7 +104,7 @@ function wrapMethodWithSentry(
|
|
|
101
104
|
if (isThenable(result)) {
|
|
102
105
|
return result.then(
|
|
103
106
|
(res) => {
|
|
104
|
-
waitUntil?.(
|
|
107
|
+
waitUntil?.(flushAndDispose(clientToDispose));
|
|
105
108
|
return res;
|
|
106
109
|
},
|
|
107
110
|
(e) => {
|
|
@@ -111,12 +114,12 @@ function wrapMethodWithSentry(
|
|
|
111
114
|
handled: false,
|
|
112
115
|
},
|
|
113
116
|
});
|
|
114
|
-
waitUntil?.(
|
|
117
|
+
waitUntil?.(flushAndDispose(clientToDispose));
|
|
115
118
|
throw e;
|
|
116
119
|
},
|
|
117
120
|
);
|
|
118
121
|
} else {
|
|
119
|
-
waitUntil?.(
|
|
122
|
+
waitUntil?.(flushAndDispose(clientToDispose));
|
|
120
123
|
return result;
|
|
121
124
|
}
|
|
122
125
|
} catch (e) {
|
|
@@ -126,7 +129,7 @@ function wrapMethodWithSentry(
|
|
|
126
129
|
handled: false,
|
|
127
130
|
},
|
|
128
131
|
});
|
|
129
|
-
waitUntil?.(
|
|
132
|
+
waitUntil?.(flushAndDispose(clientToDispose));
|
|
130
133
|
throw e;
|
|
131
134
|
}
|
|
132
135
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapMethodWithSentry.js","sources":["../../src/wrapMethodWithSentry.ts"],"sourcesContent":["import type { DurableObjectStorage } from '@cloudflare/workers-types';\nimport {\n captureException,\n
|
|
1
|
+
{"version":3,"file":"wrapMethodWithSentry.js","sources":["../../src/wrapMethodWithSentry.ts"],"sourcesContent":["import type { DurableObjectStorage } from '@cloudflare/workers-types';\nimport {\n captureException,\n getClient,\n isThenable,\n type Scope,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n startSpan,\n withIsolationScope,\n withScope,\n} from '@sentry/core';\nimport type { CloudflareOptions } from './client';\nimport { flushAndDispose } from './flush';\nimport { isInstrumented, markAsInstrumented } from './instrument';\nimport { init } from './sdk';\n\n/** Extended DurableObjectState with originalStorage exposed by instrumentContext */\ninterface InstrumentedDurableObjectState extends DurableObjectState {\n originalStorage?: DurableObjectStorage;\n}\n\ntype MethodWrapperOptions = {\n spanName?: string;\n spanOp?: string;\n options: CloudflareOptions;\n context: ExecutionContext | DurableObjectState;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type UncheckedMethod = (...args: any[]) => any;\ntype OriginalMethod = UncheckedMethod;\n\n/**\n * Wraps a method with Sentry tracing.\n *\n * @param wrapperOptions - The options for the wrapper.\n * @param handler - The method to wrap.\n * @param callback - The callback to call.\n * @param noMark - Whether to mark the method as instrumented.\n * @returns The wrapped method.\n */\nexport function wrapMethodWithSentry<T extends OriginalMethod>(\n wrapperOptions: MethodWrapperOptions,\n handler: T,\n callback?: (...args: Parameters<T>) => void,\n noMark?: true,\n): T {\n if (isInstrumented(handler)) {\n return handler;\n }\n\n if (!noMark) {\n markAsInstrumented(handler);\n }\n\n return new Proxy(handler, {\n apply(target, thisArg, args: Parameters<T>) {\n const currentClient = getClient();\n // if a client is already set, use withScope, otherwise use withIsolationScope\n const sentryWithScope = currentClient ? withScope : withIsolationScope;\n\n const wrappedFunction = (scope: Scope): unknown => {\n // In certain situations, the passed context can become undefined.\n // For example, for Astro while prerendering pages at build time.\n // see: https://github.com/getsentry/sentry-javascript/issues/13217\n const context = wrapperOptions.context as InstrumentedDurableObjectState | undefined;\n\n const waitUntil = context?.waitUntil?.bind?.(context);\n\n const currentClient = scope.getClient();\n if (!currentClient) {\n const client = init({ ...wrapperOptions.options, ctx: context as unknown as ExecutionContext | undefined });\n scope.setClient(client);\n }\n\n const clientToDispose = currentClient || scope.getClient();\n\n if (!wrapperOptions.spanName) {\n try {\n if (callback) {\n callback(...args);\n }\n const result = Reflect.apply(target, thisArg, args);\n\n if (isThenable(result)) {\n return result.then(\n (res: unknown) => {\n waitUntil?.(flushAndDispose(clientToDispose));\n return res;\n },\n (e: unknown) => {\n captureException(e, {\n mechanism: {\n type: 'auto.faas.cloudflare.durable_object',\n handled: false,\n },\n });\n waitUntil?.(flushAndDispose(clientToDispose));\n throw e;\n },\n );\n } else {\n waitUntil?.(flushAndDispose(clientToDispose));\n return result;\n }\n } catch (e) {\n captureException(e, {\n mechanism: {\n type: 'auto.faas.cloudflare.durable_object',\n handled: false,\n },\n });\n waitUntil?.(flushAndDispose(clientToDispose));\n throw e;\n }\n }\n\n const attributes = wrapperOptions.spanOp\n ? {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: wrapperOptions.spanOp,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.durable_object',\n }\n : {};\n\n return startSpan({ name: wrapperOptions.spanName, attributes }, () => {\n try {\n const result = Reflect.apply(target, thisArg, args);\n\n if (isThenable(result)) {\n return result.then(\n (res: unknown) => {\n waitUntil?.(flushAndDispose(clientToDispose));\n return res;\n },\n (e: unknown) => {\n captureException(e, {\n mechanism: {\n type: 'auto.faas.cloudflare.durable_object',\n handled: false,\n },\n });\n waitUntil?.(flushAndDispose(clientToDispose));\n throw e;\n },\n );\n } else {\n waitUntil?.(flushAndDispose(clientToDispose));\n return result;\n }\n } catch (e) {\n captureException(e, {\n mechanism: {\n type: 'auto.faas.cloudflare.durable_object',\n handled: false,\n },\n });\n waitUntil?.(flushAndDispose(clientToDispose));\n throw e;\n }\n });\n };\n\n return sentryWithScope(wrappedFunction);\n },\n });\n}\n"],"names":[],"mappings":";;;;;AAiBA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,oBAAoB;AACpC,EAAE,cAAc;AAChB,EAAE,OAAO;AACT,EAAE,QAAQ;AACV,EAAE,MAAM;AACR,EAAK;AACL,EAAE,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE;AAC/B,IAAI,OAAO,OAAO;AAClB,EAAE;;AAEF,EAAE,IAAI,CAAC,MAAM,EAAE;AACf,IAAI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I;AAChC,gBAAgB,CAAC,GAAG,KAAc;AAClC,kBAAkB,SAAS,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC;AAC/D,kBAAkB,OAAO,GAAG;AAC5B,gBAAgB,CAAC;AACjB,gBAAgB,CAAC,CAAC,KAAc;AAChC,kBAAkB,gBAAgB,CAAC,CAAC,EAAE;AACtC,oBAAoB,SAAS,EAAE;AAC/B,sBAAsB,IAAI,EAAE,qCAAqC;AACjE,sBAAsB,OAAO,EAAE,KAAK;AACpC,qBAAqB;AACrB,mBAAmB,CAAC;AACpB,kBAAkB,SAAS,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC;AAC/D,kBAAkB,MAAM,CAAC;AACzB,gBAAgB,CAAC;AACjB,eAAe;AACf,YAAY,OAAO;AACnB,cAAc,SAAS,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC;AAC3D,cAAc,OAAO,MAAM;AAC3B,YAAY;AACZ,UAAU,CAAA,CAAE,OAAO,CAAC,EAAE;AACtB,YAAY,gBAAgB,CAAC,CAAC,EAAE;AAChC,cAAc,SAAS,EAAE;AACzB,gBAAgB,IAAI,EAAE,qCAAqC;AAC3D,gBAAgB,OAAO,EAAE,KAAK;AAC9B,eAAe;AACf,aAAa,CAAC;AACd,YAAY,SAAS,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC;AACzD,YAAY,MAAM,CAAC;AACnB,UAAU;AACV,QAAQ,CAAC,CAAC;AACV,MAAM,CAAC;;AAEP,MAAM,OAAO,eAAe,CAAC,eAAe,CAAC;AAC7C,IAAI,CAAC;AACL,GAAG,CAAC;AACJ;;;;"}
|
package/build/types/client.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export declare class CloudflareClient extends ServerRuntimeClient {
|
|
|
13
13
|
private _pendingSpans;
|
|
14
14
|
private _spanCompletionPromise;
|
|
15
15
|
private _resolveSpanCompletion;
|
|
16
|
+
private _unsubscribeSpanStart;
|
|
17
|
+
private _unsubscribeSpanEnd;
|
|
16
18
|
/**
|
|
17
19
|
* Creates a new Cloudflare SDK instance.
|
|
18
20
|
* @param options Configuration options for this SDK.
|
|
@@ -28,6 +30,16 @@ export declare class CloudflareClient extends ServerRuntimeClient {
|
|
|
28
30
|
* @return {Promise<boolean>} A promise that resolves to a boolean indicating whether the flush operation was successful.
|
|
29
31
|
*/
|
|
30
32
|
flush(timeout?: number): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Disposes of the client and releases all resources.
|
|
35
|
+
*
|
|
36
|
+
* This method clears all Cloudflare-specific state in addition to the base client cleanup.
|
|
37
|
+
* It unsubscribes from span lifecycle events and clears pending span tracking.
|
|
38
|
+
*
|
|
39
|
+
* Call this method after flushing to allow the client to be garbage collected.
|
|
40
|
+
* After calling dispose(), the client should not be used anymore.
|
|
41
|
+
*/
|
|
42
|
+
dispose(): void;
|
|
31
43
|
/**
|
|
32
44
|
* Resets the span completion promise and resolve function.
|
|
33
45
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAA8B,MAAM,cAAc,CAAC;AACvF,OAAO,EAA2B,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,mBAAmB;IACvD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0C;IACrE,OAAO,CAAC,aAAa,CAA0B;IAC/C,OAAO,CAAC,sBAAsB,CAA8B;IAC5D,OAAO,CAAC,sBAAsB,CAA6B;IAE3D;;;OAGG;gBACgB,OAAO,EAAE,uBAAuB;IA2CnD;;;;;;;;OAQG;IACU,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,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,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA2BtD;;;;;;;;OAQG;IACa,OAAO,IAAI,IAAI;IAkB/B;;OAEG;IACH,OAAO,CAAC,2BAA2B;CAKpC;AAED,UAAU,qBAAqB;IAC7B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;;;;;;;OAUG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,0BAA0B,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;CACjD;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,OAAO,CAAC,0BAA0B,CAAC,EAAE,qBAAqB;IACnG,GAAG,CAAC,EAAE,gBAAgB,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,aAAa,CAAC,0BAA0B,CAAC,EAAE,qBAAqB;IAC/G,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;CAC9C"}
|
package/build/types/flush.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ExecutionContext } from '@cloudflare/workers-types';
|
|
2
|
+
import type { Client } from '@sentry/core';
|
|
2
3
|
type FlushLock = {
|
|
3
4
|
readonly ready: Promise<void>;
|
|
4
5
|
readonly finalize: () => Promise<void>;
|
|
@@ -12,5 +13,14 @@ type FlushLock = {
|
|
|
12
13
|
* @return {FlushLock} Returns a flusher function if a valid context is provided, otherwise undefined.
|
|
13
14
|
*/
|
|
14
15
|
export declare function makeFlushLock(context: ExecutionContext): FlushLock;
|
|
16
|
+
/**
|
|
17
|
+
* Flushes the client and then disposes of it to allow garbage collection.
|
|
18
|
+
* This should be called at the end of each request to prevent memory leaks.
|
|
19
|
+
*
|
|
20
|
+
* @param client - The CloudflareClient instance to flush and dispose
|
|
21
|
+
* @param timeout - Timeout in milliseconds for the flush operation
|
|
22
|
+
* @returns A promise that resolves when flush and dispose are complete
|
|
23
|
+
*/
|
|
24
|
+
export declare function flushAndDispose(client: Client | undefined, timeout?: number): Promise<void>;
|
|
15
25
|
export {};
|
|
16
26
|
//# sourceMappingURL=flush.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flush.d.ts","sourceRoot":"","sources":["../../src/flush.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"flush.d.ts","sourceRoot":"","sources":["../../src/flush.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAsBlE;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAG/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/handler.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAUlD;;;;;;;;;;GAUG;AAEH,wBAAgB,UAAU,CACxB,GAAG,GAAG,OAAO,EACb,mBAAmB,GAAG,OAAO,EAC7B,cAAc,GAAG,OAAO,EACxB,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,mBAAmB,EAAE,cAAc,CAAC,GAAG,eAAe,CACnF,GAAG,EACH,mBAAmB,EACnB,cAAc,CACf,EACD,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,iBAAiB,GAAG,SAAS,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CA4N7E"}
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { Breadcrumb, BreadcrumbHint, PolymorphicRequest, RequestEventData, SdkInfo, Event, EventHint, ErrorEvent, Exception, FeatureFlagsIntegration, Session, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, Metric, ExclusiveEventHintOrCaptureContext, CaptureContext, } from '@sentry/core';
|
|
2
2
|
export type { CloudflareOptions } from './client';
|
|
3
|
-
export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, isEnabled, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setUser, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentAnthropicAiClient, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, zodErrorsIntegration, consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, updateSpanName, wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, createLangChainCallbackHandler, featureFlagsIntegration, growthbookIntegration, logger, metrics, instrumentLangGraph, } from '@sentry/core';
|
|
3
|
+
export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, isEnabled, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setUser, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentAnthropicAiClient, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, instrumentPostgresJsSql, zodErrorsIntegration, consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, updateSpanName, wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, createLangChainCallbackHandler, featureFlagsIntegration, growthbookIntegration, logger, metrics, instrumentLangGraph, } from '@sentry/core';
|
|
4
4
|
export { withSentry } from './handler';
|
|
5
5
|
export { instrumentDurableObjectWithSentry } from './durableobject';
|
|
6
6
|
export { sentryPagesPlugin } from './pages-plugin';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,OAAO,EACP,aAAa,EACb,IAAI,EACJ,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,MAAM,EACN,kCAAkC,EAClC,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,KAAK,EACL,eAAe,EACf,WAAW,EACX,KAAK,EACL,SAAS,EACT,aAAa,EACb,SAAS,EACT,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,yBAAyB,EACzB,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,cAAc,EACd,aAAa,EACb,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,2BAA2B,EAE3B,yBAAyB,EACzB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,4BAA4B,EAC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EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,MAAM,CAAC;AAE9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,wCAAwC,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAc/F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAMlD,UAAU,4BAA4B;IACpC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,2BAA2B,CAAC,OAAO,CAAC,CAAC,CAAC;IAChE,OAAO,EAAE,gBAAgB,CAAC;IAC1B;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,cAAc,EAAE,4BAA4B,EAC5C,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,GAC5D,OAAO,CAAC,QAAQ,CAAC,CAiJnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/workflows.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,kBAAkB,EAOnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/workflows.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,kBAAkB,EAOnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAQlD;;GAEG;AACH,wBAAsB,kCAAkC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAS5F;AA8FD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,4BAA4B,CAC1C,CAAC,EAAE,mBAAmB;AACtB,CAAC,EAAE,eAAe;AAClB,CAAC,SAAS,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,0BAA0B;AAC9D,CAAC,SAAS,KAAK,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,EAClD,eAAe,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,iBAAiB,EAAE,aAAa,EAAE,CAAC,GAAG,CAAC,CA2CrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapMethodWithSentry.d.ts","sourceRoot":"","sources":["../../src/wrapMethodWithSentry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wrapMethodWithSentry.d.ts","sourceRoot":"","sources":["../../src/wrapMethodWithSentry.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAUlD,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,CAAC;CAChD,CAAC;AAGF,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AACtD,KAAK,cAAc,GAAG,eAAe,CAAC;AAEtC;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,cAAc,EAC3D,cAAc,EAAE,oBAAoB,EACpC,OAAO,EAAE,CAAC,EACV,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,EAC3C,MAAM,CAAC,EAAE,IAAI,GACZ,CAAC,CAuHH"}
|
|
@@ -13,6 +13,8 @@ export declare class CloudflareClient extends ServerRuntimeClient {
|
|
|
13
13
|
private _pendingSpans;
|
|
14
14
|
private _spanCompletionPromise;
|
|
15
15
|
private _resolveSpanCompletion;
|
|
16
|
+
private _unsubscribeSpanStart;
|
|
17
|
+
private _unsubscribeSpanEnd;
|
|
16
18
|
/**
|
|
17
19
|
* Creates a new Cloudflare SDK instance.
|
|
18
20
|
* @param options Configuration options for this SDK.
|
|
@@ -28,6 +30,16 @@ export declare class CloudflareClient extends ServerRuntimeClient {
|
|
|
28
30
|
* @return {Promise<boolean>} A promise that resolves to a boolean indicating whether the flush operation was successful.
|
|
29
31
|
*/
|
|
30
32
|
flush(timeout?: number): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Disposes of the client and releases all resources.
|
|
35
|
+
*
|
|
36
|
+
* This method clears all Cloudflare-specific state in addition to the base client cleanup.
|
|
37
|
+
* It unsubscribes from span lifecycle events and clears pending span tracking.
|
|
38
|
+
*
|
|
39
|
+
* Call this method after flushing to allow the client to be garbage collected.
|
|
40
|
+
* After calling dispose(), the client should not be used anymore.
|
|
41
|
+
*/
|
|
42
|
+
dispose(): void;
|
|
31
43
|
/**
|
|
32
44
|
* Resets the span completion promise and resolve function.
|
|
33
45
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ExecutionContext } from '@cloudflare/workers-types';
|
|
2
|
+
import { Client } from '@sentry/core';
|
|
2
3
|
type FlushLock = {
|
|
3
4
|
readonly ready: Promise<void>;
|
|
4
5
|
readonly finalize: () => Promise<void>;
|
|
@@ -12,5 +13,14 @@ type FlushLock = {
|
|
|
12
13
|
* @return {FlushLock} Returns a flusher function if a valid context is provided, otherwise undefined.
|
|
13
14
|
*/
|
|
14
15
|
export declare function makeFlushLock(context: ExecutionContext): FlushLock;
|
|
16
|
+
/**
|
|
17
|
+
* Flushes the client and then disposes of it to allow garbage collection.
|
|
18
|
+
* This should be called at the end of each request to prevent memory leaks.
|
|
19
|
+
*
|
|
20
|
+
* @param client - The CloudflareClient instance to flush and dispose
|
|
21
|
+
* @param timeout - Timeout in milliseconds for the flush operation
|
|
22
|
+
* @returns A promise that resolves when flush and dispose are complete
|
|
23
|
+
*/
|
|
24
|
+
export declare function flushAndDispose(client: Client | undefined, timeout?: number): Promise<void>;
|
|
15
25
|
export {};
|
|
16
26
|
//# sourceMappingURL=flush.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Breadcrumb, BreadcrumbHint, PolymorphicRequest, RequestEventData, SdkInfo, Event, EventHint, ErrorEvent, Exception, FeatureFlagsIntegration, Session, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, Metric, ExclusiveEventHintOrCaptureContext, CaptureContext, } from '@sentry/core';
|
|
2
2
|
export { CloudflareOptions } from './client';
|
|
3
|
-
export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, isEnabled, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setUser, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentAnthropicAiClient, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, zodErrorsIntegration, consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, updateSpanName, wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, createLangChainCallbackHandler, featureFlagsIntegration, growthbookIntegration, logger, metrics, instrumentLangGraph, } from '@sentry/core';
|
|
3
|
+
export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, isEnabled, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setUser, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentAnthropicAiClient, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, instrumentPostgresJsSql, zodErrorsIntegration, consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, updateSpanName, wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, createLangChainCallbackHandler, featureFlagsIntegration, growthbookIntegration, logger, metrics, instrumentLangGraph, } from '@sentry/core';
|
|
4
4
|
export { withSentry } from './handler';
|
|
5
5
|
export { instrumentDurableObjectWithSentry } from './durableobject';
|
|
6
6
|
export { sentryPagesPlugin } from './pages-plugin';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/cloudflare",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.41.0",
|
|
4
4
|
"description": "Official Sentry SDK for Cloudflare Workers and Pages",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/cloudflare",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@opentelemetry/api": "^1.9.0",
|
|
53
|
-
"@sentry/core": "10.
|
|
53
|
+
"@sentry/core": "10.41.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@cloudflare/workers-types": "^4.x"
|