@sentry/cloudflare 9.31.0 → 9.33.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 +18 -3
- package/build/cjs/client.js.map +1 -1
- package/build/cjs/durableobject.js +5 -3
- package/build/cjs/durableobject.js.map +1 -1
- package/build/cjs/flush.js +36 -0
- package/build/cjs/flush.js.map +1 -0
- package/build/cjs/handler.js +13 -8
- package/build/cjs/handler.js.map +1 -1
- package/build/cjs/index.js +4 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai.js +45 -0
- package/build/cjs/integrations/tracing/vercelai.js.map +1 -0
- package/build/cjs/opentelemetry/tracer.js +78 -0
- package/build/cjs/opentelemetry/tracer.js.map +1 -0
- package/build/cjs/pages-plugin.js +3 -1
- package/build/cjs/pages-plugin.js.map +1 -1
- package/build/cjs/request.js +5 -3
- package/build/cjs/request.js.map +1 -1
- package/build/cjs/sdk.js +20 -1
- package/build/cjs/sdk.js.map +1 -1
- package/build/cjs/workflows.js +161 -0
- package/build/cjs/workflows.js.map +1 -0
- package/build/esm/client.js +18 -3
- package/build/esm/client.js.map +1 -1
- package/build/esm/durableobject.js +5 -3
- package/build/esm/durableobject.js.map +1 -1
- package/build/esm/flush.js +34 -0
- package/build/esm/flush.js.map +1 -0
- package/build/esm/handler.js +13 -8
- package/build/esm/handler.js.map +1 -1
- package/build/esm/index.js +2 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai.js +43 -0
- package/build/esm/integrations/tracing/vercelai.js.map +1 -0
- package/build/esm/opentelemetry/tracer.js +76 -0
- package/build/esm/opentelemetry/tracer.js.map +1 -0
- package/build/esm/package.json +1 -1
- package/build/esm/pages-plugin.js +3 -1
- package/build/esm/pages-plugin.js.map +1 -1
- package/build/esm/request.js +5 -3
- package/build/esm/request.js.map +1 -1
- package/build/esm/sdk.js +20 -1
- package/build/esm/sdk.js.map +1 -1
- package/build/esm/workflows.js +159 -0
- package/build/esm/workflows.js.map +1 -0
- package/build/types/client.d.ts +32 -1
- package/build/types/client.d.ts.map +1 -1
- package/build/types/durableobject.d.ts.map +1 -1
- package/build/types/flush.d.ts +16 -0
- package/build/types/flush.d.ts.map +1 -0
- package/build/types/handler.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/vercelai.d.ts +37 -0
- package/build/types/integrations/tracing/vercelai.d.ts.map +1 -0
- package/build/types/opentelemetry/tracer.d.ts +6 -0
- package/build/types/opentelemetry/tracer.d.ts.map +1 -0
- package/build/types/pages-plugin.d.ts.map +1 -1
- package/build/types/request.d.ts +1 -0
- package/build/types/request.d.ts.map +1 -1
- package/build/types/scope-utils.d.ts +1 -0
- package/build/types/scope-utils.d.ts.map +1 -1
- package/build/types/sdk.d.ts.map +1 -1
- package/build/types/utils/addOriginToSpan.d.ts +5 -0
- package/build/types/utils/addOriginToSpan.d.ts.map +1 -0
- package/build/types/utils/commonjs.d.ts +3 -0
- package/build/types/utils/commonjs.d.ts.map +1 -0
- package/build/types/workflows.d.ts +25 -0
- package/build/types/workflows.d.ts.map +1 -0
- package/build/types-ts3.8/client.d.ts +32 -1
- package/build/types-ts3.8/flush.d.ts +16 -0
- package/build/types-ts3.8/index.d.ts +2 -0
- package/build/types-ts3.8/integrations/tracing/vercelai.d.ts +37 -0
- package/build/types-ts3.8/opentelemetry/tracer.d.ts +6 -0
- package/build/types-ts3.8/request.d.ts +1 -0
- package/build/types-ts3.8/scope-utils.d.ts +1 -0
- package/build/types-ts3.8/utils/addOriginToSpan.d.ts +5 -0
- package/build/types-ts3.8/utils/commonjs.d.ts +3 -0
- package/build/types-ts3.8/workflows.d.ts +22 -0
- package/package.json +4 -3
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a copy of the Vercel AI integration from the node SDK.
|
|
3
|
+
*
|
|
4
|
+
* The only difference is that it does not use `@opentelemetry/instrumentation`
|
|
5
|
+
* because Cloudflare Workers do not support it.
|
|
6
|
+
*
|
|
7
|
+
* Therefore, we cannot automatically patch setting `experimental_telemetry: { isEnabled: true }`
|
|
8
|
+
* and users have to manually set this to get spans.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.
|
|
12
|
+
* This integration is not enabled by default, you need to manually add it.
|
|
13
|
+
*
|
|
14
|
+
* For more information, see the [`ai` documentation](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry).
|
|
15
|
+
*
|
|
16
|
+
* You need to enable collecting spans for a specific call by setting
|
|
17
|
+
* `experimental_telemetry.isEnabled` to `true` in the first argument of the function call.
|
|
18
|
+
*
|
|
19
|
+
* ```javascript
|
|
20
|
+
* const result = await generateText({
|
|
21
|
+
* model: openai('gpt-4-turbo'),
|
|
22
|
+
* experimental_telemetry: { isEnabled: true },
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* If you want to collect inputs and outputs for a specific call, you must specifically opt-in to each
|
|
27
|
+
* function call by setting `experimental_telemetry.recordInputs` and `experimental_telemetry.recordOutputs`
|
|
28
|
+
* to `true`.
|
|
29
|
+
*
|
|
30
|
+
* ```javascript
|
|
31
|
+
* const result = await generateText({
|
|
32
|
+
* model: openai('gpt-4-turbo'),
|
|
33
|
+
* experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },
|
|
34
|
+
* });
|
|
35
|
+
*/
|
|
36
|
+
export declare const vercelAIIntegration: () => import("@sentry/core").Integration;
|
|
37
|
+
//# sourceMappingURL=vercelai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercelai.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/vercelai.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,mBAAmB,0CAA0C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracer.d.ts","sourceRoot":"","sources":["../../../src/opentelemetry/tracer.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages-plugin.d.ts","sourceRoot":"","sources":["../../src/pages-plugin.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,GAAG,OAAO,EAEb,MAAM,SAAS,MAAM,GAAG,GAAG,EAC3B,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAG9D,YAAY,GAAG,GAAG,EAElB,gBAAgB,EACZ,iBAAiB,GACjB,CAAC,CAAC,OAAO,EAAE,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,KAAK,iBAAiB,CAAC,GACxF,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"pages-plugin.d.ts","sourceRoot":"","sources":["../../src/pages-plugin.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,GAAG,OAAO,EAEb,MAAM,SAAS,MAAM,GAAG,GAAG,EAC3B,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAG9D,YAAY,GAAG,GAAG,EAElB,gBAAgB,EACZ,iBAAiB,GACjB,CAAC,CAAC,OAAO,EAAE,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,KAAK,iBAAiB,CAAC,GACxF,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,CAQtD"}
|
package/build/types/request.d.ts
CHANGED
|
@@ -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;AAY/F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAIlD,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;CAC3B;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,
|
|
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;AAY/F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAIlD,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;CAC3B;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,CAwEnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-utils.d.ts","sourceRoot":"","sources":["../../src/scope-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAG1C;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAI1D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,2BAA2B,GAAG,IAAI,CAIrF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAE/D"}
|
|
1
|
+
{"version":3,"file":"scope-utils.d.ts","sourceRoot":"","sources":["../../src/scope-utils.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAG1C;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAI1D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,2BAA2B,GAAG,IAAI,CAIrF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAE/D"}
|
package/build/types/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAYhD,OAAO,KAAK,EAA2B,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAYhD,OAAO,KAAK,EAA2B,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAO5C,2DAA2D;AAC3D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,WAAW,EAAE,CAgBhF;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,SAAS,CA4B7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addOriginToSpan.d.ts","sourceRoot":"","sources":["../../../src/utils/addOriginToSpan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,sCAAsC;AACtC,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAEpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonjs.d.ts","sourceRoot":"","sources":["../../../src/utils/commonjs.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,wBAAgB,KAAK,IAAI,OAAO,CAM/B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="@cloudflare/workers-types" />
|
|
2
|
+
import type { WorkflowEntrypoint } from 'cloudflare:workers';
|
|
3
|
+
import type { CloudflareOptions } from './client';
|
|
4
|
+
/**
|
|
5
|
+
* Instruments a Cloudflare Workflow class with Sentry.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const InstrumentedWorkflow = instrumentWorkflowWithSentry(
|
|
10
|
+
* (env) => ({ dsn: env.SENTRY_DSN }),
|
|
11
|
+
* MyWorkflowClass
|
|
12
|
+
* );
|
|
13
|
+
*
|
|
14
|
+
* export default InstrumentedWorkflow;
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param optionsCallback - Function that returns Sentry options to initialize Sentry
|
|
18
|
+
* @param WorkflowClass - The workflow class to instrument
|
|
19
|
+
* @returns Instrumented workflow class with the same interface
|
|
20
|
+
*/
|
|
21
|
+
export declare function instrumentWorkflowWithSentry<E, // Environment type
|
|
22
|
+
P, // Payload type
|
|
23
|
+
T extends WorkflowEntrypoint<E, P>, // WorkflowEntrypoint type
|
|
24
|
+
C extends new (ctx: ExecutionContext, env: E) => T>(optionsCallback: (env: E) => CloudflareOptions, WorkFlowClass: C): C;
|
|
25
|
+
//# sourceMappingURL=workflows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/workflows.ts"],"names":[],"mappings":";AAUA,OAAO,KAAK,EACV,kBAAkB,EAOnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AA2HlD;;;;;;;;;;;;;;;;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,CAkBrE"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
/// <reference types="@cloudflare/workers-types" />
|
|
1
2
|
import { ClientOptions, Options } from '@sentry/core';
|
|
2
3
|
import { ServerRuntimeClient } from '@sentry/core';
|
|
4
|
+
import { makeFlushLock } from './flush';
|
|
3
5
|
import { CloudflareTransportOptions } from './transport';
|
|
4
6
|
/**
|
|
5
7
|
* The Sentry Cloudflare SDK Client.
|
|
@@ -7,14 +9,41 @@ import { CloudflareTransportOptions } from './transport';
|
|
|
7
9
|
* @see CloudflareClientOptions for documentation on configuration options.
|
|
8
10
|
* @see ServerRuntimeClient for usage documentation.
|
|
9
11
|
*/
|
|
10
|
-
export declare class CloudflareClient extends ServerRuntimeClient
|
|
12
|
+
export declare class CloudflareClient extends ServerRuntimeClient {
|
|
13
|
+
private readonly _flushLock;
|
|
11
14
|
/**
|
|
12
15
|
* Creates a new Cloudflare SDK instance.
|
|
13
16
|
* @param options Configuration options for this SDK.
|
|
14
17
|
*/
|
|
15
18
|
constructor(options: CloudflareClientOptions);
|
|
19
|
+
/**
|
|
20
|
+
* Flushes pending operations and ensures all data is processed.
|
|
21
|
+
* If a timeout is provided, the operation will be completed within the specified time limit.
|
|
22
|
+
*
|
|
23
|
+
* @param {number} [timeout] - Optional timeout in milliseconds to force the completion of the flush operation.
|
|
24
|
+
* @return {Promise<boolean>} A promise that resolves to a boolean indicating whether the flush operation was successful.
|
|
25
|
+
*/
|
|
26
|
+
flush(timeout?: number): Promise<boolean>;
|
|
16
27
|
}
|
|
17
28
|
interface BaseCloudflareOptions {
|
|
29
|
+
/**
|
|
30
|
+
* @ignore Used internally to disable the deDupeIntegration for workflows.
|
|
31
|
+
* @hidden Used internally to disable the deDupeIntegration for workflows.
|
|
32
|
+
* @default true
|
|
33
|
+
*/
|
|
34
|
+
enableDedupe?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The Cloudflare SDK is not OpenTelemetry native, however, we set up some OpenTelemetry compatibility
|
|
37
|
+
* via a custom trace provider.
|
|
38
|
+
* This ensures that any spans emitted via `@opentelemetry/api` will be captured by Sentry.
|
|
39
|
+
* HOWEVER, big caveat: This does not handle custom context handling, it will always work off the current scope.
|
|
40
|
+
* This should be good enough for many, but not all integrations.
|
|
41
|
+
*
|
|
42
|
+
* If you want to opt-out of setting up the OpenTelemetry compatibility tracer, set this to `true`.
|
|
43
|
+
*
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
skipOpenTelemetrySetup?: boolean;
|
|
18
47
|
}
|
|
19
48
|
/**
|
|
20
49
|
* Configuration options for the Sentry Cloudflare SDK
|
|
@@ -22,6 +51,7 @@ interface BaseCloudflareOptions {
|
|
|
22
51
|
* @see @sentry/core Options for more information.
|
|
23
52
|
*/
|
|
24
53
|
export interface CloudflareOptions extends Options<CloudflareTransportOptions>, BaseCloudflareOptions {
|
|
54
|
+
ctx?: ExecutionContext;
|
|
25
55
|
}
|
|
26
56
|
/**
|
|
27
57
|
* Configuration options for the Sentry Cloudflare SDK Client class
|
|
@@ -29,6 +59,7 @@ export interface CloudflareOptions extends Options<CloudflareTransportOptions>,
|
|
|
29
59
|
* @see CloudflareClient for more information.
|
|
30
60
|
*/
|
|
31
61
|
export interface CloudflareClientOptions extends ClientOptions<CloudflareTransportOptions>, BaseCloudflareOptions {
|
|
62
|
+
flushLock?: ReturnType<typeof makeFlushLock>;
|
|
32
63
|
}
|
|
33
64
|
export {};
|
|
34
65
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ExecutionContext } from '@cloudflare/workers-types';
|
|
2
|
+
type FlushLock = {
|
|
3
|
+
readonly ready: Promise<void>;
|
|
4
|
+
readonly finalize: () => Promise<void>;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Enhances the given execution context by wrapping its `waitUntil` method with a proxy
|
|
8
|
+
* to monitor pending tasks, and provides a flusher function to ensure all tasks
|
|
9
|
+
* have been completed before executing any subsequent logic.
|
|
10
|
+
*
|
|
11
|
+
* @param {ExecutionContext} context - The execution context to be enhanced. If no context is provided, the function returns undefined.
|
|
12
|
+
* @return {FlushLock} Returns a flusher function if a valid context is provided, otherwise undefined.
|
|
13
|
+
*/
|
|
14
|
+
export declare function makeFlushLock(context: ExecutionContext): FlushLock;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=flush.d.ts.map
|
|
@@ -10,6 +10,8 @@ export { wrapRequestHandler } from './request';
|
|
|
10
10
|
export { CloudflareClient } from './client';
|
|
11
11
|
export { getDefaultIntegrations } from './sdk';
|
|
12
12
|
export { fetchIntegration } from './integrations/fetch';
|
|
13
|
+
export { vercelAIIntegration } from './integrations/tracing/vercelai';
|
|
13
14
|
export { instrumentD1WithSentry } from './d1';
|
|
15
|
+
export { instrumentWorkflowWithSentry } from './workflows';
|
|
14
16
|
export { setAsyncLocalStorageAsyncContextStrategy } from './async';
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a copy of the Vercel AI integration from the node SDK.
|
|
3
|
+
*
|
|
4
|
+
* The only difference is that it does not use `@opentelemetry/instrumentation`
|
|
5
|
+
* because Cloudflare Workers do not support it.
|
|
6
|
+
*
|
|
7
|
+
* Therefore, we cannot automatically patch setting `experimental_telemetry: { isEnabled: true }`
|
|
8
|
+
* and users have to manually set this to get spans.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.
|
|
12
|
+
* This integration is not enabled by default, you need to manually add it.
|
|
13
|
+
*
|
|
14
|
+
* For more information, see the [`ai` documentation](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry).
|
|
15
|
+
*
|
|
16
|
+
* You need to enable collecting spans for a specific call by setting
|
|
17
|
+
* `experimental_telemetry.isEnabled` to `true` in the first argument of the function call.
|
|
18
|
+
*
|
|
19
|
+
* ```javascript
|
|
20
|
+
* const result = await generateText({
|
|
21
|
+
* model: openai('gpt-4-turbo'),
|
|
22
|
+
* experimental_telemetry: { isEnabled: true },
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* If you want to collect inputs and outputs for a specific call, you must specifically opt-in to each
|
|
27
|
+
* function call by setting `experimental_telemetry.recordInputs` and `experimental_telemetry.recordOutputs`
|
|
28
|
+
* to `true`.
|
|
29
|
+
*
|
|
30
|
+
* ```javascript
|
|
31
|
+
* const result = await generateText({
|
|
32
|
+
* model: openai('gpt-4-turbo'),
|
|
33
|
+
* experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },
|
|
34
|
+
* });
|
|
35
|
+
*/
|
|
36
|
+
export declare const vercelAIIntegration: () => import("@sentry/core").Integration;
|
|
37
|
+
//# sourceMappingURL=vercelai.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="@cloudflare/workers-types" />
|
|
2
|
+
import { WorkflowEntrypoint } from 'cloudflare:workers';
|
|
3
|
+
import { CloudflareOptions } from './client';
|
|
4
|
+
/**
|
|
5
|
+
* Instruments a Cloudflare Workflow class with Sentry.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const InstrumentedWorkflow = instrumentWorkflowWithSentry(
|
|
10
|
+
* (env) => ({ dsn: env.SENTRY_DSN }),
|
|
11
|
+
* MyWorkflowClass
|
|
12
|
+
* );
|
|
13
|
+
*
|
|
14
|
+
* export default InstrumentedWorkflow;
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param optionsCallback - Function that returns Sentry options to initialize Sentry
|
|
18
|
+
* @param WorkflowClass - The workflow class to instrument
|
|
19
|
+
* @returns Instrumented workflow class with the same interface
|
|
20
|
+
*/
|
|
21
|
+
export declare function instrumentWorkflowWithSentry<E, P, T extends WorkflowEntrypoint<E, P>, C extends new (ctx: ExecutionContext, env: E) => T>(optionsCallback: (env: E) => CloudflareOptions, WorkFlowClass: C): C;
|
|
22
|
+
//# sourceMappingURL=workflows.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/cloudflare",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.33.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",
|
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@
|
|
52
|
+
"@opentelemetry/api": "^1.9.0",
|
|
53
|
+
"@sentry/core": "9.33.0"
|
|
53
54
|
},
|
|
54
55
|
"peerDependencies": {
|
|
55
56
|
"@cloudflare/workers-types": "^4.x"
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
}
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
|
-
"@cloudflare/workers-types": "4.
|
|
64
|
+
"@cloudflare/workers-types": "4.20250620.0",
|
|
64
65
|
"@types/node": "^18.19.1",
|
|
65
66
|
"wrangler": "^3.67.1"
|
|
66
67
|
},
|