@sentry/cloudflare 11.12.0 → 11.13.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/dev/_virtual/_rolldown/runtime.js +22 -0
- package/build/cjs/dev/baseSdk.js +98 -103
- package/build/cjs/dev/baseSdk.js.map +1 -1
- package/build/cjs/dev/client.js +213 -237
- package/build/cjs/dev/client.js.map +1 -1
- package/build/cjs/dev/clientCache.js +8 -8
- package/build/cjs/dev/clientCache.js.map +1 -1
- package/build/cjs/dev/debug-build.js +9 -5
- package/build/cjs/dev/debug-build.js.map +1 -1
- package/build/cjs/dev/defineCloudflareOptions.js +5 -8
- package/build/cjs/dev/defineCloudflareOptions.js.map +1 -1
- package/build/cjs/dev/durableobject.js +287 -176
- package/build/cjs/dev/durableobject.js.map +1 -1
- package/build/cjs/dev/flush.js +104 -77
- package/build/cjs/dev/flush.js.map +1 -1
- package/build/cjs/dev/index.js +181 -182
- package/build/cjs/dev/instrument.js +53 -39
- package/build/cjs/dev/instrument.js.map +1 -1
- package/build/cjs/dev/instrumentations/agents/index.js +34 -13
- package/build/cjs/dev/instrumentations/agents/index.js.map +1 -1
- package/build/cjs/dev/instrumentations/agents/instrumentAgentCallableRpc.js +46 -49
- package/build/cjs/dev/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -1
- package/build/cjs/dev/instrumentations/agents/instrumentAgentRequestConversation.js +23 -16
- package/build/cjs/dev/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -1
- package/build/cjs/dev/instrumentations/agents/instrumentChatAgentConversation.js +36 -28
- package/build/cjs/dev/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -1
- package/build/cjs/dev/instrumentations/agents/types.js +103 -58
- package/build/cjs/dev/instrumentations/agents/types.js.map +1 -1
- package/build/cjs/dev/instrumentations/instrumentDurableObjectHandlers.js +87 -118
- package/build/cjs/dev/instrumentations/instrumentDurableObjectHandlers.js.map +1 -1
- package/build/cjs/dev/instrumentations/instrumentDurableObjectNamespace.js +46 -44
- package/build/cjs/dev/instrumentations/instrumentDurableObjectNamespace.js.map +1 -1
- package/build/cjs/dev/instrumentations/instrumentDurableObjectStorage.js +70 -71
- package/build/cjs/dev/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
- package/build/cjs/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js +31 -39
- package/build/cjs/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -1
- package/build/cjs/dev/instrumentations/instrumentSqlStorage.js +50 -52
- package/build/cjs/dev/instrumentations/instrumentSqlStorage.js.map +1 -1
- package/build/cjs/dev/instrumentations/instrumentWorkerEntrypoint.js +136 -123
- package/build/cjs/dev/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
- package/build/cjs/dev/instrumentations/worker/instrumentD1.js +131 -146
- package/build/cjs/dev/instrumentations/worker/instrumentD1.js.map +1 -1
- package/build/cjs/dev/instrumentations/worker/instrumentEmail.js +63 -61
- package/build/cjs/dev/instrumentations/worker/instrumentEmail.js.map +1 -1
- package/build/cjs/dev/instrumentations/worker/instrumentEnv.js +83 -88
- package/build/cjs/dev/instrumentations/worker/instrumentEnv.js.map +1 -1
- package/build/cjs/dev/instrumentations/worker/instrumentFetch.js +41 -48
- package/build/cjs/dev/instrumentations/worker/instrumentFetch.js.map +1 -1
- package/build/cjs/dev/instrumentations/worker/instrumentFetcher.js +25 -21
- package/build/cjs/dev/instrumentations/worker/instrumentFetcher.js.map +1 -1
- package/build/cjs/dev/instrumentations/worker/instrumentKV.js +54 -67
- package/build/cjs/dev/instrumentations/worker/instrumentKV.js.map +1 -1
- package/build/cjs/dev/instrumentations/worker/instrumentQueue.js +98 -105
- package/build/cjs/dev/instrumentations/worker/instrumentQueue.js.map +1 -1
- package/build/cjs/dev/instrumentations/worker/instrumentQueueProducer.js +88 -94
- package/build/cjs/dev/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
- package/build/cjs/dev/instrumentations/worker/instrumentR2.js +128 -115
- package/build/cjs/dev/instrumentations/worker/instrumentR2.js.map +1 -1
- package/build/cjs/dev/instrumentations/worker/instrumentScheduled.js +90 -94
- package/build/cjs/dev/instrumentations/worker/instrumentScheduled.js.map +1 -1
- package/build/cjs/dev/instrumentations/worker/instrumentTail.js +100 -55
- package/build/cjs/dev/instrumentations/worker/instrumentTail.js.map +1 -1
- package/build/cjs/dev/integrations/cronTriggers.js +130 -85
- package/build/cjs/dev/integrations/cronTriggers.js.map +1 -1
- package/build/cjs/dev/integrations/fetch.js +9 -9
- package/build/cjs/dev/integrations/fetch.js.map +1 -1
- package/build/cjs/dev/integrations/httpServer.js +41 -22
- package/build/cjs/dev/integrations/httpServer.js.map +1 -1
- package/build/cjs/dev/integrations/spotlight.js +52 -55
- package/build/cjs/dev/integrations/spotlight.js.map +1 -1
- package/build/cjs/dev/opentelemetry/tracer.js +10 -8
- package/build/cjs/dev/opentelemetry/tracer.js.map +1 -1
- package/build/cjs/dev/options.js +55 -39
- package/build/cjs/dev/options.js.map +1 -1
- package/build/cjs/dev/orchestrion-deferred-channels.js +45 -29
- package/build/cjs/dev/orchestrion-deferred-channels.js.map +1 -1
- package/build/cjs/dev/orchestrion-diagnostics-channel.js +97 -72
- package/build/cjs/dev/orchestrion-diagnostics-channel.js.map +1 -1
- package/build/cjs/dev/pages-plugin.js +20 -21
- package/build/cjs/dev/pages-plugin.js.map +1 -1
- package/build/cjs/dev/request.js +16 -10
- package/build/cjs/dev/request.js.map +1 -1
- package/build/cjs/dev/scope-utils.js +12 -12
- package/build/cjs/dev/scope-utils.js.map +1 -1
- package/build/cjs/dev/sdk.js +24 -15
- package/build/cjs/dev/sdk.js.map +1 -1
- package/build/cjs/dev/transport.js +93 -86
- package/build/cjs/dev/transport.js.map +1 -1
- package/build/cjs/dev/utils/asyncContextStrategy.js +10 -10
- package/build/cjs/dev/utils/asyncContextStrategy.js.map +1 -1
- package/build/cjs/dev/utils/bindingPropagation.js +17 -11
- package/build/cjs/dev/utils/bindingPropagation.js.map +1 -1
- package/build/cjs/dev/utils/cloudflareTrace.js +34 -0
- package/build/cjs/dev/utils/cloudflareTrace.js.map +1 -0
- package/build/cjs/dev/utils/instrumentContext.js +74 -58
- package/build/cjs/dev/utils/instrumentContext.js.map +1 -1
- package/build/cjs/dev/utils/internalSqlQuery.js +38 -21
- package/build/cjs/dev/utils/internalSqlQuery.js.map +1 -1
- package/build/cjs/dev/utils/internalStorageKey.js +41 -38
- package/build/cjs/dev/utils/internalStorageKey.js.map +1 -1
- package/build/cjs/dev/utils/invocationContext.js +42 -32
- package/build/cjs/dev/utils/invocationContext.js.map +1 -1
- package/build/cjs/dev/utils/invocationScope.js +45 -21
- package/build/cjs/dev/utils/invocationScope.js.map +1 -1
- package/build/cjs/dev/utils/isBinding.js +47 -15
- package/build/cjs/dev/utils/isBinding.js.map +1 -1
- package/build/cjs/dev/utils/isCloudflareClass.js +11 -20
- package/build/cjs/dev/utils/isCloudflareClass.js.map +1 -1
- package/build/cjs/dev/utils/queueTraceMeta.js +24 -35
- package/build/cjs/dev/utils/queueTraceMeta.js.map +1 -1
- package/build/cjs/dev/utils/rpcMeta.js +37 -27
- package/build/cjs/dev/utils/rpcMeta.js.map +1 -1
- package/build/cjs/dev/utils/traceLinks.js +52 -42
- package/build/cjs/dev/utils/traceLinks.js.map +1 -1
- package/build/cjs/dev/vendor/stacktrace.js +32 -24
- package/build/cjs/dev/vendor/stacktrace.js.map +1 -1
- package/build/cjs/dev/vite/agentClass.js +105 -98
- package/build/cjs/dev/vite/agentClass.js.map +1 -1
- package/build/cjs/dev/vite/autoInstrument.js +121 -122
- package/build/cjs/dev/vite/autoInstrument.js.map +1 -1
- package/build/cjs/dev/vite/index.js +44 -21
- package/build/cjs/dev/vite/index.js.map +1 -1
- package/build/cjs/dev/vite/instrumentFile.js +37 -20
- package/build/cjs/dev/vite/instrumentFile.js.map +1 -1
- package/build/cjs/dev/vite/mastraObservability.js +19 -12
- package/build/cjs/dev/vite/mastraObservability.js.map +1 -1
- package/build/cjs/dev/vite/moduleShape.js +220 -201
- package/build/cjs/dev/vite/moduleShape.js.map +1 -1
- package/build/cjs/dev/vite/providedModulePlugin.js +62 -45
- package/build/cjs/dev/vite/providedModulePlugin.js.map +1 -1
- package/build/cjs/dev/vite/transform.js +333 -284
- package/build/cjs/dev/vite/transform.js.map +1 -1
- package/build/cjs/dev/vite/workerEntrypoint.js +66 -57
- package/build/cjs/dev/vite/workerEntrypoint.js.map +1 -1
- package/build/cjs/dev/vite/wranglerConfig.js +92 -67
- package/build/cjs/dev/vite/wranglerConfig.js.map +1 -1
- package/build/cjs/dev/withSentry.js +32 -26
- package/build/cjs/dev/withSentry.js.map +1 -1
- package/build/cjs/dev/workflows.js +164 -151
- package/build/cjs/dev/workflows.js.map +1 -1
- package/build/cjs/dev/wrapMethodWithSentry.js +148 -169
- package/build/cjs/dev/wrapMethodWithSentry.js.map +1 -1
- package/build/cjs/dev/wrapRequestHandlerWithInit.js +76 -78
- package/build/cjs/dev/wrapRequestHandlerWithInit.js.map +1 -1
- package/build/cjs/prod/_virtual/_rolldown/runtime.js +22 -0
- package/build/cjs/prod/baseSdk.js +94 -93
- package/build/cjs/prod/baseSdk.js.map +1 -1
- package/build/cjs/prod/client.js +213 -237
- package/build/cjs/prod/client.js.map +1 -1
- package/build/cjs/prod/clientCache.js +8 -8
- package/build/cjs/prod/clientCache.js.map +1 -1
- package/build/cjs/prod/debug-build.js +9 -5
- package/build/cjs/prod/debug-build.js.map +1 -1
- package/build/cjs/prod/defineCloudflareOptions.js +5 -8
- package/build/cjs/prod/defineCloudflareOptions.js.map +1 -1
- package/build/cjs/prod/durableobject.js +287 -176
- package/build/cjs/prod/durableobject.js.map +1 -1
- package/build/cjs/prod/flush.js +104 -77
- package/build/cjs/prod/flush.js.map +1 -1
- package/build/cjs/prod/index.js +181 -182
- package/build/cjs/prod/instrument.js +53 -39
- package/build/cjs/prod/instrument.js.map +1 -1
- package/build/cjs/prod/instrumentations/agents/index.js +34 -13
- package/build/cjs/prod/instrumentations/agents/index.js.map +1 -1
- package/build/cjs/prod/instrumentations/agents/instrumentAgentCallableRpc.js +46 -49
- package/build/cjs/prod/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -1
- package/build/cjs/prod/instrumentations/agents/instrumentAgentRequestConversation.js +23 -16
- package/build/cjs/prod/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -1
- package/build/cjs/prod/instrumentations/agents/instrumentChatAgentConversation.js +36 -28
- package/build/cjs/prod/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -1
- package/build/cjs/prod/instrumentations/agents/types.js +103 -58
- package/build/cjs/prod/instrumentations/agents/types.js.map +1 -1
- package/build/cjs/prod/instrumentations/instrumentDurableObjectHandlers.js +87 -118
- package/build/cjs/prod/instrumentations/instrumentDurableObjectHandlers.js.map +1 -1
- package/build/cjs/prod/instrumentations/instrumentDurableObjectNamespace.js +46 -44
- package/build/cjs/prod/instrumentations/instrumentDurableObjectNamespace.js.map +1 -1
- package/build/cjs/prod/instrumentations/instrumentDurableObjectStorage.js +70 -71
- package/build/cjs/prod/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
- package/build/cjs/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js +31 -39
- package/build/cjs/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -1
- package/build/cjs/prod/instrumentations/instrumentSqlStorage.js +50 -52
- package/build/cjs/prod/instrumentations/instrumentSqlStorage.js.map +1 -1
- package/build/cjs/prod/instrumentations/instrumentWorkerEntrypoint.js +136 -123
- package/build/cjs/prod/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
- package/build/cjs/prod/instrumentations/worker/instrumentD1.js +131 -146
- package/build/cjs/prod/instrumentations/worker/instrumentD1.js.map +1 -1
- package/build/cjs/prod/instrumentations/worker/instrumentEmail.js +63 -61
- package/build/cjs/prod/instrumentations/worker/instrumentEmail.js.map +1 -1
- package/build/cjs/prod/instrumentations/worker/instrumentEnv.js +83 -88
- package/build/cjs/prod/instrumentations/worker/instrumentEnv.js.map +1 -1
- package/build/cjs/prod/instrumentations/worker/instrumentFetch.js +41 -48
- package/build/cjs/prod/instrumentations/worker/instrumentFetch.js.map +1 -1
- package/build/cjs/prod/instrumentations/worker/instrumentFetcher.js +25 -21
- package/build/cjs/prod/instrumentations/worker/instrumentFetcher.js.map +1 -1
- package/build/cjs/prod/instrumentations/worker/instrumentKV.js +54 -67
- package/build/cjs/prod/instrumentations/worker/instrumentKV.js.map +1 -1
- package/build/cjs/prod/instrumentations/worker/instrumentQueue.js +98 -105
- package/build/cjs/prod/instrumentations/worker/instrumentQueue.js.map +1 -1
- package/build/cjs/prod/instrumentations/worker/instrumentQueueProducer.js +88 -94
- package/build/cjs/prod/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
- package/build/cjs/prod/instrumentations/worker/instrumentR2.js +128 -115
- package/build/cjs/prod/instrumentations/worker/instrumentR2.js.map +1 -1
- package/build/cjs/prod/instrumentations/worker/instrumentScheduled.js +90 -94
- package/build/cjs/prod/instrumentations/worker/instrumentScheduled.js.map +1 -1
- package/build/cjs/prod/instrumentations/worker/instrumentTail.js +100 -55
- package/build/cjs/prod/instrumentations/worker/instrumentTail.js.map +1 -1
- package/build/cjs/prod/integrations/cronTriggers.js +130 -85
- package/build/cjs/prod/integrations/cronTriggers.js.map +1 -1
- package/build/cjs/prod/integrations/fetch.js +9 -9
- package/build/cjs/prod/integrations/fetch.js.map +1 -1
- package/build/cjs/prod/integrations/httpServer.js +41 -22
- package/build/cjs/prod/integrations/httpServer.js.map +1 -1
- package/build/cjs/prod/integrations/spotlight.js +52 -55
- package/build/cjs/prod/integrations/spotlight.js.map +1 -1
- package/build/cjs/prod/opentelemetry/tracer.js +10 -8
- package/build/cjs/prod/opentelemetry/tracer.js.map +1 -1
- package/build/cjs/prod/options.js +37 -24
- package/build/cjs/prod/options.js.map +1 -1
- package/build/cjs/prod/orchestrion-deferred-channels.js +45 -29
- package/build/cjs/prod/orchestrion-deferred-channels.js.map +1 -1
- package/build/cjs/prod/orchestrion-diagnostics-channel.js +97 -72
- package/build/cjs/prod/orchestrion-diagnostics-channel.js.map +1 -1
- package/build/cjs/prod/pages-plugin.js +20 -21
- package/build/cjs/prod/pages-plugin.js.map +1 -1
- package/build/cjs/prod/request.js +16 -10
- package/build/cjs/prod/request.js.map +1 -1
- package/build/cjs/prod/scope-utils.js +12 -12
- package/build/cjs/prod/scope-utils.js.map +1 -1
- package/build/cjs/prod/sdk.js +24 -15
- package/build/cjs/prod/sdk.js.map +1 -1
- package/build/cjs/prod/transport.js +93 -86
- package/build/cjs/prod/transport.js.map +1 -1
- package/build/cjs/prod/utils/asyncContextStrategy.js +10 -10
- package/build/cjs/prod/utils/asyncContextStrategy.js.map +1 -1
- package/build/cjs/prod/utils/bindingPropagation.js +17 -11
- package/build/cjs/prod/utils/bindingPropagation.js.map +1 -1
- package/build/cjs/prod/utils/cloudflareTrace.js +34 -0
- package/build/cjs/prod/utils/cloudflareTrace.js.map +1 -0
- package/build/cjs/prod/utils/instrumentContext.js +74 -58
- package/build/cjs/prod/utils/instrumentContext.js.map +1 -1
- package/build/cjs/prod/utils/internalSqlQuery.js +38 -21
- package/build/cjs/prod/utils/internalSqlQuery.js.map +1 -1
- package/build/cjs/prod/utils/internalStorageKey.js +41 -38
- package/build/cjs/prod/utils/internalStorageKey.js.map +1 -1
- package/build/cjs/prod/utils/invocationContext.js +42 -32
- package/build/cjs/prod/utils/invocationContext.js.map +1 -1
- package/build/cjs/prod/utils/invocationScope.js +45 -21
- package/build/cjs/prod/utils/invocationScope.js.map +1 -1
- package/build/cjs/prod/utils/isBinding.js +47 -15
- package/build/cjs/prod/utils/isBinding.js.map +1 -1
- package/build/cjs/prod/utils/isCloudflareClass.js +11 -20
- package/build/cjs/prod/utils/isCloudflareClass.js.map +1 -1
- package/build/cjs/prod/utils/queueTraceMeta.js +24 -35
- package/build/cjs/prod/utils/queueTraceMeta.js.map +1 -1
- package/build/cjs/prod/utils/rpcMeta.js +37 -27
- package/build/cjs/prod/utils/rpcMeta.js.map +1 -1
- package/build/cjs/prod/utils/traceLinks.js +52 -42
- package/build/cjs/prod/utils/traceLinks.js.map +1 -1
- package/build/cjs/prod/vendor/stacktrace.js +32 -24
- package/build/cjs/prod/vendor/stacktrace.js.map +1 -1
- package/build/cjs/prod/vite/agentClass.js +105 -98
- package/build/cjs/prod/vite/agentClass.js.map +1 -1
- package/build/cjs/prod/vite/autoInstrument.js +121 -122
- package/build/cjs/prod/vite/autoInstrument.js.map +1 -1
- package/build/cjs/prod/vite/index.js +44 -21
- package/build/cjs/prod/vite/index.js.map +1 -1
- package/build/cjs/prod/vite/instrumentFile.js +37 -20
- package/build/cjs/prod/vite/instrumentFile.js.map +1 -1
- package/build/cjs/prod/vite/mastraObservability.js +19 -12
- package/build/cjs/prod/vite/mastraObservability.js.map +1 -1
- package/build/cjs/prod/vite/moduleShape.js +220 -201
- package/build/cjs/prod/vite/moduleShape.js.map +1 -1
- package/build/cjs/prod/vite/providedModulePlugin.js +62 -45
- package/build/cjs/prod/vite/providedModulePlugin.js.map +1 -1
- package/build/cjs/prod/vite/transform.js +333 -284
- package/build/cjs/prod/vite/transform.js.map +1 -1
- package/build/cjs/prod/vite/workerEntrypoint.js +66 -57
- package/build/cjs/prod/vite/workerEntrypoint.js.map +1 -1
- package/build/cjs/prod/vite/wranglerConfig.js +92 -67
- package/build/cjs/prod/vite/wranglerConfig.js.map +1 -1
- package/build/cjs/prod/withSentry.js +32 -26
- package/build/cjs/prod/withSentry.js.map +1 -1
- package/build/cjs/prod/workflows.js +164 -151
- package/build/cjs/prod/workflows.js.map +1 -1
- package/build/cjs/prod/wrapMethodWithSentry.js +148 -169
- package/build/cjs/prod/wrapMethodWithSentry.js.map +1 -1
- package/build/cjs/prod/wrapRequestHandlerWithInit.js +76 -78
- package/build/cjs/prod/wrapRequestHandlerWithInit.js.map +1 -1
- package/build/esm/dev/baseSdk.js +98 -101
- package/build/esm/dev/baseSdk.js.map +1 -1
- package/build/esm/dev/client.js +213 -235
- package/build/esm/dev/client.js.map +1 -1
- package/build/esm/dev/clientCache.js +8 -6
- package/build/esm/dev/clientCache.js.map +1 -1
- package/build/esm/dev/debug-build.js +9 -3
- package/build/esm/dev/debug-build.js.map +1 -1
- package/build/esm/dev/defineCloudflareOptions.js +5 -6
- package/build/esm/dev/defineCloudflareOptions.js.map +1 -1
- package/build/esm/dev/durableobject.js +287 -174
- package/build/esm/dev/durableobject.js.map +1 -1
- package/build/esm/dev/flush.js +104 -75
- package/build/esm/dev/flush.js.map +1 -1
- package/build/esm/dev/index.js +19 -18
- package/build/esm/dev/instrument.js +53 -37
- package/build/esm/dev/instrument.js.map +1 -1
- package/build/esm/dev/instrumentations/agents/index.js +34 -11
- package/build/esm/dev/instrumentations/agents/index.js.map +1 -1
- package/build/esm/dev/instrumentations/agents/instrumentAgentCallableRpc.js +46 -47
- package/build/esm/dev/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -1
- package/build/esm/dev/instrumentations/agents/instrumentAgentRequestConversation.js +23 -14
- package/build/esm/dev/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -1
- package/build/esm/dev/instrumentations/agents/instrumentChatAgentConversation.js +36 -26
- package/build/esm/dev/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -1
- package/build/esm/dev/instrumentations/agents/types.js +103 -56
- package/build/esm/dev/instrumentations/agents/types.js.map +1 -1
- package/build/esm/dev/instrumentations/instrumentDurableObjectHandlers.js +87 -116
- package/build/esm/dev/instrumentations/instrumentDurableObjectHandlers.js.map +1 -1
- package/build/esm/dev/instrumentations/instrumentDurableObjectNamespace.js +46 -42
- package/build/esm/dev/instrumentations/instrumentDurableObjectNamespace.js.map +1 -1
- package/build/esm/dev/instrumentations/instrumentDurableObjectStorage.js +70 -69
- package/build/esm/dev/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
- package/build/esm/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js +31 -37
- package/build/esm/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -1
- package/build/esm/dev/instrumentations/instrumentSqlStorage.js +50 -50
- package/build/esm/dev/instrumentations/instrumentSqlStorage.js.map +1 -1
- package/build/esm/dev/instrumentations/instrumentWorkerEntrypoint.js +136 -121
- package/build/esm/dev/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
- package/build/esm/dev/instrumentations/worker/instrumentD1.js +131 -144
- package/build/esm/dev/instrumentations/worker/instrumentD1.js.map +1 -1
- package/build/esm/dev/instrumentations/worker/instrumentEmail.js +63 -59
- package/build/esm/dev/instrumentations/worker/instrumentEmail.js.map +1 -1
- package/build/esm/dev/instrumentations/worker/instrumentEnv.js +83 -86
- package/build/esm/dev/instrumentations/worker/instrumentEnv.js.map +1 -1
- package/build/esm/dev/instrumentations/worker/instrumentFetch.js +41 -46
- package/build/esm/dev/instrumentations/worker/instrumentFetch.js.map +1 -1
- package/build/esm/dev/instrumentations/worker/instrumentFetcher.js +25 -19
- package/build/esm/dev/instrumentations/worker/instrumentFetcher.js.map +1 -1
- package/build/esm/dev/instrumentations/worker/instrumentKV.js +54 -65
- package/build/esm/dev/instrumentations/worker/instrumentKV.js.map +1 -1
- package/build/esm/dev/instrumentations/worker/instrumentQueue.js +98 -103
- package/build/esm/dev/instrumentations/worker/instrumentQueue.js.map +1 -1
- package/build/esm/dev/instrumentations/worker/instrumentQueueProducer.js +88 -92
- package/build/esm/dev/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
- package/build/esm/dev/instrumentations/worker/instrumentR2.js +128 -113
- package/build/esm/dev/instrumentations/worker/instrumentR2.js.map +1 -1
- package/build/esm/dev/instrumentations/worker/instrumentScheduled.js +90 -92
- package/build/esm/dev/instrumentations/worker/instrumentScheduled.js.map +1 -1
- package/build/esm/dev/instrumentations/worker/instrumentTail.js +100 -53
- package/build/esm/dev/instrumentations/worker/instrumentTail.js.map +1 -1
- package/build/esm/dev/integrations/cronTriggers.js +129 -82
- package/build/esm/dev/integrations/cronTriggers.js.map +1 -1
- package/build/esm/dev/integrations/fetch.js +9 -6
- package/build/esm/dev/integrations/fetch.js.map +1 -1
- package/build/esm/dev/integrations/httpServer.js +40 -19
- package/build/esm/dev/integrations/httpServer.js.map +1 -1
- package/build/esm/dev/integrations/spotlight.js +51 -52
- package/build/esm/dev/integrations/spotlight.js.map +1 -1
- package/build/esm/dev/opentelemetry/tracer.js +10 -6
- package/build/esm/dev/opentelemetry/tracer.js.map +1 -1
- package/build/esm/dev/options.js +55 -37
- package/build/esm/dev/options.js.map +1 -1
- package/build/esm/dev/orchestrion-deferred-channels.js +45 -27
- package/build/esm/dev/orchestrion-deferred-channels.js.map +1 -1
- package/build/esm/dev/orchestrion-diagnostics-channel.js +87 -66
- package/build/esm/dev/orchestrion-diagnostics-channel.js.map +1 -1
- package/build/esm/dev/package.json +1 -1
- package/build/esm/dev/pages-plugin.js +20 -19
- package/build/esm/dev/pages-plugin.js.map +1 -1
- package/build/esm/dev/request.js +14 -7
- package/build/esm/dev/request.js.map +1 -1
- package/build/esm/dev/scope-utils.js +12 -10
- package/build/esm/dev/scope-utils.js.map +1 -1
- package/build/esm/dev/sdk.js +23 -13
- package/build/esm/dev/sdk.js.map +1 -1
- package/build/esm/dev/transport.js +93 -84
- package/build/esm/dev/transport.js.map +1 -1
- package/build/esm/dev/utils/asyncContextStrategy.js +10 -8
- package/build/esm/dev/utils/asyncContextStrategy.js.map +1 -1
- package/build/esm/dev/utils/bindingPropagation.js +17 -9
- package/build/esm/dev/utils/bindingPropagation.js.map +1 -1
- package/build/esm/dev/utils/cloudflareTrace.js +34 -0
- package/build/esm/dev/utils/cloudflareTrace.js.map +1 -0
- package/build/esm/dev/utils/instrumentContext.js +74 -56
- package/build/esm/dev/utils/instrumentContext.js.map +1 -1
- package/build/esm/dev/utils/internalSqlQuery.js +38 -19
- package/build/esm/dev/utils/internalSqlQuery.js.map +1 -1
- package/build/esm/dev/utils/internalStorageKey.js +41 -36
- package/build/esm/dev/utils/internalStorageKey.js.map +1 -1
- package/build/esm/dev/utils/invocationContext.js +42 -30
- package/build/esm/dev/utils/invocationContext.js.map +1 -1
- package/build/esm/dev/utils/invocationScope.js +45 -19
- package/build/esm/dev/utils/invocationScope.js.map +1 -1
- package/build/esm/dev/utils/isBinding.js +47 -13
- package/build/esm/dev/utils/isBinding.js.map +1 -1
- package/build/esm/dev/utils/isCloudflareClass.js +11 -18
- package/build/esm/dev/utils/isCloudflareClass.js.map +1 -1
- package/build/esm/dev/utils/queueTraceMeta.js +24 -33
- package/build/esm/dev/utils/queueTraceMeta.js.map +1 -1
- package/build/esm/dev/utils/rpcMeta.js +37 -25
- package/build/esm/dev/utils/rpcMeta.js.map +1 -1
- package/build/esm/dev/utils/traceLinks.js +52 -40
- package/build/esm/dev/utils/traceLinks.js.map +1 -1
- package/build/esm/dev/vendor/stacktrace.js +31 -21
- package/build/esm/dev/vendor/stacktrace.js.map +1 -1
- package/build/esm/dev/vite/agentClass.js +105 -96
- package/build/esm/dev/vite/agentClass.js.map +1 -1
- package/build/esm/dev/vite/autoInstrument.js +121 -120
- package/build/esm/dev/vite/autoInstrument.js.map +1 -1
- package/build/esm/dev/vite/index.js +43 -19
- package/build/esm/dev/vite/index.js.map +1 -1
- package/build/esm/dev/vite/instrumentFile.js +37 -18
- package/build/esm/dev/vite/instrumentFile.js.map +1 -1
- package/build/esm/dev/vite/mastraObservability.js +19 -10
- package/build/esm/dev/vite/mastraObservability.js.map +1 -1
- package/build/esm/dev/vite/moduleShape.js +220 -199
- package/build/esm/dev/vite/moduleShape.js.map +1 -1
- package/build/esm/dev/vite/providedModulePlugin.js +60 -43
- package/build/esm/dev/vite/providedModulePlugin.js.map +1 -1
- package/build/esm/dev/vite/transform.js +331 -282
- package/build/esm/dev/vite/transform.js.map +1 -1
- package/build/esm/dev/vite/workerEntrypoint.js +66 -55
- package/build/esm/dev/vite/workerEntrypoint.js.map +1 -1
- package/build/esm/dev/vite/wranglerConfig.js +92 -65
- package/build/esm/dev/vite/wranglerConfig.js.map +1 -1
- package/build/esm/dev/withSentry.js +32 -24
- package/build/esm/dev/withSentry.js.map +1 -1
- package/build/esm/dev/workflows.js +164 -149
- package/build/esm/dev/workflows.js.map +1 -1
- package/build/esm/dev/wrapMethodWithSentry.js +148 -167
- package/build/esm/dev/wrapMethodWithSentry.js.map +1 -1
- package/build/esm/dev/wrapRequestHandlerWithInit.js +76 -76
- package/build/esm/dev/wrapRequestHandlerWithInit.js.map +1 -1
- package/build/esm/prod/baseSdk.js +94 -91
- package/build/esm/prod/baseSdk.js.map +1 -1
- package/build/esm/prod/client.js +213 -235
- package/build/esm/prod/client.js.map +1 -1
- package/build/esm/prod/clientCache.js +8 -6
- package/build/esm/prod/clientCache.js.map +1 -1
- package/build/esm/prod/debug-build.js +9 -3
- package/build/esm/prod/debug-build.js.map +1 -1
- package/build/esm/prod/defineCloudflareOptions.js +5 -6
- package/build/esm/prod/defineCloudflareOptions.js.map +1 -1
- package/build/esm/prod/durableobject.js +287 -174
- package/build/esm/prod/durableobject.js.map +1 -1
- package/build/esm/prod/flush.js +104 -75
- package/build/esm/prod/flush.js.map +1 -1
- package/build/esm/prod/index.js +19 -18
- package/build/esm/prod/instrument.js +53 -37
- package/build/esm/prod/instrument.js.map +1 -1
- package/build/esm/prod/instrumentations/agents/index.js +34 -11
- package/build/esm/prod/instrumentations/agents/index.js.map +1 -1
- package/build/esm/prod/instrumentations/agents/instrumentAgentCallableRpc.js +46 -47
- package/build/esm/prod/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -1
- package/build/esm/prod/instrumentations/agents/instrumentAgentRequestConversation.js +23 -14
- package/build/esm/prod/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -1
- package/build/esm/prod/instrumentations/agents/instrumentChatAgentConversation.js +36 -26
- package/build/esm/prod/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -1
- package/build/esm/prod/instrumentations/agents/types.js +103 -56
- package/build/esm/prod/instrumentations/agents/types.js.map +1 -1
- package/build/esm/prod/instrumentations/instrumentDurableObjectHandlers.js +87 -116
- package/build/esm/prod/instrumentations/instrumentDurableObjectHandlers.js.map +1 -1
- package/build/esm/prod/instrumentations/instrumentDurableObjectNamespace.js +46 -42
- package/build/esm/prod/instrumentations/instrumentDurableObjectNamespace.js.map +1 -1
- package/build/esm/prod/instrumentations/instrumentDurableObjectStorage.js +70 -69
- package/build/esm/prod/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
- package/build/esm/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js +31 -37
- package/build/esm/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -1
- package/build/esm/prod/instrumentations/instrumentSqlStorage.js +50 -50
- package/build/esm/prod/instrumentations/instrumentSqlStorage.js.map +1 -1
- package/build/esm/prod/instrumentations/instrumentWorkerEntrypoint.js +136 -121
- package/build/esm/prod/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
- package/build/esm/prod/instrumentations/worker/instrumentD1.js +131 -144
- package/build/esm/prod/instrumentations/worker/instrumentD1.js.map +1 -1
- package/build/esm/prod/instrumentations/worker/instrumentEmail.js +63 -59
- package/build/esm/prod/instrumentations/worker/instrumentEmail.js.map +1 -1
- package/build/esm/prod/instrumentations/worker/instrumentEnv.js +83 -86
- package/build/esm/prod/instrumentations/worker/instrumentEnv.js.map +1 -1
- package/build/esm/prod/instrumentations/worker/instrumentFetch.js +41 -46
- package/build/esm/prod/instrumentations/worker/instrumentFetch.js.map +1 -1
- package/build/esm/prod/instrumentations/worker/instrumentFetcher.js +25 -19
- package/build/esm/prod/instrumentations/worker/instrumentFetcher.js.map +1 -1
- package/build/esm/prod/instrumentations/worker/instrumentKV.js +54 -65
- package/build/esm/prod/instrumentations/worker/instrumentKV.js.map +1 -1
- package/build/esm/prod/instrumentations/worker/instrumentQueue.js +98 -103
- package/build/esm/prod/instrumentations/worker/instrumentQueue.js.map +1 -1
- package/build/esm/prod/instrumentations/worker/instrumentQueueProducer.js +88 -92
- package/build/esm/prod/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
- package/build/esm/prod/instrumentations/worker/instrumentR2.js +128 -113
- package/build/esm/prod/instrumentations/worker/instrumentR2.js.map +1 -1
- package/build/esm/prod/instrumentations/worker/instrumentScheduled.js +90 -92
- package/build/esm/prod/instrumentations/worker/instrumentScheduled.js.map +1 -1
- package/build/esm/prod/instrumentations/worker/instrumentTail.js +100 -53
- package/build/esm/prod/instrumentations/worker/instrumentTail.js.map +1 -1
- package/build/esm/prod/integrations/cronTriggers.js +129 -82
- package/build/esm/prod/integrations/cronTriggers.js.map +1 -1
- package/build/esm/prod/integrations/fetch.js +9 -6
- package/build/esm/prod/integrations/fetch.js.map +1 -1
- package/build/esm/prod/integrations/httpServer.js +40 -19
- package/build/esm/prod/integrations/httpServer.js.map +1 -1
- package/build/esm/prod/integrations/spotlight.js +51 -52
- package/build/esm/prod/integrations/spotlight.js.map +1 -1
- package/build/esm/prod/opentelemetry/tracer.js +10 -6
- package/build/esm/prod/opentelemetry/tracer.js.map +1 -1
- package/build/esm/prod/options.js +37 -22
- package/build/esm/prod/options.js.map +1 -1
- package/build/esm/prod/orchestrion-deferred-channels.js +45 -27
- package/build/esm/prod/orchestrion-deferred-channels.js.map +1 -1
- package/build/esm/prod/orchestrion-diagnostics-channel.js +87 -66
- package/build/esm/prod/orchestrion-diagnostics-channel.js.map +1 -1
- package/build/esm/prod/package.json +1 -1
- package/build/esm/prod/pages-plugin.js +20 -19
- package/build/esm/prod/pages-plugin.js.map +1 -1
- package/build/esm/prod/request.js +14 -7
- package/build/esm/prod/request.js.map +1 -1
- package/build/esm/prod/scope-utils.js +12 -10
- package/build/esm/prod/scope-utils.js.map +1 -1
- package/build/esm/prod/sdk.js +23 -13
- package/build/esm/prod/sdk.js.map +1 -1
- package/build/esm/prod/transport.js +93 -84
- package/build/esm/prod/transport.js.map +1 -1
- package/build/esm/prod/utils/asyncContextStrategy.js +10 -8
- package/build/esm/prod/utils/asyncContextStrategy.js.map +1 -1
- package/build/esm/prod/utils/bindingPropagation.js +17 -9
- package/build/esm/prod/utils/bindingPropagation.js.map +1 -1
- package/build/esm/prod/utils/cloudflareTrace.js +34 -0
- package/build/esm/prod/utils/cloudflareTrace.js.map +1 -0
- package/build/esm/prod/utils/instrumentContext.js +74 -56
- package/build/esm/prod/utils/instrumentContext.js.map +1 -1
- package/build/esm/prod/utils/internalSqlQuery.js +38 -19
- package/build/esm/prod/utils/internalSqlQuery.js.map +1 -1
- package/build/esm/prod/utils/internalStorageKey.js +41 -36
- package/build/esm/prod/utils/internalStorageKey.js.map +1 -1
- package/build/esm/prod/utils/invocationContext.js +42 -30
- package/build/esm/prod/utils/invocationContext.js.map +1 -1
- package/build/esm/prod/utils/invocationScope.js +45 -19
- package/build/esm/prod/utils/invocationScope.js.map +1 -1
- package/build/esm/prod/utils/isBinding.js +47 -13
- package/build/esm/prod/utils/isBinding.js.map +1 -1
- package/build/esm/prod/utils/isCloudflareClass.js +11 -18
- package/build/esm/prod/utils/isCloudflareClass.js.map +1 -1
- package/build/esm/prod/utils/queueTraceMeta.js +24 -33
- package/build/esm/prod/utils/queueTraceMeta.js.map +1 -1
- package/build/esm/prod/utils/rpcMeta.js +37 -25
- package/build/esm/prod/utils/rpcMeta.js.map +1 -1
- package/build/esm/prod/utils/traceLinks.js +52 -40
- package/build/esm/prod/utils/traceLinks.js.map +1 -1
- package/build/esm/prod/vendor/stacktrace.js +31 -21
- package/build/esm/prod/vendor/stacktrace.js.map +1 -1
- package/build/esm/prod/vite/agentClass.js +105 -96
- package/build/esm/prod/vite/agentClass.js.map +1 -1
- package/build/esm/prod/vite/autoInstrument.js +121 -120
- package/build/esm/prod/vite/autoInstrument.js.map +1 -1
- package/build/esm/prod/vite/index.js +43 -19
- package/build/esm/prod/vite/index.js.map +1 -1
- package/build/esm/prod/vite/instrumentFile.js +37 -18
- package/build/esm/prod/vite/instrumentFile.js.map +1 -1
- package/build/esm/prod/vite/mastraObservability.js +19 -10
- package/build/esm/prod/vite/mastraObservability.js.map +1 -1
- package/build/esm/prod/vite/moduleShape.js +220 -199
- package/build/esm/prod/vite/moduleShape.js.map +1 -1
- package/build/esm/prod/vite/providedModulePlugin.js +60 -43
- package/build/esm/prod/vite/providedModulePlugin.js.map +1 -1
- package/build/esm/prod/vite/transform.js +331 -282
- package/build/esm/prod/vite/transform.js.map +1 -1
- package/build/esm/prod/vite/workerEntrypoint.js +66 -55
- package/build/esm/prod/vite/workerEntrypoint.js.map +1 -1
- package/build/esm/prod/vite/wranglerConfig.js +92 -65
- package/build/esm/prod/vite/wranglerConfig.js.map +1 -1
- package/build/esm/prod/withSentry.js +32 -24
- package/build/esm/prod/withSentry.js.map +1 -1
- package/build/esm/prod/workflows.js +164 -149
- package/build/esm/prod/workflows.js.map +1 -1
- package/build/esm/prod/wrapMethodWithSentry.js +148 -167
- package/build/esm/prod/wrapMethodWithSentry.js.map +1 -1
- package/build/esm/prod/wrapRequestHandlerWithInit.js +76 -76
- package/build/esm/prod/wrapRequestHandlerWithInit.js.map +1 -1
- package/build/types/client.d.ts +2 -1
- package/build/types/client.d.ts.map +1 -1
- package/build/types/index.d.ts +3 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentEmail.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentFetcher.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentQueue.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentScheduled.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentTail.d.ts +4 -2
- package/build/types/instrumentations/worker/instrumentTail.d.ts.map +1 -1
- package/build/types/utils/cloudflareTrace.d.ts +13 -0
- package/build/types/utils/cloudflareTrace.d.ts.map +1 -0
- package/build/types/vite/autoInstrument.d.ts.map +1 -1
- package/build/types/vite/index.d.ts.map +1 -1
- package/build/types/vite/providedModulePlugin.d.ts +15 -11
- package/build/types/vite/providedModulePlugin.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/wrapRequestHandlerWithInit.d.ts.map +1 -1
- package/package.json +10 -14
- package/build/cjs/dev/index.js.map +0 -1
- package/build/cjs/dev/vite/flueRuntime.js +0 -15
- package/build/cjs/dev/vite/flueRuntime.js.map +0 -1
- package/build/cjs/prod/index.js.map +0 -1
- package/build/cjs/prod/vite/flueRuntime.js +0 -15
- package/build/cjs/prod/vite/flueRuntime.js.map +0 -1
- package/build/esm/dev/index.js.map +0 -1
- package/build/esm/dev/vite/flueRuntime.js +0 -13
- package/build/esm/dev/vite/flueRuntime.js.map +0 -1
- package/build/esm/prod/index.js.map +0 -1
- package/build/esm/prod/vite/flueRuntime.js +0 -13
- package/build/esm/prod/vite/flueRuntime.js.map +0 -1
- package/build/types/vite/flueRuntime.d.ts +0 -12
- package/build/types/vite/flueRuntime.d.ts.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const core = require('@sentry/core');
|
|
4
|
-
|
|
1
|
+
let _sentry_core = require("@sentry/core");
|
|
2
|
+
// src/clientCache.ts
|
|
5
3
|
const GLOBAL_CLIENT_KEY = "__SENTRY_CLOUDFLARE_CLIENT__";
|
|
4
|
+
/** Returns the one cached Cloudflare client for this isolate. */
|
|
6
5
|
function getCachedClient() {
|
|
7
|
-
|
|
6
|
+
return _sentry_core.GLOBAL_OBJ[GLOBAL_CLIENT_KEY];
|
|
8
7
|
}
|
|
8
|
+
/** Stores the one Cloudflare client reused by every invocation in this isolate. */
|
|
9
9
|
function cacheClient(client) {
|
|
10
|
-
|
|
10
|
+
_sentry_core.GLOBAL_OBJ[GLOBAL_CLIENT_KEY] = client;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
12
|
exports.cacheClient = cacheClient;
|
|
14
13
|
exports.getCachedClient = getCachedClient;
|
|
15
|
-
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=clientCache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientCache.js","sources":["../../../src/clientCache.ts"],"sourcesContent":["import { GLOBAL_OBJ } from '@sentry/core';\nimport type { CloudflareClient } from './client';\n\nconst GLOBAL_CLIENT_KEY = '__SENTRY_CLOUDFLARE_CLIENT__' as const;\n\ntype GlobalWithCloudflareClient = typeof GLOBAL_OBJ & {\n [GLOBAL_CLIENT_KEY]?: CloudflareClient;\n};\n\n/** Returns the one cached Cloudflare client for this isolate. */\nexport function getCachedClient(): CloudflareClient | undefined {\n return (GLOBAL_OBJ as GlobalWithCloudflareClient)[GLOBAL_CLIENT_KEY];\n}\n\n/** Stores the one Cloudflare client reused by every invocation in this isolate. */\nexport function cacheClient(client: CloudflareClient): void {\n (GLOBAL_OBJ as GlobalWithCloudflareClient)[GLOBAL_CLIENT_KEY] = client;\n}\n\n/** @hidden Only for testing - clears the isolate's cached Cloudflare client. */\nexport function _clearGlobalClientCache(): void {\n (GLOBAL_OBJ as GlobalWithCloudflareClient)[GLOBAL_CLIENT_KEY] = undefined;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"clientCache.js","names":["GLOBAL_OBJ"],"sources":["../../../src/clientCache.ts"],"sourcesContent":["import { GLOBAL_OBJ } from '@sentry/core';\nimport type { CloudflareClient } from './client';\n\nconst GLOBAL_CLIENT_KEY = '__SENTRY_CLOUDFLARE_CLIENT__' as const;\n\ntype GlobalWithCloudflareClient = typeof GLOBAL_OBJ & {\n [GLOBAL_CLIENT_KEY]?: CloudflareClient;\n};\n\n/** Returns the one cached Cloudflare client for this isolate. */\nexport function getCachedClient(): CloudflareClient | undefined {\n return (GLOBAL_OBJ as GlobalWithCloudflareClient)[GLOBAL_CLIENT_KEY];\n}\n\n/** Stores the one Cloudflare client reused by every invocation in this isolate. */\nexport function cacheClient(client: CloudflareClient): void {\n (GLOBAL_OBJ as GlobalWithCloudflareClient)[GLOBAL_CLIENT_KEY] = client;\n}\n\n/** @hidden Only for testing - clears the isolate's cached Cloudflare client. */\nexport function _clearGlobalClientCache(): void {\n (GLOBAL_OBJ as GlobalWithCloudflareClient)[GLOBAL_CLIENT_KEY] = undefined;\n}\n"],"mappings":";;AAGA,MAAM,oBAAoB;;AAO1B,SAAgB,kBAAgD;CAC9D,OAAQA,aAAAA,WAA0C;AACpD;;AAGA,SAAgB,YAAY,QAAgC;CACzDA,aAAAA,WAA0C,qBAAqB;AAClE"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// src/debug-build.ts
|
|
2
|
+
/**
|
|
3
|
+
* This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
|
|
4
|
+
*
|
|
5
|
+
* ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
|
|
6
|
+
*/
|
|
7
|
+
const DEBUG_BUILD = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
|
|
5
8
|
exports.DEBUG_BUILD = DEBUG_BUILD;
|
|
6
|
-
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=debug-build.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-build.js","sources":["../../../src/debug-build.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n"],"
|
|
1
|
+
{"version":3,"file":"debug-build.js","names":[],"sources":["../../../src/debug-build.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n"],"mappings":";;;;;;AAOA,MAAa,cAAe,OAAO,qBAAqB,eAAe"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// src/defineCloudflareOptions.ts
|
|
3
2
|
function defineCloudflareOptions(optionsOrCallback) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
return () => optionsOrCallback;
|
|
3
|
+
if (typeof optionsOrCallback === "function") return optionsOrCallback;
|
|
4
|
+
return () => optionsOrCallback;
|
|
8
5
|
}
|
|
9
|
-
|
|
10
6
|
exports.defineCloudflareOptions = defineCloudflareOptions;
|
|
11
|
-
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=defineCloudflareOptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineCloudflareOptions.js","sources":["../../../src/defineCloudflareOptions.ts"],"sourcesContent":["import type { CloudflareOptions } from './client';\nimport type { DefaultEnv, StrictCloudflareOptions } from './types';\n\n/**\n * Define the Sentry options for a Cloudflare Worker in a dedicated module.\n *\n * This is the recommended way to configure the SDK when using the Vite plugin's\n * auto-instrumentation: place an `instrument.server.{ts,js,mjs}` file next to\n * the worker entry whose **default export** is the result of this function. The\n * plugin picks it up automatically and hands it to `withSentry`.\n *\n * Unlike Node's `Sentry.init(...)`, the options cannot be applied at module\n * load time on Cloudflare: the DSN and other settings typically come from the\n * per-request `env`, which only exists inside the handler. Pass a callback to\n * read from `env`, or a static object when no `env` access is needed — either\n * way you get full type-checking and autocomplete on {@link CloudflareOptions}.\n *\n * At runtime this is a thin pass-through; it only normalizes a static object\n * into a callback so the plugin always imports a `(env) => options` function.\n *\n * @example\n * ```ts\n * // src/instrument.server.ts\n * import { defineCloudflareOptions } from '@sentry/cloudflare';\n *\n * export default defineCloudflareOptions((env) => ({\n * dsn: env.SENTRY_DSN,\n * tracesSampleRate: 1.0,\n * }));\n * ```\n *\n * @example\n * ```ts\n * // Static options — no `env` access needed\n * export default defineCloudflareOptions({ tracesSampleRate: 1.0 });\n * ```\n */\n// Overloads rather than a union parameter: TypeScript does not infer `O` out of a union member,\n// so a union signature falls back to the default and the unknown-key check never runs. The object\n// overload stays on plain `CloudflareOptions` — a direct object literal is still excess property\n// checked, and a callback cannot match it.\nexport function defineCloudflareOptions<Env = DefaultEnv, O = unknown>(\n callback: (env: Env) => StrictCloudflareOptions<O> | undefined,\n): (env: Env) => CloudflareOptions | undefined;\nexport function defineCloudflareOptions<Env = DefaultEnv>(\n options: CloudflareOptions,\n): (env: Env) => CloudflareOptions | undefined;\nexport function defineCloudflareOptions<Env = DefaultEnv>(\n optionsOrCallback: CloudflareOptions | ((env: Env) => CloudflareOptions | undefined),\n): (env: Env) => CloudflareOptions | undefined {\n if (typeof optionsOrCallback === 'function') {\n return optionsOrCallback;\n }\n\n return () => optionsOrCallback;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"defineCloudflareOptions.js","names":[],"sources":["../../../src/defineCloudflareOptions.ts"],"sourcesContent":["import type { CloudflareOptions } from './client';\nimport type { DefaultEnv, StrictCloudflareOptions } from './types';\n\n/**\n * Define the Sentry options for a Cloudflare Worker in a dedicated module.\n *\n * This is the recommended way to configure the SDK when using the Vite plugin's\n * auto-instrumentation: place an `instrument.server.{ts,js,mjs}` file next to\n * the worker entry whose **default export** is the result of this function. The\n * plugin picks it up automatically and hands it to `withSentry`.\n *\n * Unlike Node's `Sentry.init(...)`, the options cannot be applied at module\n * load time on Cloudflare: the DSN and other settings typically come from the\n * per-request `env`, which only exists inside the handler. Pass a callback to\n * read from `env`, or a static object when no `env` access is needed — either\n * way you get full type-checking and autocomplete on {@link CloudflareOptions}.\n *\n * At runtime this is a thin pass-through; it only normalizes a static object\n * into a callback so the plugin always imports a `(env) => options` function.\n *\n * @example\n * ```ts\n * // src/instrument.server.ts\n * import { defineCloudflareOptions } from '@sentry/cloudflare';\n *\n * export default defineCloudflareOptions((env) => ({\n * dsn: env.SENTRY_DSN,\n * tracesSampleRate: 1.0,\n * }));\n * ```\n *\n * @example\n * ```ts\n * // Static options — no `env` access needed\n * export default defineCloudflareOptions({ tracesSampleRate: 1.0 });\n * ```\n */\n// Overloads rather than a union parameter: TypeScript does not infer `O` out of a union member,\n// so a union signature falls back to the default and the unknown-key check never runs. The object\n// overload stays on plain `CloudflareOptions` — a direct object literal is still excess property\n// checked, and a callback cannot match it.\nexport function defineCloudflareOptions<Env = DefaultEnv, O = unknown>(\n callback: (env: Env) => StrictCloudflareOptions<O> | undefined,\n): (env: Env) => CloudflareOptions | undefined;\nexport function defineCloudflareOptions<Env = DefaultEnv>(\n options: CloudflareOptions,\n): (env: Env) => CloudflareOptions | undefined;\nexport function defineCloudflareOptions<Env = DefaultEnv>(\n optionsOrCallback: CloudflareOptions | ((env: Env) => CloudflareOptions | undefined),\n): (env: Env) => CloudflareOptions | undefined {\n if (typeof optionsOrCallback === 'function') {\n return optionsOrCallback;\n }\n\n return () => optionsOrCallback;\n}\n"],"mappings":";AA+CA,SAAgB,wBACd,mBAC6C;CAC7C,IAAI,OAAO,sBAAsB,YAC/B,OAAO;CAGT,aAAa;AACf"}
|
|
@@ -1,207 +1,318 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
const require_asyncContextStrategy = require("./utils/asyncContextStrategy.js");
|
|
2
|
+
const require_instrument = require("./instrument.js");
|
|
3
|
+
const require_instrumentDurableObjectHandlers = require("./instrumentations/instrumentDurableObjectHandlers.js");
|
|
4
|
+
const require_instrumentEnv = require("./instrumentations/worker/instrumentEnv.js");
|
|
5
|
+
const require_options = require("./options.js");
|
|
6
|
+
const require_orchestrion_deferred_channels = require("./orchestrion-deferred-channels.js");
|
|
7
|
+
const require_sdk = require("./sdk.js");
|
|
8
|
+
const require_instrumentContext = require("./utils/instrumentContext.js");
|
|
9
|
+
const require_invocationScope = require("./utils/invocationScope.js");
|
|
10
|
+
const require_rpcMeta = require("./utils/rpcMeta.js");
|
|
11
|
+
const require_index = require("./instrumentations/agents/index.js");
|
|
12
|
+
const require_wrapMethodWithSentry = require("./wrapMethodWithSentry.js");
|
|
13
|
+
let _sentry_core = require("@sentry/core");
|
|
14
|
+
let _sentry_conventions_op = require("@sentry/conventions/op");
|
|
15
|
+
// src/durableobject.ts
|
|
16
|
+
/**
|
|
17
|
+
* Constructs a Durable Object instance and instruments its built-in handler methods
|
|
18
|
+
* (`fetch`, `alarm`, `webSocketMessage`, `webSocketClose`, `webSocketError`).
|
|
19
|
+
*
|
|
20
|
+
* This is the shared construction path used by both {@link instrumentDurableObjectWithSentry}
|
|
21
|
+
* and {@link instrumentAgentWithSentry}. It intentionally does NOT apply the RPC prototype-method
|
|
22
|
+
* instrumentation — callers apply that last via {@link finalizeWithRpcInstrumentation}, after any
|
|
23
|
+
* additional per-instance instrumentation has been layered onto the returned object.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
18
27
|
function constructInstrumentedDurableObject(target, ctx, env, newTarget, optionsCallback) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
require_asyncContextStrategy.setAsyncLocalStorageAsyncContextStrategyForWorker();
|
|
29
|
+
const options = require_options.getFinalOptions(optionsCallback(env), env);
|
|
30
|
+
const context = require_instrumentContext.instrumentContext(ctx);
|
|
31
|
+
const instrumentedEnv = require_instrumentEnv.instrumentEnv(env, options);
|
|
32
|
+
const prototype = newTarget.prototype ?? target.prototype;
|
|
33
|
+
const cachedFrameworkManagedMethods = frameworkManagedMethodsCache.get(prototype);
|
|
34
|
+
const methodsBeforeConstruction = cachedFrameworkManagedMethods ? void 0 : resolveMethodsBeforeFirstConstruction(prototype);
|
|
35
|
+
const obj = require_invocationScope.withConstructionIsolationScope(() => {
|
|
36
|
+
if (options.cacheClient !== false) {
|
|
37
|
+
require_sdk.init({ ...options });
|
|
38
|
+
require_orchestrion_deferred_channels.flushDeferredChannelEvents();
|
|
39
|
+
}
|
|
40
|
+
return Reflect.construct(target, [context, instrumentedEnv], newTarget);
|
|
41
|
+
});
|
|
42
|
+
const frameworkManagedMethods = resolveFrameworkManagedMethods(prototype, obj, methodsBeforeConstruction, cachedFrameworkManagedMethods);
|
|
43
|
+
require_instrumentDurableObjectHandlers.instrumentDurableObjectHandlers(obj, options, context);
|
|
44
|
+
return {
|
|
45
|
+
obj,
|
|
46
|
+
options,
|
|
47
|
+
context,
|
|
48
|
+
frameworkManagedMethods
|
|
49
|
+
};
|
|
41
50
|
}
|
|
42
51
|
const frameworkManagedMethodsCache = /* @__PURE__ */ new WeakMap();
|
|
43
52
|
const methodsBeforeFirstConstructionCache = /* @__PURE__ */ new WeakMap();
|
|
53
|
+
/**
|
|
54
|
+
* Collects the prototype's methods as they were before any instance was constructed.
|
|
55
|
+
*
|
|
56
|
+
* A constructor can throw after a framework has already installed its wrappers (the `agents` SDK
|
|
57
|
+
* wraps `@callable()` methods before storage initialization, which can fail). The next construction
|
|
58
|
+
* would then see those wrappers as the originals and treat the methods as unmanaged, so the methods
|
|
59
|
+
* collected on the first attempt are kept until a construction succeeds.
|
|
60
|
+
*/
|
|
44
61
|
function resolveMethodsBeforeFirstConstruction(prototype) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
let methods = methodsBeforeFirstConstructionCache.get(prototype);
|
|
63
|
+
if (!methods) {
|
|
64
|
+
methods = resolvePrototypeMethods(prototype);
|
|
65
|
+
methodsBeforeFirstConstructionCache.set(prototype, methods);
|
|
66
|
+
}
|
|
67
|
+
return methods;
|
|
51
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Collects the methods visible from a prototype, using normal property lookup precedence.
|
|
71
|
+
* Methods inherited from `Object.prototype` are excluded because they cannot be Durable Object RPC methods.
|
|
72
|
+
*/
|
|
52
73
|
function resolvePrototypeMethods(prototype) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (descriptor && typeof descriptor.value === "function") {
|
|
61
|
-
methods.set(name, descriptor.value);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return methods;
|
|
74
|
+
const methods = /* @__PURE__ */ new Map();
|
|
75
|
+
for (let current = prototype; current && current !== Object.prototype; current = Object.getPrototypeOf(current)) for (const name of Object.getOwnPropertyNames(current)) {
|
|
76
|
+
if (name === "constructor" || methods.has(name)) continue;
|
|
77
|
+
const descriptor = Object.getOwnPropertyDescriptor(current, name);
|
|
78
|
+
if (descriptor && typeof descriptor.value === "function") methods.set(name, descriptor.value);
|
|
79
|
+
}
|
|
80
|
+
return methods;
|
|
66
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Finds methods that a framework replaced while constructing the first instance.
|
|
84
|
+
*
|
|
85
|
+
* Some frameworks register methods by function identity, so replacing one of their wrappers would
|
|
86
|
+
* break dispatch. The result is cached because frameworks commonly install their wrappers only
|
|
87
|
+
* once; later constructions would no longer reveal which methods they manage.
|
|
88
|
+
*/
|
|
67
89
|
function resolveFrameworkManagedMethods(prototype, obj, methodsBeforeConstruction, cached) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
frameworkManagedMethodsCache.set(prototype, managed);
|
|
80
|
-
methodsBeforeFirstConstructionCache.delete(prototype);
|
|
81
|
-
return managed;
|
|
90
|
+
if (cached) return cached;
|
|
91
|
+
const methodsAfterConstruction = resolvePrototypeMethods(Object.getPrototypeOf(obj));
|
|
92
|
+
const managed = /* @__PURE__ */ new Set();
|
|
93
|
+
for (const [name, method] of methodsAfterConstruction) {
|
|
94
|
+
const before = methodsBeforeConstruction?.get(name);
|
|
95
|
+
if (before && before !== method) managed.add(name);
|
|
96
|
+
}
|
|
97
|
+
frameworkManagedMethodsCache.set(prototype, managed);
|
|
98
|
+
methodsBeforeFirstConstructionCache.delete(prototype);
|
|
99
|
+
return managed;
|
|
82
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Method names the runtime never dispatches over RPC, so wrapping them buys no tracing.
|
|
103
|
+
*
|
|
104
|
+
* Mirrors `isReservedName` in workerd (`src/workerd/api/worker-rpc.c++`): the runtime rejects these
|
|
105
|
+
* before any property lookup happens. `fetch`, `alarm` and the `webSocket*` handlers are also
|
|
106
|
+
* instrumented per-instance as own properties, and `constructor` is on every prototype.
|
|
107
|
+
*/
|
|
83
108
|
const RESERVED_RPC_METHOD_NAMES = /* @__PURE__ */ new Set([
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
109
|
+
"constructor",
|
|
110
|
+
"fetch",
|
|
111
|
+
"connect",
|
|
112
|
+
"alarm",
|
|
113
|
+
"webSocketMessage",
|
|
114
|
+
"webSocketClose",
|
|
115
|
+
"webSocketError",
|
|
116
|
+
"dup"
|
|
92
117
|
]);
|
|
93
118
|
const rpcInstanceStates = /* @__PURE__ */ new WeakMap();
|
|
119
|
+
/**
|
|
120
|
+
* Instruments a constructed Durable Object's RPC methods.
|
|
121
|
+
*
|
|
122
|
+
* RPC methods are wrapped on the prototype because Cloudflare dispatches them with the Durable
|
|
123
|
+
* Object instance as the receiver. This preserves native private-field access and keeps the methods
|
|
124
|
+
* visible to Cloudflare's RPC dispatcher. Built-in handlers, Agent handlers, and methods managed by
|
|
125
|
+
* another framework are left untouched.
|
|
126
|
+
*
|
|
127
|
+
* Call this after all per-instance instrumentation has been applied.
|
|
128
|
+
*
|
|
129
|
+
* @param obj The constructed Durable Object instance.
|
|
130
|
+
* @param options The resolved SDK options for this instance.
|
|
131
|
+
* @param context The instrumented execution context for this instance.
|
|
132
|
+
* @param excludedMethods Method names owned by another framework and therefore not safe to wrap.
|
|
133
|
+
* @returns The same Durable Object instance, with eligible prototype methods instrumented.
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
94
136
|
function finalizeWithRpcInstrumentation(obj, options, context, excludedMethods) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
137
|
+
rpcInstanceStates.set(obj, {
|
|
138
|
+
options,
|
|
139
|
+
context
|
|
140
|
+
});
|
|
141
|
+
instrumentPrototypeRpcMethods(obj, excludedMethods);
|
|
142
|
+
return obj;
|
|
98
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Returns a prototype method when it is eligible for RPC instrumentation.
|
|
146
|
+
*/
|
|
99
147
|
function getRpcMethodDescriptor(obj, prototype, methodName, excludedMethods) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (!descriptor || typeof descriptor.value !== "function" || instrument.getInstrumented(descriptor.value)) {
|
|
105
|
-
return void 0;
|
|
106
|
-
}
|
|
107
|
-
return descriptor;
|
|
148
|
+
if (RESERVED_RPC_METHOD_NAMES.has(methodName) || Object.prototype.hasOwnProperty.call(obj, methodName) || excludedMethods?.has(methodName)) return;
|
|
149
|
+
const descriptor = Object.getOwnPropertyDescriptor(prototype, methodName);
|
|
150
|
+
if (!descriptor || typeof descriptor.value !== "function" || require_instrument.getInstrumented(descriptor.value)) return;
|
|
151
|
+
return descriptor;
|
|
108
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Wraps eligible methods on the instance's prototype chain once per class.
|
|
155
|
+
*/
|
|
109
156
|
function instrumentPrototypeRpcMethods(obj, excludedMethods) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
157
|
+
let prototype = Object.getPrototypeOf(obj);
|
|
158
|
+
while (prototype && prototype !== Object.prototype) {
|
|
159
|
+
for (const methodName of Object.getOwnPropertyNames(prototype)) {
|
|
160
|
+
const descriptor = getRpcMethodDescriptor(obj, prototype, methodName, excludedMethods);
|
|
161
|
+
if (!descriptor) continue;
|
|
162
|
+
const wrapped = createRpcPrototypeWrapper(methodName, descriptor.value);
|
|
163
|
+
try {
|
|
164
|
+
Object.defineProperty(prototype, methodName, {
|
|
165
|
+
...descriptor,
|
|
166
|
+
value: wrapped
|
|
167
|
+
});
|
|
168
|
+
} catch {}
|
|
169
|
+
require_instrument.markAsInstrumented(wrapped);
|
|
170
|
+
}
|
|
171
|
+
prototype = Object.getPrototypeOf(prototype);
|
|
172
|
+
}
|
|
126
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Returns the instance's instrumented wrapper for an RPC method, creating it on first use.
|
|
176
|
+
*/
|
|
127
177
|
function getInstrumentedRpcMethod(state, methodName, originalMethod) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
true
|
|
142
|
-
);
|
|
143
|
-
instrumentedMethods.set(methodName, instrumented);
|
|
144
|
-
}
|
|
145
|
-
return instrumented;
|
|
178
|
+
const instrumentedMethods = state.instrumentedMethods ?? (state.instrumentedMethods = /* @__PURE__ */ new Map());
|
|
179
|
+
let instrumented = instrumentedMethods.get(methodName);
|
|
180
|
+
if (!instrumented) {
|
|
181
|
+
instrumented = require_wrapMethodWithSentry.wrapMethodWithSentry({
|
|
182
|
+
options: state.options,
|
|
183
|
+
context: state.context,
|
|
184
|
+
spanName: (rpcMeta) => rpcMeta ? methodName : void 0,
|
|
185
|
+
spanOp: _sentry_conventions_op.RPC,
|
|
186
|
+
origin: "auto.faas.cloudflare.durable_object"
|
|
187
|
+
}, originalMethod, void 0, true);
|
|
188
|
+
instrumentedMethods.set(methodName, instrumented);
|
|
189
|
+
}
|
|
190
|
+
return instrumented;
|
|
146
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Creates a prototype wrapper that instruments external RPC calls.
|
|
194
|
+
*
|
|
195
|
+
* The wrapper looks up SDK state from its receiver, allowing one prototype function to serve every
|
|
196
|
+
* instance. A call carrying Sentry metadata continues that trace in an `rpc` span. A call without it
|
|
197
|
+
* still gets a client, so its errors, logs and metrics are captured, but no span. Calls the instance
|
|
198
|
+
* makes to its own methods run the original method directly. The original function name and arity
|
|
199
|
+
* are preserved because frameworks may inspect them for dispatch.
|
|
200
|
+
*/
|
|
147
201
|
function createRpcPrototypeWrapper(methodName, originalMethod) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
202
|
+
const wrapper = function(...args) {
|
|
203
|
+
const traced = require_rpcMeta.hasRpcMeta(args);
|
|
204
|
+
if (!traced && (0, _sentry_core.getIsolationScope)() !== (0, _sentry_core.getDefaultIsolationScope)()) return Reflect.apply(originalMethod, this, args);
|
|
205
|
+
const state = (0, _sentry_core.isObjectLike)(this) ? rpcInstanceStates.get(this) : void 0;
|
|
206
|
+
if (!state) return Reflect.apply(originalMethod, this, args);
|
|
207
|
+
const instrumented = getInstrumentedRpcMethod(state, methodName, originalMethod);
|
|
208
|
+
if (traced) return Reflect.apply(instrumented, this, args);
|
|
209
|
+
return (0, _sentry_core.startNewTrace)(() => Reflect.apply(instrumented, this, args));
|
|
210
|
+
};
|
|
211
|
+
Object.defineProperties(wrapper, {
|
|
212
|
+
name: {
|
|
213
|
+
value: originalMethod.name,
|
|
214
|
+
configurable: true
|
|
215
|
+
},
|
|
216
|
+
length: {
|
|
217
|
+
value: originalMethod.length,
|
|
218
|
+
configurable: true
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
return wrapper;
|
|
168
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Instruments a Durable Object class to capture errors and performance data.
|
|
225
|
+
*
|
|
226
|
+
* Instruments the following methods by default:
|
|
227
|
+
* - fetch
|
|
228
|
+
* - alarm
|
|
229
|
+
* - webSocketMessage
|
|
230
|
+
* - webSocketClose
|
|
231
|
+
* - webSocketError
|
|
232
|
+
*
|
|
233
|
+
* RPC methods (prototype methods) are instrumented too: an incoming trace continues into them, and
|
|
234
|
+
* errors, logs and metrics are captured whether or not the caller propagates a trace.
|
|
235
|
+
*
|
|
236
|
+
* @param optionsCallback Function that returns the options for the SDK initialization.
|
|
237
|
+
* @param DurableObjectClass The Durable Object class to instrument.
|
|
238
|
+
* @returns The instrumented Durable Object class.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```ts
|
|
242
|
+
* class MyDurableObjectBase extends DurableObject {
|
|
243
|
+
* constructor(ctx: DurableObjectState, env: Env) {
|
|
244
|
+
* super(ctx, env);
|
|
245
|
+
* }
|
|
246
|
+
* }
|
|
247
|
+
*
|
|
248
|
+
* export const MyDurableObject = instrumentDurableObjectWithSentry(
|
|
249
|
+
* env => ({
|
|
250
|
+
* dsn: env.SENTRY_DSN,
|
|
251
|
+
* tracesSampleRate: 1.0,
|
|
252
|
+
* }),
|
|
253
|
+
* MyDurableObjectBase,
|
|
254
|
+
* );
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
169
257
|
function instrumentDurableObjectWithSentry(optionsCallback, DurableObjectClass) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
newTarget,
|
|
177
|
-
optionsCallback
|
|
178
|
-
);
|
|
179
|
-
return finalizeWithRpcInstrumentation(obj, options, context, frameworkManagedMethods);
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
instrument.markAsInstrumented(InstrumentedClass);
|
|
183
|
-
return InstrumentedClass;
|
|
258
|
+
const InstrumentedClass = new Proxy(DurableObjectClass, { construct(target, [ctx, env], newTarget) {
|
|
259
|
+
const { obj, options, context, frameworkManagedMethods } = constructInstrumentedDurableObject(target, ctx, env, newTarget, optionsCallback);
|
|
260
|
+
return finalizeWithRpcInstrumentation(obj, options, context, frameworkManagedMethods);
|
|
261
|
+
} });
|
|
262
|
+
require_instrument.markAsInstrumented(InstrumentedClass);
|
|
263
|
+
return InstrumentedClass;
|
|
184
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* Instruments a Cloudflare [`agents`](https://www.npmjs.com/package/agents) Agent class with Sentry.
|
|
267
|
+
*
|
|
268
|
+
* An `Agent` is a Durable Object under the hood, so this applies the same instrumentation as
|
|
269
|
+
* {@link instrumentDurableObjectWithSentry} (request transactions, `alarm`, WebSocket handlers, RPC
|
|
270
|
+
* trace propagation, SQL spans) and additionally captures Agent-specific telemetry via
|
|
271
|
+
* `instrumentCloudflareAgent`:
|
|
272
|
+
*
|
|
273
|
+
* - **Callable RPC spans** — a span (op `rpc`) for each `@callable()` method invoked over WebSocket.
|
|
274
|
+
* - **Breadcrumbs** — for every Agent observability event (`rpc`, `state:update`, `connect`,
|
|
275
|
+
* `disconnect`, `schedule:*`, `queue:*`, `workflow:*`, `email:*`, `mcp:*`, ...).
|
|
276
|
+
*
|
|
277
|
+
* Cloudflare Workers cannot auto-instrument, so the Agent class must be wrapped manually.
|
|
278
|
+
*
|
|
279
|
+
* @param optionsCallback Function that returns the options for the SDK initialization.
|
|
280
|
+
* @param AgentClass The Agent class to instrument.
|
|
281
|
+
* @returns The instrumented Agent class.
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```ts
|
|
285
|
+
* import { Agent, callable, routeAgentRequest } from 'agents';
|
|
286
|
+
* import * as Sentry from '@sentry/cloudflare';
|
|
287
|
+
*
|
|
288
|
+
* class MyAgentBase extends Agent<Env> {
|
|
289
|
+
* @callable()
|
|
290
|
+
* async greet(name: string): Promise<string> {
|
|
291
|
+
* return `Hello, ${name}!`;
|
|
292
|
+
* }
|
|
293
|
+
* }
|
|
294
|
+
*
|
|
295
|
+
* export const MyAgent = Sentry.instrumentAgentWithSentry(
|
|
296
|
+
* env => ({
|
|
297
|
+
* dsn: env.SENTRY_DSN,
|
|
298
|
+
* tracesSampleRate: 1.0,
|
|
299
|
+
* }),
|
|
300
|
+
* MyAgentBase,
|
|
301
|
+
* );
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
185
304
|
function instrumentAgentWithSentry(optionsCallback, AgentClass) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
optionsCallback
|
|
194
|
-
);
|
|
195
|
-
index.instrumentCloudflareAgent(obj);
|
|
196
|
-
return finalizeWithRpcInstrumentation(obj, options, context, frameworkManagedMethods);
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
instrument.markAsInstrumented(InstrumentedClass);
|
|
200
|
-
return InstrumentedClass;
|
|
305
|
+
const InstrumentedClass = new Proxy(AgentClass, { construct(target, [ctx, env], newTarget) {
|
|
306
|
+
const { obj, options, context, frameworkManagedMethods } = constructInstrumentedDurableObject(target, ctx, env, newTarget, optionsCallback);
|
|
307
|
+
require_index.instrumentCloudflareAgent(obj);
|
|
308
|
+
return finalizeWithRpcInstrumentation(obj, options, context, frameworkManagedMethods);
|
|
309
|
+
} });
|
|
310
|
+
require_instrument.markAsInstrumented(InstrumentedClass);
|
|
311
|
+
return InstrumentedClass;
|
|
201
312
|
}
|
|
202
|
-
|
|
203
313
|
exports.constructInstrumentedDurableObject = constructInstrumentedDurableObject;
|
|
204
314
|
exports.finalizeWithRpcInstrumentation = finalizeWithRpcInstrumentation;
|
|
205
315
|
exports.instrumentAgentWithSentry = instrumentAgentWithSentry;
|
|
206
316
|
exports.instrumentDurableObjectWithSentry = instrumentDurableObjectWithSentry;
|
|
207
|
-
|
|
317
|
+
|
|
318
|
+
//# sourceMappingURL=durableobject.js.map
|