@sentry/cloudflare 10.47.0 → 10.49.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.
Files changed (171) hide show
  1. package/build/cjs/client.js.map +1 -1
  2. package/build/cjs/durableobject.js +42 -16
  3. package/build/cjs/durableobject.js.map +1 -1
  4. package/build/cjs/index.js +3 -0
  5. package/build/cjs/index.js.map +1 -1
  6. package/build/cjs/instrument.js +72 -8
  7. package/build/cjs/instrument.js.map +1 -1
  8. package/build/cjs/instrumentations/instrumentDurableObjectNamespace.js +56 -0
  9. package/build/cjs/instrumentations/instrumentDurableObjectNamespace.js.map +1 -0
  10. package/build/cjs/instrumentations/instrumentDurableObjectStorage.js +38 -3
  11. package/build/cjs/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
  12. package/build/cjs/instrumentations/instrumentWorkerEntrypoint.js +101 -0
  13. package/build/cjs/instrumentations/instrumentWorkerEntrypoint.js.map +1 -0
  14. package/build/cjs/instrumentations/worker/instrumentEmail.js +16 -13
  15. package/build/cjs/instrumentations/worker/instrumentEmail.js.map +1 -1
  16. package/build/cjs/instrumentations/worker/instrumentEnv.js +83 -0
  17. package/build/cjs/instrumentations/worker/instrumentEnv.js.map +1 -0
  18. package/build/cjs/instrumentations/worker/instrumentFetch.js +36 -10
  19. package/build/cjs/instrumentations/worker/instrumentFetch.js.map +1 -1
  20. package/build/cjs/instrumentations/worker/instrumentFetcher.js +38 -0
  21. package/build/cjs/instrumentations/worker/instrumentFetcher.js.map +1 -0
  22. package/build/cjs/instrumentations/worker/instrumentQueue.js +36 -10
  23. package/build/cjs/instrumentations/worker/instrumentQueue.js.map +1 -1
  24. package/build/cjs/instrumentations/worker/instrumentScheduled.js +36 -13
  25. package/build/cjs/instrumentations/worker/instrumentScheduled.js.map +1 -1
  26. package/build/cjs/instrumentations/worker/instrumentTail.js +34 -10
  27. package/build/cjs/instrumentations/worker/instrumentTail.js.map +1 -1
  28. package/build/cjs/integrations/tracing/vercelai.js +2 -1
  29. package/build/cjs/integrations/tracing/vercelai.js.map +1 -1
  30. package/build/cjs/request.js +5 -6
  31. package/build/cjs/request.js.map +1 -1
  32. package/build/cjs/scope-utils.js.map +1 -1
  33. package/build/cjs/sdk.js +6 -1
  34. package/build/cjs/sdk.js.map +1 -1
  35. package/build/cjs/utils/instrumentContext.js +2 -1
  36. package/build/cjs/utils/instrumentContext.js.map +1 -1
  37. package/build/cjs/utils/isBinding.js +32 -0
  38. package/build/cjs/utils/isBinding.js.map +1 -0
  39. package/build/cjs/utils/isCloudflareClass.js +29 -0
  40. package/build/cjs/utils/isCloudflareClass.js.map +1 -0
  41. package/build/cjs/utils/rpcOptions.js +84 -0
  42. package/build/cjs/utils/rpcOptions.js.map +1 -0
  43. package/build/cjs/utils/traceLinks.js +78 -0
  44. package/build/cjs/utils/traceLinks.js.map +1 -0
  45. package/build/cjs/withSentry.js +31 -20
  46. package/build/cjs/withSentry.js.map +1 -1
  47. package/build/cjs/workflows.js +3 -2
  48. package/build/cjs/workflows.js.map +1 -1
  49. package/build/cjs/wrapMethodWithSentry.js +157 -112
  50. package/build/cjs/wrapMethodWithSentry.js.map +1 -1
  51. package/build/esm/client.js.map +1 -1
  52. package/build/esm/durableobject.js +43 -17
  53. package/build/esm/durableobject.js.map +1 -1
  54. package/build/esm/index.js +1 -1
  55. package/build/esm/instrument.js +71 -8
  56. package/build/esm/instrument.js.map +1 -1
  57. package/build/esm/instrumentations/instrumentDurableObjectNamespace.js +54 -0
  58. package/build/esm/instrumentations/instrumentDurableObjectNamespace.js.map +1 -0
  59. package/build/esm/instrumentations/instrumentDurableObjectStorage.js +39 -4
  60. package/build/esm/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
  61. package/build/esm/instrumentations/instrumentWorkerEntrypoint.js +99 -0
  62. package/build/esm/instrumentations/instrumentWorkerEntrypoint.js.map +1 -0
  63. package/build/esm/instrumentations/worker/instrumentEmail.js +17 -14
  64. package/build/esm/instrumentations/worker/instrumentEmail.js.map +1 -1
  65. package/build/esm/instrumentations/worker/instrumentEnv.js +81 -0
  66. package/build/esm/instrumentations/worker/instrumentEnv.js.map +1 -0
  67. package/build/esm/instrumentations/worker/instrumentFetch.js +37 -12
  68. package/build/esm/instrumentations/worker/instrumentFetch.js.map +1 -1
  69. package/build/esm/instrumentations/worker/instrumentFetcher.js +36 -0
  70. package/build/esm/instrumentations/worker/instrumentFetcher.js.map +1 -0
  71. package/build/esm/instrumentations/worker/instrumentQueue.js +37 -12
  72. package/build/esm/instrumentations/worker/instrumentQueue.js.map +1 -1
  73. package/build/esm/instrumentations/worker/instrumentScheduled.js +37 -15
  74. package/build/esm/instrumentations/worker/instrumentScheduled.js.map +1 -1
  75. package/build/esm/instrumentations/worker/instrumentTail.js +35 -12
  76. package/build/esm/instrumentations/worker/instrumentTail.js.map +1 -1
  77. package/build/esm/integrations/tracing/vercelai.js +2 -1
  78. package/build/esm/integrations/tracing/vercelai.js.map +1 -1
  79. package/build/esm/package.json +1 -1
  80. package/build/esm/request.js +5 -6
  81. package/build/esm/request.js.map +1 -1
  82. package/build/esm/scope-utils.js.map +1 -1
  83. package/build/esm/sdk.js +7 -2
  84. package/build/esm/sdk.js.map +1 -1
  85. package/build/esm/utils/instrumentContext.js +2 -1
  86. package/build/esm/utils/instrumentContext.js.map +1 -1
  87. package/build/esm/utils/isBinding.js +29 -0
  88. package/build/esm/utils/isBinding.js.map +1 -0
  89. package/build/esm/utils/isCloudflareClass.js +27 -0
  90. package/build/esm/utils/isCloudflareClass.js.map +1 -0
  91. package/build/esm/utils/rpcOptions.js +81 -0
  92. package/build/esm/utils/rpcOptions.js.map +1 -0
  93. package/build/esm/utils/traceLinks.js +73 -0
  94. package/build/esm/utils/traceLinks.js.map +1 -0
  95. package/build/esm/withSentry.js +32 -21
  96. package/build/esm/withSentry.js.map +1 -1
  97. package/build/esm/workflows.js +3 -2
  98. package/build/esm/workflows.js.map +1 -1
  99. package/build/esm/wrapMethodWithSentry.js +159 -114
  100. package/build/esm/wrapMethodWithSentry.js.map +1 -1
  101. package/build/types/client.d.ts +39 -10
  102. package/build/types/client.d.ts.map +1 -1
  103. package/build/types/durableobject.d.ts.map +1 -1
  104. package/build/types/index.d.ts +1 -1
  105. package/build/types/index.d.ts.map +1 -1
  106. package/build/types/instrument.d.ts +15 -4
  107. package/build/types/instrument.d.ts.map +1 -1
  108. package/build/types/instrumentations/instrumentDurableObjectNamespace.d.ts +12 -0
  109. package/build/types/instrumentations/instrumentDurableObjectNamespace.d.ts.map +1 -0
  110. package/build/types/instrumentations/instrumentDurableObjectStorage.d.ts +8 -1
  111. package/build/types/instrumentations/instrumentDurableObjectStorage.d.ts.map +1 -1
  112. package/build/types/instrumentations/instrumentWorkerEntrypoint.d.ts +42 -0
  113. package/build/types/instrumentations/instrumentWorkerEntrypoint.d.ts.map +1 -0
  114. package/build/types/instrumentations/worker/instrumentEmail.d.ts +2 -1
  115. package/build/types/instrumentations/worker/instrumentEmail.d.ts.map +1 -1
  116. package/build/types/instrumentations/worker/instrumentEnv.d.ts +16 -0
  117. package/build/types/instrumentations/worker/instrumentEnv.d.ts.map +1 -0
  118. package/build/types/instrumentations/worker/instrumentFetch.d.ts +6 -1
  119. package/build/types/instrumentations/worker/instrumentFetch.d.ts.map +1 -1
  120. package/build/types/instrumentations/worker/instrumentFetcher.d.ts +10 -0
  121. package/build/types/instrumentations/worker/instrumentFetcher.d.ts.map +1 -0
  122. package/build/types/instrumentations/worker/instrumentQueue.d.ts +6 -1
  123. package/build/types/instrumentations/worker/instrumentQueue.d.ts.map +1 -1
  124. package/build/types/instrumentations/worker/instrumentScheduled.d.ts +6 -1
  125. package/build/types/instrumentations/worker/instrumentScheduled.d.ts.map +1 -1
  126. package/build/types/instrumentations/worker/instrumentTail.d.ts +6 -1
  127. package/build/types/instrumentations/worker/instrumentTail.d.ts.map +1 -1
  128. package/build/types/integrations/tracing/vercelai.d.ts +9 -1
  129. package/build/types/integrations/tracing/vercelai.d.ts.map +1 -1
  130. package/build/types/request.d.ts +3 -3
  131. package/build/types/request.d.ts.map +1 -1
  132. package/build/types/scope-utils.d.ts +2 -2
  133. package/build/types/scope-utils.d.ts.map +1 -1
  134. package/build/types/sdk.d.ts.map +1 -1
  135. package/build/types/utils/instrumentContext.d.ts.map +1 -1
  136. package/build/types/utils/isBinding.d.ts +49 -0
  137. package/build/types/utils/isBinding.d.ts.map +1 -0
  138. package/build/types/utils/isCloudflareClass.d.ts +30 -0
  139. package/build/types/utils/isCloudflareClass.d.ts.map +1 -0
  140. package/build/types/utils/rpcOptions.d.ts +24 -0
  141. package/build/types/utils/rpcOptions.d.ts.map +1 -0
  142. package/build/types/utils/traceLinks.d.ts +27 -0
  143. package/build/types/utils/traceLinks.d.ts.map +1 -0
  144. package/build/types/withSentry.d.ts +3 -2
  145. package/build/types/withSentry.d.ts.map +1 -1
  146. package/build/types/workflows.d.ts.map +1 -1
  147. package/build/types/wrapMethodWithSentry.d.ts +19 -2
  148. package/build/types/wrapMethodWithSentry.d.ts.map +1 -1
  149. package/build/types-ts3.8/client.d.ts +39 -10
  150. package/build/types-ts3.8/index.d.ts +1 -1
  151. package/build/types-ts3.8/instrument.d.ts +15 -4
  152. package/build/types-ts3.8/instrumentations/instrumentDurableObjectNamespace.d.ts +12 -0
  153. package/build/types-ts3.8/instrumentations/instrumentDurableObjectStorage.d.ts +8 -1
  154. package/build/types-ts3.8/instrumentations/instrumentWorkerEntrypoint.d.ts +42 -0
  155. package/build/types-ts3.8/instrumentations/worker/instrumentEmail.d.ts +2 -1
  156. package/build/types-ts3.8/instrumentations/worker/instrumentEnv.d.ts +16 -0
  157. package/build/types-ts3.8/instrumentations/worker/instrumentFetch.d.ts +6 -1
  158. package/build/types-ts3.8/instrumentations/worker/instrumentFetcher.d.ts +10 -0
  159. package/build/types-ts3.8/instrumentations/worker/instrumentQueue.d.ts +6 -1
  160. package/build/types-ts3.8/instrumentations/worker/instrumentScheduled.d.ts +6 -1
  161. package/build/types-ts3.8/instrumentations/worker/instrumentTail.d.ts +6 -1
  162. package/build/types-ts3.8/integrations/tracing/vercelai.d.ts +9 -1
  163. package/build/types-ts3.8/request.d.ts +3 -3
  164. package/build/types-ts3.8/scope-utils.d.ts +2 -2
  165. package/build/types-ts3.8/utils/isBinding.d.ts +49 -0
  166. package/build/types-ts3.8/utils/isCloudflareClass.d.ts +30 -0
  167. package/build/types-ts3.8/utils/rpcOptions.d.ts +24 -0
  168. package/build/types-ts3.8/utils/traceLinks.d.ts +27 -0
  169. package/build/types-ts3.8/withSentry.d.ts +3 -2
  170. package/build/types-ts3.8/wrapMethodWithSentry.d.ts +19 -2
  171. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentEnv.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentEnv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAYtD;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,GAAG,CAqD7G"}
@@ -1,7 +1,12 @@
1
1
  import type { ExportedHandler } from '@cloudflare/workers-types';
2
+ import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
2
3
  import type { CloudflareOptions } from '../../client';
3
4
  /**
4
5
  * Instruments a fetch handler for ExportedHandler (env/ctx come from args).
5
6
  */
6
- export declare function instrumentExportedHandlerFetch<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: Parameters<NonNullable<T['fetch']>>[1]) => CloudflareOptions | undefined): void;
7
+ export declare function instrumentExportedHandlerFetch<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined): void;
8
+ /**
9
+ * Instruments a fetch method for WorkerEntrypoint (options/context already available).
10
+ */
11
+ export declare function instrumentWorkerEntrypointFetch<T extends WorkerEntrypoint>(instance: T, options: CloudflareOptions, context: ExecutionContext): void;
7
12
  //# sourceMappingURL=instrumentFetch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentFetch.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentFetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAMtD;;GAEG;AAEH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACrF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,iBAAiB,GAAG,SAAS,GAC9F,IAAI,CAkBN"}
1
+ {"version":3,"file":"instrumentFetch.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentFetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,GAAG,IAAI,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAOtD;;GAEG;AAEH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACrF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,OAAO,aAAa,KAAK,iBAAiB,GAAG,SAAS,GAC5E,IAAI,CAoBN;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,CAAC,SAAS,gBAAgB,EACxE,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,gBAAgB,GACxB,IAAI,CAaN"}
@@ -0,0 +1,10 @@
1
+ import type { Fetcher } from '@cloudflare/workers-types';
2
+ /**
3
+ * Wraps a fetch-like function to create a span and propagate trace headers
4
+ * (`sentry-trace` and `baggage`) on the outgoing request.
5
+ *
6
+ * Useful for instrumenting Cloudflare bindings that expose a `fetch` method
7
+ * (e.g. Durable Object stubs, Service bindings).
8
+ */
9
+ export declare function instrumentFetcher(fetchFn: Fetcher['fetch']): Fetcher['fetch'];
10
+ //# sourceMappingURL=instrumentFetcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentFetcher.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentFetcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGzD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAuB7E"}
@@ -1,7 +1,12 @@
1
1
  import type { ExportedHandler } from '@cloudflare/workers-types';
2
+ import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
2
3
  import type { CloudflareOptions } from '../../client';
3
4
  /**
4
5
  * Instruments a queue handler for ExportedHandler (env/ctx come from args).
5
6
  */
6
- export declare function instrumentExportedHandlerQueue<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: Parameters<NonNullable<T['queue']>>[1]) => CloudflareOptions | undefined): void;
7
+ export declare function instrumentExportedHandlerQueue<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined): void;
8
+ /**
9
+ * Instruments a queue method for WorkerEntrypoint (options/context already available).
10
+ */
11
+ export declare function instrumentWorkerEntrypointQueue<T extends WorkerEntrypoint>(instance: T, options: CloudflareOptions, context: ExecutionContext): void;
7
12
  //# sourceMappingURL=instrumentQueue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentQueue.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentQueue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,2BAA2B,CAAC;AAS/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAsDtD;;GAEG;AAEH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACrF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,iBAAiB,GAAG,SAAS,GAC9F,IAAI,CAkBN"}
1
+ {"version":3,"file":"instrumentQueue.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentQueue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,GAAG,IAAI,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AASjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAuDtD;;GAEG;AAEH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACrF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,OAAO,aAAa,KAAK,iBAAiB,GAAG,SAAS,GAC5E,IAAI,CAoBN;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,CAAC,SAAS,gBAAgB,EACxE,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,gBAAgB,GACxB,IAAI,CAaN"}
@@ -1,7 +1,12 @@
1
1
  import type { ExportedHandler } from '@cloudflare/workers-types';
2
+ import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
2
3
  import type { CloudflareOptions } from '../../client';
3
4
  /**
4
5
  * Instruments a scheduled handler for ExportedHandler (env/ctx come from args).
5
6
  */
6
- export declare function instrumentExportedHandlerScheduled<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: Parameters<NonNullable<T['scheduled']>>[1]) => CloudflareOptions | undefined): void;
7
+ export declare function instrumentExportedHandlerScheduled<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined): void;
8
+ /**
9
+ * Instruments a scheduled method for WorkerEntrypoint (options/context already available).
10
+ */
11
+ export declare function instrumentWorkerEntrypointScheduled<T extends WorkerEntrypoint>(instance: T, options: CloudflareOptions, context: ExecutionContext): void;
7
12
  //# sourceMappingURL=instrumentScheduled.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentScheduled.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentScheduled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,2BAA2B,CAAC;AAQtF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAmDtD;;GAEG;AAEH,wBAAgB,kCAAkC,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACzF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,iBAAiB,GAAG,SAAS,GAClG,IAAI,CAkBN"}
1
+ {"version":3,"file":"instrumentScheduled.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentScheduled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,2BAA2B,CAAC;AACtF,OAAO,KAAK,EAAE,GAAG,IAAI,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAQjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAiDtD;;GAEG;AAEH,wBAAgB,kCAAkC,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACzF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,OAAO,aAAa,KAAK,iBAAiB,GAAG,SAAS,GAC5E,IAAI,CAoBN;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,CAAC,SAAS,gBAAgB,EAC5E,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,gBAAgB,GACxB,IAAI,CAaN"}
@@ -1,7 +1,12 @@
1
1
  import type { ExportedHandler } from '@cloudflare/workers-types';
2
+ import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
2
3
  import type { CloudflareOptions } from '../../client';
3
4
  /**
4
5
  * Instruments a tail handler for ExportedHandler (env/ctx come from args).
5
6
  */
6
- export declare function instrumentExportedHandlerTail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: Parameters<NonNullable<T['tail']>>[1]) => CloudflareOptions | undefined): void;
7
+ export declare function instrumentExportedHandlerTail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined): void;
8
+ /**
9
+ * Instruments a tail method for WorkerEntrypoint (options/context already available).
10
+ */
11
+ export declare function instrumentWorkerEntrypointTail<T extends WorkerEntrypoint>(instance: T, options: CloudflareOptions, context: ExecutionContext): void;
7
12
  //# sourceMappingURL=instrumentTail.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentTail.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentTail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAgCtD;;GAEG;AAEH,wBAAgB,6BAA6B,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACpF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,iBAAiB,GAAG,SAAS,GAC7F,IAAI,CAkBN"}
1
+ {"version":3,"file":"instrumentTail.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentTail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAa,MAAM,2BAA2B,CAAC;AAC5E,OAAO,KAAK,EAAE,GAAG,IAAI,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAiCtD;;GAEG;AAEH,wBAAgB,6BAA6B,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACpF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,OAAO,aAAa,KAAK,iBAAiB,GAAG,SAAS,GAC5E,IAAI,CAoBN;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,gBAAgB,EACvE,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,gBAAgB,GACxB,IAAI,CAWN"}
@@ -7,6 +7,13 @@
7
7
  * Therefore, we cannot automatically patch setting `experimental_telemetry: { isEnabled: true }`
8
8
  * and users have to manually set this to get spans.
9
9
  */
10
+ interface VercelAiOptions {
11
+ /**
12
+ * Enable or disable truncation of recorded input messages.
13
+ * Defaults to `true`.
14
+ */
15
+ enableTruncation?: boolean;
16
+ }
10
17
  /**
11
18
  * Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.
12
19
  * This integration is not enabled by default, you need to manually add it.
@@ -33,5 +40,6 @@
33
40
  * experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },
34
41
  * });
35
42
  */
36
- export declare const vercelAIIntegration: () => import("@sentry/core").Integration;
43
+ export declare const vercelAIIntegration: (options?: VercelAiOptions | undefined) => import("@sentry/core").Integration;
44
+ export {};
37
45
  //# sourceMappingURL=vercelai.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"vercelai.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/vercelai.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,UAAU,eAAe;IACvB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAYD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,mBAAmB,+EAA0C,CAAC"}
@@ -1,9 +1,9 @@
1
- import type { ExecutionContext, IncomingRequestCfProperties } from '@cloudflare/workers-types';
1
+ import type { CfProperties, ExecutionContext, IncomingRequestCfProperties } from '@cloudflare/workers-types';
2
2
  import type { CloudflareOptions } from './client';
3
3
  interface RequestHandlerWrapperOptions {
4
4
  options: CloudflareOptions;
5
- request: Request<unknown, IncomingRequestCfProperties<unknown>>;
6
- context: ExecutionContext;
5
+ request: Request<unknown, IncomingRequestCfProperties<unknown> | CfProperties<unknown>>;
6
+ context: ExecutionContext | undefined;
7
7
  /**
8
8
  * If true, errors will be captured, rethrown and sent to Sentry.
9
9
  * Otherwise, errors are rethrown but not captured.
@@ -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;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
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAc7G,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,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;IACxF,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACtC;;;;;;;;;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,CAgJnB"}
@@ -1,4 +1,4 @@
1
- import type { IncomingRequestCfProperties } from '@cloudflare/workers-types';
1
+ import type { CfProperties, IncomingRequestCfProperties } from '@cloudflare/workers-types';
2
2
  import type { Scope } from '@sentry/core';
3
3
  /**
4
4
  * Set cloud resource context on scope.
@@ -7,7 +7,7 @@ export declare function addCloudResourceContext(scope: Scope): void;
7
7
  /**
8
8
  * Set culture context on scope
9
9
  */
10
- export declare function addCultureContext(scope: Scope, cf: IncomingRequestCfProperties): void;
10
+ export declare function addCultureContext(scope: Scope, cf: IncomingRequestCfProperties | CfProperties): void;
11
11
  /**
12
12
  * Set request data on scope
13
13
  */
@@ -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,YAAY,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC3F,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,YAAY,GAAG,IAAI,CAIpG;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAE/D"}
@@ -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;AAahD,OAAO,KAAK,EAA2B,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAQ5C,2DAA2D;AAC3D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,WAAW,EAAE,CAkBhF;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,SAAS,CA4B7E"}
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAchD,OAAO,KAAK,EAA2B,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAQ5C,2DAA2D;AAC3D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,WAAW,EAAE,CAkBhF;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,SAAS,CAiC7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentContext.d.ts","sourceRoot":"","sources":["../../../src/utils/instrumentContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAA6B,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGtH,KAAK,WAAW,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;AAGzD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,WAAW,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CA+ClE"}
1
+ {"version":3,"file":"instrumentContext.d.ts","sourceRoot":"","sources":["../../../src/utils/instrumentContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAA6B,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGtH,KAAK,WAAW,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;AAGzD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,WAAW,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAgDlE"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Adapted from https://github.com/evanderkoogh/otel-cf-workers/blob/effeb549f0a4ed1c55ea0c4f0d8e8e37e5494fb3/src/instrumentation/env.ts
3
+ *
4
+ * BSD 3-Clause License
5
+ *
6
+ * Copyright (c) 2023, Erwin van der Koogh
7
+ *
8
+ * Redistribution and use in source and binary forms, with or without
9
+ * modification, are permitted provided that the following conditions are met:
10
+ *
11
+ * 1. Redistributions of source code must retain the above copyright notice, this
12
+ * list of conditions and the following disclaimer.
13
+ *
14
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
15
+ * this list of conditions and the following disclaimer in the documentation
16
+ * and/or other materials provided with the distribution.
17
+ *
18
+ * 3. Neither the name of the copyright holder nor the names of its
19
+ * contributors may be used to endorse or promote products derived from
20
+ * this software without specific prior written permission.
21
+ *
22
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ */
33
+ import type { DurableObjectNamespace } from '@cloudflare/workers-types';
34
+ /**
35
+ * Checks if a value is a JSRPC proxy (service binding).
36
+ *
37
+ * JSRPC proxies return a truthy value for ANY property access, including
38
+ * properties that don't exist. This makes other duck-type checks unreliable
39
+ * unless we exclude JSRPC first.
40
+ *
41
+ * Must be checked before other binding type checks.
42
+ */
43
+ export declare function isJSRPC(item: unknown): item is Service;
44
+ /**
45
+ * Duck-type check for DurableObjectNamespace bindings.
46
+ * DurableObjectNamespace has `idFromName`, `idFromString`, `get`, `newUniqueId`.
47
+ */
48
+ export declare function isDurableObjectNamespace(item: unknown): item is DurableObjectNamespace;
49
+ //# sourceMappingURL=isBinding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isBinding.d.ts","sourceRoot":"","sources":["../../../src/utils/isBinding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAExE;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,OAAO,CAMtD;AAID;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,sBAAsB,CAEtF"}
@@ -0,0 +1,30 @@
1
+ import type { DurableObject, WorkflowEntrypoint } from 'cloudflare:workers';
2
+ import type { WorkerEntrypointConstructor } from '../instrumentations/instrumentWorkerEntrypoint';
3
+ /**
4
+ * Checks if a class constructor extends a specific Cloudflare base class.
5
+ *
6
+ * Uses prototype chain walking with constructor names rather than instanceof,
7
+ * so it works in Node at build time without requiring the cloudflare:workers
8
+ * module (which only exists in the Workers runtime).
9
+ *
10
+ * This is used to differentiate between different Cloudflare worker types:
11
+ * - WorkerEntrypoint: Class-based workers (used with instrumentWorkerEntrypoint)
12
+ * - DurableObject: Durable Object classes
13
+ * - Workflow: Workflow classes
14
+ *
15
+ * For ExportedHandler (plain objects), this will return false for all types.
16
+ *
17
+ * @param value - The value to check (typically a class constructor)
18
+ * @param className - The Cloudflare base class name to check against
19
+ * @returns true if the value is a class that extends the specified Cloudflare class
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * isCloudflareClass(MyWorker, 'WorkerEntrypoint') // true if MyWorker extends WorkerEntrypoint
24
+ * isCloudflareClass(MyDO, 'DurableObject') // true if MyDO extends DurableObject
25
+ * ```
26
+ */
27
+ export declare function isCloudflareClass(value: unknown, className: 'WorkerEntrypoint'): value is WorkerEntrypointConstructor;
28
+ export declare function isCloudflareClass(value: unknown, className: 'DurableObject'): value is new (...args: unknown[]) => DurableObject;
29
+ export declare function isCloudflareClass(value: unknown, className: 'WorkflowEntrypoint'): value is new (...args: unknown[]) => WorkflowEntrypoint;
30
+ //# sourceMappingURL=isCloudflareClass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCloudflareClass.d.ts","sourceRoot":"","sources":["../../../src/utils/isCloudflareClass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAGlG;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,GAAG,KAAK,IAAI,2BAA2B,CAAC;AACvH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,eAAe,GACzB,KAAK,IAAI,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,aAAa,CAAC;AACtD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,oBAAoB,GAC9B,KAAK,IAAI,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,kBAAkB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { CloudflareOptions } from '../client';
2
+ /**
3
+ * Gets the effective RPC propagation setting, handling deprecation of `instrumentPrototypeMethods`.
4
+ *
5
+ * Priority:
6
+ * 1. If `enableRpcTracePropagation` is set, use it (ignore `instrumentPrototypeMethods`)
7
+ * 2. If only `instrumentPrototypeMethods` is set, use it with deprecation warning (converted to boolean)
8
+ * 3. If neither is set, return `false`
9
+ *
10
+ * @returns The effective setting for RPC trace propagation
11
+ */
12
+ export declare function getEffectiveRpcPropagation(options: CloudflareOptions): boolean;
13
+ /**
14
+ * Gets the method filter for prototype method instrumentation.
15
+ *
16
+ * Returns:
17
+ * - `null` if no instrumentation should occur
18
+ * - `true` if all methods should be instrumented
19
+ * - `string[]` if only specific methods should be instrumented (deprecated behavior)
20
+ *
21
+ * @returns The method filter or null if no instrumentation
22
+ */
23
+ export declare function getPrototypeMethodFilter(options: CloudflareOptions): boolean | string[];
24
+ //# sourceMappingURL=rpcOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpcOptions.d.ts","sourceRoot":"","sources":["../../../src/utils/rpcOptions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGnD;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CA8B9E;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,GAAG,MAAM,EAAE,CAsBvF"}
@@ -0,0 +1,27 @@
1
+ import type { DurableObjectStorage } from '@cloudflare/workers-types';
2
+ import type { SpanLink } from '@sentry/core';
3
+ /** Stored span context for creating span links */
4
+ export interface StoredSpanContext {
5
+ traceId: string;
6
+ spanId: string;
7
+ sampled: boolean;
8
+ }
9
+ /**
10
+ * Gets the storage key for a specific method's trace link.
11
+ */
12
+ export declare function getTraceLinkKey(methodName: string): string;
13
+ /**
14
+ * Stores the current span context in Durable Object storage for trace linking.
15
+ * Uses the original uninstrumented storage to avoid creating spans for internal operations.
16
+ * Errors are silently ignored to prevent internal storage failures from propagating to user code.
17
+ */
18
+ export declare function storeSpanContext(originalStorage: DurableObjectStorage, methodName: string): Promise<void>;
19
+ /**
20
+ * Retrieves a stored span context from Durable Object storage.
21
+ */
22
+ export declare function getStoredSpanContext(originalStorage: DurableObjectStorage, methodName: string): Promise<StoredSpanContext | undefined>;
23
+ /**
24
+ * Builds span links from a stored span context.
25
+ */
26
+ export declare function buildSpanLinks(storedContext: StoredSpanContext): SpanLink[];
27
+ //# sourceMappingURL=traceLinks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traceLinks.d.ts","sourceRoot":"","sources":["../../../src/utils/traceLinks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAO7C,kDAAkD;AAClD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,eAAe,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB/G;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,eAAe,EAAE,oBAAoB,EACrC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAMxC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,aAAa,EAAE,iBAAiB,GAAG,QAAQ,EAAE,CAa3E"}
@@ -1,5 +1,6 @@
1
- import type { env } from 'cloudflare:workers';
1
+ import type { env as cloudflareEnv } from 'cloudflare:workers';
2
2
  import type { CloudflareOptions } from './client';
3
+ import { type WorkerEntrypointConstructor } from './instrumentations/instrumentWorkerEntrypoint';
3
4
  /**
4
5
  * Wrapper for Cloudflare handlers.
5
6
  *
@@ -11,5 +12,5 @@ import type { CloudflareOptions } from './client';
11
12
  * @param handler {ExportedHandler} The handler to wrap.
12
13
  * @returns The wrapped handler.
13
14
  */
14
- export declare function withSentry<Env = typeof env, QueueHandlerMessage = unknown, CfHostMetadata = unknown, T extends ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata> = ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata>>(optionsCallback: (env: Env) => CloudflareOptions | undefined, handler: T): T;
15
+ export declare function withSentry<Env = typeof cloudflareEnv, QueueHandlerMessage = unknown, CfHostMetadata = unknown, T extends ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata> | WorkerEntrypointConstructor = ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata>>(optionsCallback: (env: Env) => CloudflareOptions | undefined, handler: T): T;
15
16
  //# sourceMappingURL=withSentry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withSentry.d.ts","sourceRoot":"","sources":["../../src/withSentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AASlD;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACxB,GAAG,GAAG,OAAO,GAAG,EAChB,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,CAgB7E"}
1
+ {"version":3,"file":"withSentry.d.ts","sourceRoot":"","sources":["../../src/withSentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AASlD,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,+CAA+C,CAAC;AAEvD;;;;;;;;;;GAUG;AAGH,wBAAgB,UAAU,CACxB,GAAG,GAAG,OAAO,aAAa,EAC1B,mBAAmB,GAAG,OAAO,EAC7B,cAAc,GAAG,OAAO,EACxB,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,mBAAmB,EAAE,cAAc,CAAC,GAAG,2BAA2B,GAAG,eAAe,CACjH,GAAG,EACH,mBAAmB,EACnB,cAAc,CACf,EACD,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,iBAAiB,GAAG,SAAS,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CA0B7E"}
@@ -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;AAQlD;;GAEG;AACH,wBAAsB,kCAAkC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAS5F;AAiGD;;;;;;;;;;;;;;;;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
+ {"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;AASlD;;GAEG;AACH,wBAAsB,kCAAkC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAS5F;AAiGD;;;;;;;;;;;;;;;;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,14 +1,31 @@
1
+ import type { DurableObjectStorage } from '@cloudflare/workers-types';
1
2
  import type { CloudflareOptions } from './client';
3
+ /** Extended DurableObjectState with originalStorage exposed by instrumentContext */
4
+ interface InstrumentedDurableObjectState extends DurableObjectState {
5
+ originalStorage?: DurableObjectStorage;
6
+ }
2
7
  type MethodWrapperOptions = {
3
8
  spanName?: string;
4
9
  spanOp?: string;
5
10
  options: CloudflareOptions;
6
- context: ExecutionContext | DurableObjectState;
11
+ context: ExecutionContext | InstrumentedDurableObjectState;
12
+ /**
13
+ * If true, starts a fresh trace instead of inheriting from a parent trace.
14
+ * Useful for scheduled/independent invocations like alarms.
15
+ *
16
+ * If true, it also stores the current span context and links to the previous invocation's span.
17
+ * Uses Durable Object storage to persist the link. The link is set asynchronously via `span.addLinks()`
18
+ * in a `waitUntil` to avoid blocking.
19
+ *
20
+ * @default false
21
+ */
22
+ startNewTrace?: boolean;
7
23
  };
8
24
  export type UncheckedMethod = (...args: any[]) => any;
9
25
  type OriginalMethod = UncheckedMethod;
10
26
  /**
11
- * Wraps a method with Sentry tracing.
27
+ * Wraps a method with Sentry error tracking and optional tracing.
28
+ * Supports starting new traces and linking to previous invocations via Durable Object storage.
12
29
  *
13
30
  * @param wrapperOptions - The options for the wrapper.
14
31
  * @param handler - The method to wrap.
@@ -1 +1 @@
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,CA2HH"}
1
+ {"version":3,"file":"wrapMethodWithSentry.d.ts","sourceRoot":"","sources":["../../src/wrapMethodWithSentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAatE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAMlD,oFAAoF;AACpF,UAAU,8BAA+B,SAAQ,kBAAkB;IACjE,eAAe,CAAC,EAAE,oBAAoB,CAAC;CACxC;AAED,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,8BAA8B,CAAC;IAC3D;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAGF,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AACtD,KAAK,cAAc,GAAG,eAAe,CAAC;AAEtC;;;;;;;;;GASG;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,CAsKH"}
@@ -65,26 +65,55 @@ interface BaseCloudflareOptions {
65
65
  */
66
66
  skipOpenTelemetrySetup?: boolean;
67
67
  /**
68
- * Enable instrumentation of prototype methods for DurableObjects.
68
+ * Enable trace propagation for RPC calls between Workers, Durable Objects, and Service Bindings.
69
69
  *
70
- * When `true`, the SDK will wrap all methods on the DurableObject prototype chain
71
- * to automatically create spans and capture errors for RPC method calls.
70
+ * When enabled, trace context (sentry-trace + baggage) is propagated across:
71
+ * - `stub.fetch()` calls to Durable Objects (via HTTP headers)
72
+ * - Service binding `fetch()` calls (via HTTP headers)
73
+ * - RPC method calls to Durable Objects (via trailing argument)
72
74
  *
73
- * When an array of strings is provided, only the specified method names will be instrumented.
75
+ * When enabled on the **receiver side** (DurableObject), the SDK will also:
76
+ * - Extract and continue traces from incoming RPC calls
77
+ * - Create spans for each RPC method invocation
78
+ * - Capture errors thrown by RPC methods
74
79
  *
75
- * This feature adds runtime overhead as it wraps methods at the prototype level.
76
- * Only enable this if you need automatic instrumentation of prototype methods.
80
+ * **Important:** This option should be enabled on **both sides** for full trace propagation.
77
81
  *
78
82
  * @default false
79
83
  * @example
80
84
  * ```ts
81
- * // Instrument all prototype methods
82
- * instrumentPrototypeMethods: true
85
+ * // Worker side (caller)
86
+ * export default Sentry.withSentry(
87
+ * (env) => ({
88
+ * dsn: env.SENTRY_DSN,
89
+ * enableRpcTracePropagation: true,
90
+ * }),
91
+ * handler,
92
+ * );
83
93
  *
84
- * // Instrument only specific methods
85
- * instrumentPrototypeMethods: ['myMethod', 'anotherMethod']
94
+ * // Durable Object side (receiver)
95
+ * export const MyDO = Sentry.instrumentDurableObjectWithSentry(
96
+ * (env) => ({
97
+ * dsn: env.SENTRY_DSN,
98
+ * enableRpcTracePropagation: true,
99
+ * }),
100
+ * MyDOBase,
101
+ * );
86
102
  * ```
87
103
  */
104
+ enableRpcTracePropagation?: boolean;
105
+ /**
106
+ * @deprecated Use `enableRpcTracePropagation` instead. This option will be removed in a future major version.
107
+ *
108
+ * Enable instrumentation of prototype methods for DurableObjects.
109
+ *
110
+ * When `true`, the SDK will wrap all methods on the DurableObject prototype chain
111
+ * to automatically create spans and capture errors for RPC method calls.
112
+ *
113
+ * When an array of strings is provided, only the specified method names will be instrumented.
114
+ *
115
+ * @default false
116
+ */
88
117
  instrumentPrototypeMethods?: boolean | string[];
89
118
  }
90
119
  /**
@@ -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, setConversationId, 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';
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, setConversationId, 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, instrumentLangChainEmbeddings, featureFlagsIntegration, growthbookIntegration, logger, metrics, withStreamedSpan, spanStreamingIntegration, instrumentLangGraph, } from '@sentry/core';
4
4
  export { withSentry } from './withSentry';
5
5
  export { instrumentDurableObjectWithSentry } from './durableobject';
6
6
  export { sentryPagesPlugin } from './pages-plugin';
@@ -1,9 +1,20 @@
1
1
  /**
2
- * Mark an object as instrumented.
2
+ * Mark an object as instrumented, storing the instrumented version.
3
+ * @param original The original uninstrumented object
4
+ * @param instrumented The instrumented version (defaults to original if not provided)
3
5
  */
4
- export declare function markAsInstrumented<T>(obj: T): void;
6
+ export declare function markAsInstrumented<T>(original: T, instrumented?: T): void;
5
7
  /**
6
- * Check if an object is instrumented.
8
+ * Get the instrumented version of an object, if available.
9
+ * Returns the instrumented version if the object was previously instrumented,
10
+ * or undefined if not found.
7
11
  */
8
- export declare function isInstrumented<T>(obj: T): boolean | undefined;
12
+ export declare function getInstrumented<T>(obj: T): T | undefined;
13
+ /**
14
+ * Returns the already-instrumented version of `original` if one exists,
15
+ * otherwise calls `instrumentFn` to create it, marks the mapping, and returns it.
16
+ *
17
+ * @param noMark - If true, skips storing the original→instrumented mapping.
18
+ */
19
+ export declare function ensureInstrumented<T>(original: T, instrumentFn: (original: T) => T, noMark?: boolean): T;
9
20
  //# sourceMappingURL=instrument.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { DurableObjectNamespace } from '@cloudflare/workers-types';
2
+ /**
3
+ * Instruments a DurableObjectNamespace binding to create spans for DO interactions.
4
+ *
5
+ * Wraps:
6
+ * - `namespace.get(id)` / `namespace.getByName(name)` with a span + instruments returned stub
7
+ * - `namespace.idFromName(name)` / `namespace.idFromString(id)` / `namespace.newUniqueId()` with breadcrumbs
8
+ *
9
+ * @param namespace - The DurableObjectNamespace to instrument
10
+ */
11
+ export declare function instrumentDurableObjectNamespace(namespace: DurableObjectNamespace): DurableObjectNamespace;
12
+ //# sourceMappingURL=instrumentDurableObjectNamespace.d.ts.map
@@ -1,12 +1,19 @@
1
1
  import { DurableObjectStorage } from '@cloudflare/workers-types';
2
+ type WaitUntil = (promise: Promise<unknown>) => void;
2
3
  /**
3
4
  * Instruments DurableObjectStorage methods with Sentry spans.
4
5
  *
5
6
  * Wraps the following async methods:
6
7
  * - get, put, delete, list (KV API)
8
+ * - setAlarm, getAlarm, deleteAlarm (Alarm API)
9
+ *
10
+ * When setAlarm is called, it also stores the current span context so that when
11
+ * the alarm fires later, it can link back to the trace that called setAlarm.
7
12
  *
8
13
  * @param storage - The DurableObjectStorage instance to instrument
14
+ * @param waitUntil - Optional waitUntil function to defer span context storage
9
15
  * @returns An instrumented DurableObjectStorage instance
10
16
  */
11
- export declare function instrumentDurableObjectStorage(storage: DurableObjectStorage): DurableObjectStorage;
17
+ export declare function instrumentDurableObjectStorage(storage: DurableObjectStorage, waitUntil?: WaitUntil): DurableObjectStorage;
18
+ export {};
12
19
  //# sourceMappingURL=instrumentDurableObjectStorage.d.ts.map
@@ -0,0 +1,42 @@
1
+ import { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
2
+ import { CloudflareOptions } from '../client';
3
+ export type WorkerEntrypointConstructor<Env = typeof cloudflareEnv, Props = {}> = new (ctx: ExecutionContext, env: typeof cloudflareEnv) => InstanceType<typeof WorkerEntrypoint<Env, Props>>;
4
+ /**
5
+ * Instruments a WorkerEntrypoint class to capture errors and performance data.
6
+ *
7
+ * Instruments the following methods (same as `withSentry` for ExportedHandler):
8
+ * - fetch (HTTP requests)
9
+ * - scheduled (cron triggers)
10
+ * - queue (queue consumers)
11
+ * - email (email handlers)
12
+ * - tail (tail workers)
13
+ *
14
+ * as well as any other public RPC methods on the WorkerEntrypoint instance.
15
+ *
16
+ * @param optionsCallback Function that returns the options for the SDK initialization.
17
+ * @param WorkerEntrypointClass The WorkerEntrypoint class to instrument.
18
+ * @returns The instrumented WorkerEntrypoint class.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * class MyWorkerBase extends WorkerEntrypoint<Env> {
23
+ * async fetch(request: Request): Promise<Response> {
24
+ * return new Response('Hello World!');
25
+ * }
26
+ *
27
+ * async myRpcMethod(arg: string): Promise<string> {
28
+ * return `Hello ${arg}!`;
29
+ * }
30
+ * }
31
+ *
32
+ * export default instrumentWorkerEntrypoint(
33
+ * env => ({
34
+ * dsn: env.SENTRY_DSN,
35
+ * tracesSampleRate: 1.0,
36
+ * }),
37
+ * MyWorkerBase,
38
+ * );
39
+ * ```
40
+ */
41
+ export declare function instrumentWorkerEntrypoint<T extends WorkerEntrypointConstructor>(optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined, WorkerEntrypointClass: T): T;
42
+ //# sourceMappingURL=instrumentWorkerEntrypoint.d.ts.map
@@ -1,7 +1,8 @@
1
1
  import { ExportedHandler } from '@cloudflare/workers-types';
2
+ import { env as cloudflareEnv } from 'cloudflare:workers';
2
3
  import { CloudflareOptions } from '../../client';
3
4
  /**
4
5
  * Instruments an email handler for ExportedHandler (env/ctx come from args).
5
6
  */
6
- export declare function instrumentExportedHandlerEmail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: Parameters<NonNullable<T['email']>>[1]) => CloudflareOptions | undefined): void;
7
+ export declare function instrumentExportedHandlerEmail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined): void;
7
8
  //# sourceMappingURL=instrumentEmail.d.ts.map