@sentry/cloudflare 11.12.0 → 11.14.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 +218 -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 +56 -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 +125 -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 +332 -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 +94 -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 +218 -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 +38 -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 +125 -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 +332 -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 +94 -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 +218 -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 +56 -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 +125 -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 +330 -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 +94 -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 +218 -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 +38 -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 +125 -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 +330 -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 +94 -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/baseSdk.d.ts.map +1 -1
- package/build/types/client.d.ts +9 -1
- package/build/types/client.d.ts.map +1 -1
- package/build/types/durableobject.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/options.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 +3 -0
- 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/vite/transform.d.ts +12 -2
- package/build/types/vite/transform.d.ts.map +1 -1
- package/build/types/vite/wranglerConfig.d.ts +8 -0
- package/build/types/vite/wranglerConfig.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,91 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
let _sentry_core = require("@sentry/core");
|
|
2
|
+
// src/transport.ts
|
|
3
|
+
/**
|
|
4
|
+
* How many payloads the buffer holds before it starts rejecting new ones.
|
|
5
|
+
*
|
|
6
|
+
* With `cacheClient` a single client is reused across an isolate's invocations, so one buffer now has to absorb
|
|
7
|
+
* the payloads of many invocations rather than one. 256 is the size that held up under load testing that scenario.
|
|
8
|
+
*/
|
|
5
9
|
const DEFAULT_TRANSPORT_BUFFER_SIZE = 256;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
10
|
+
/**
|
|
11
|
+
* This is a modified promise buffer that collects tasks until drain is called.
|
|
12
|
+
* We need this in the edge runtime because edge function invocations may not share I/O objects, like fetch requests
|
|
13
|
+
* and responses, and the normal PromiseBuffer inherently buffers stuff inbetween incoming requests.
|
|
14
|
+
*
|
|
15
|
+
* A limitation we need to be aware of is that DEFAULT_TRANSPORT_BUFFER_SIZE is the maximum amount of payloads the
|
|
16
|
+
* SDK can send for a given edge function invocation.
|
|
17
|
+
*/
|
|
18
|
+
var IsolatedPromiseBuffer = class {
|
|
19
|
+
constructor(_bufferSize = DEFAULT_TRANSPORT_BUFFER_SIZE) {
|
|
20
|
+
this.$ = [];
|
|
21
|
+
this._taskProducers = [];
|
|
22
|
+
this._bufferSize = _bufferSize;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @inheritdoc
|
|
26
|
+
*/
|
|
27
|
+
add(taskProducer) {
|
|
28
|
+
if (this._taskProducers.length >= this._bufferSize) return Promise.reject(_sentry_core.SENTRY_BUFFER_FULL_ERROR);
|
|
29
|
+
this._taskProducers.push(taskProducer);
|
|
30
|
+
return Promise.resolve({});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @inheritdoc
|
|
34
|
+
*/
|
|
35
|
+
drain(timeout) {
|
|
36
|
+
const oldTaskProducers = [...this._taskProducers];
|
|
37
|
+
this._taskProducers = [];
|
|
38
|
+
const drainController = new AbortController();
|
|
39
|
+
this.drainSignal = drainController.signal;
|
|
40
|
+
const tasks = oldTaskProducers.map((taskProducer) => {
|
|
41
|
+
try {
|
|
42
|
+
return taskProducer();
|
|
43
|
+
} catch (error) {
|
|
44
|
+
return Promise.reject(error);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
this.drainSignal = void 0;
|
|
48
|
+
return new Promise((resolve) => {
|
|
49
|
+
const timer = setTimeout(() => {
|
|
50
|
+
if (timeout && timeout > 0) {
|
|
51
|
+
drainController.abort();
|
|
52
|
+
resolve(false);
|
|
53
|
+
}
|
|
54
|
+
}, timeout);
|
|
55
|
+
Promise.all(tasks.map((task) => task.then(null, () => {}))).then(() => {
|
|
56
|
+
clearTimeout(timer);
|
|
57
|
+
resolve(true);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Creates a Transport that uses the native fetch API to send events to Sentry.
|
|
64
|
+
*/
|
|
57
65
|
function makeCloudflareTransport(options) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return core.createTransport(options, makeRequest, buffer);
|
|
66
|
+
const buffer = new IsolatedPromiseBuffer(options.bufferSize);
|
|
67
|
+
function makeRequest(request) {
|
|
68
|
+
const drainSignal = buffer.drainSignal;
|
|
69
|
+
const callerSignal = options.fetchOptions?.signal ?? void 0;
|
|
70
|
+
const signal = drainSignal && callerSignal ? AbortSignal.any([drainSignal, callerSignal]) : drainSignal ?? callerSignal;
|
|
71
|
+
const requestOptions = {
|
|
72
|
+
body: request.body,
|
|
73
|
+
method: "POST",
|
|
74
|
+
headers: options.headers,
|
|
75
|
+
...options.fetchOptions,
|
|
76
|
+
...signal ? { signal } : {}
|
|
77
|
+
};
|
|
78
|
+
return (0, _sentry_core.suppressTracing)(() => {
|
|
79
|
+
return (options.fetch ?? fetch)(options.url, requestOptions).then(async (response) => {
|
|
80
|
+
try {
|
|
81
|
+
await response.text();
|
|
82
|
+
} catch {}
|
|
83
|
+
return {
|
|
84
|
+
statusCode: response.status,
|
|
85
|
+
headers: {
|
|
86
|
+
"x-sentry-rate-limits": response.headers.get("X-Sentry-Rate-Limits"),
|
|
87
|
+
"retry-after": response.headers.get("Retry-After")
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return (0, _sentry_core.createTransport)(options, makeRequest, buffer);
|
|
87
94
|
}
|
|
88
|
-
|
|
89
95
|
exports.IsolatedPromiseBuffer = IsolatedPromiseBuffer;
|
|
90
96
|
exports.makeCloudflareTransport = makeCloudflareTransport;
|
|
91
|
-
|
|
97
|
+
|
|
98
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sources":["../../../src/transport.ts"],"sourcesContent":["import type { BaseTransportOptions, Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core';\nimport { createTransport, SENTRY_BUFFER_FULL_ERROR, suppressTracing } from '@sentry/core';\n\nexport interface CloudflareTransportOptions extends BaseTransportOptions {\n /** Custom fetch function to use. This allows usage of things like Workers VPC */\n fetch?: typeof fetch;\n /** Fetch API init parameters. */\n fetchOptions?: RequestInit;\n}\n\n/**\n * How many payloads the buffer holds before it starts rejecting new ones.\n *\n * With `cacheClient` a single client is reused across an isolate's invocations, so one buffer now has to absorb\n * the payloads of many invocations rather than one. 256 is the size that held up under load testing that scenario.\n */\nconst DEFAULT_TRANSPORT_BUFFER_SIZE = 256;\n\n/**\n * This is a modified promise buffer that collects tasks until drain is called.\n * We need this in the edge runtime because edge function invocations may not share I/O objects, like fetch requests\n * and responses, and the normal PromiseBuffer inherently buffers stuff inbetween incoming requests.\n *\n * A limitation we need to be aware of is that DEFAULT_TRANSPORT_BUFFER_SIZE is the maximum amount of payloads the\n * SDK can send for a given edge function invocation.\n */\nexport class IsolatedPromiseBuffer {\n // We just have this field because the promise buffer interface requires it.\n // If we ever remove it from the interface we should also remove it here.\n public $: Array<PromiseLike<TransportMakeRequestResponse>>;\n\n /**\n * Abort signal of the drain that is starting its requests. It is set only while `drain()` runs the task\n * producers, so a request reads the signal of the drain that sends it.\n */\n public drainSignal: AbortSignal | undefined;\n\n private _taskProducers: (() => PromiseLike<TransportMakeRequestResponse>)[];\n\n private readonly _bufferSize: number;\n\n public constructor(_bufferSize = DEFAULT_TRANSPORT_BUFFER_SIZE) {\n this.$ = [];\n this._taskProducers = [];\n this._bufferSize = _bufferSize;\n }\n\n /**\n * @inheritdoc\n */\n public add(taskProducer: () => PromiseLike<TransportMakeRequestResponse>): PromiseLike<TransportMakeRequestResponse> {\n if (this._taskProducers.length >= this._bufferSize) {\n return Promise.reject(SENTRY_BUFFER_FULL_ERROR);\n }\n\n this._taskProducers.push(taskProducer);\n return Promise.resolve({});\n }\n\n /**\n * @inheritdoc\n */\n public drain(timeout?: number): PromiseLike<boolean> {\n const oldTaskProducers = [...this._taskProducers];\n this._taskProducers = [];\n\n const drainController = new AbortController();\n this.drainSignal = drainController.signal;\n const tasks = oldTaskProducers.map(taskProducer => {\n // A request that throws synchronously, such as a custom `fetch`, must not stop the other requests\n // or throw into the caller.\n try {\n return taskProducer();\n } catch (error) {\n return Promise.reject(error);\n }\n });\n this.drainSignal = undefined;\n\n return new Promise(resolve => {\n const timer = setTimeout(() => {\n if (timeout && timeout > 0) {\n // Requests still pending when the drain times out are aborted. Otherwise Cloudflare keeps them\n // until it cancels the invocation's `waitUntil` work and logs a warning.\n drainController.abort();\n resolve(false);\n }\n }, timeout);\n\n // This cannot reject\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n Promise.all(\n tasks.map(task =>\n task.then(null, () => {\n // catch all failed requests\n }),\n ),\n ).then(() => {\n // resolve to true if all fetch requests settled\n clearTimeout(timer);\n resolve(true);\n });\n });\n }\n}\n\n/**\n * Creates a Transport that uses the native fetch API to send events to Sentry.\n */\nexport function makeCloudflareTransport(options: CloudflareTransportOptions): Transport {\n const buffer = new IsolatedPromiseBuffer(options.bufferSize);\n\n function makeRequest(request: TransportRequest): PromiseLike<TransportMakeRequestResponse> {\n const drainSignal = buffer.drainSignal;\n const callerSignal = options.fetchOptions?.signal ?? undefined;\n const signal =\n drainSignal && callerSignal ? AbortSignal.any([drainSignal, callerSignal]) : (drainSignal ?? callerSignal);\n\n const requestOptions: RequestInit = {\n body: request.body as BodyInit,\n method: 'POST',\n headers: options.headers,\n ...options.fetchOptions,\n ...(signal ? { signal } : {}),\n };\n\n return suppressTracing(() => {\n return (options.fetch ?? fetch)(options.url, requestOptions).then(async response => {\n // Consume the response body to satisfy Cloudflare Workers' fetch requirements.\n // The runtime requires all fetch response bodies to be read or explicitly canceled\n // to prevent connection stalls and potential deadlocks. We read the body as text\n // even though we don't use the content, as Sentry's response information is in the headers.\n // See: https://github.com/getsentry/sentry-javascript/issues/18534\n try {\n await response.text();\n } catch {\n // no-op\n }\n\n return {\n statusCode: response.status,\n headers: {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n },\n };\n });\n });\n }\n\n return createTransport(options, makeRequest, buffer);\n}\n"],"
|
|
1
|
+
{"version":3,"file":"transport.js","names":["SENTRY_BUFFER_FULL_ERROR","suppressTracing","createTransport"],"sources":["../../../src/transport.ts"],"sourcesContent":["import type { BaseTransportOptions, Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core';\nimport { createTransport, SENTRY_BUFFER_FULL_ERROR, suppressTracing } from '@sentry/core';\n\nexport interface CloudflareTransportOptions extends BaseTransportOptions {\n /** Custom fetch function to use. This allows usage of things like Workers VPC */\n fetch?: typeof fetch;\n /** Fetch API init parameters. */\n fetchOptions?: RequestInit;\n}\n\n/**\n * How many payloads the buffer holds before it starts rejecting new ones.\n *\n * With `cacheClient` a single client is reused across an isolate's invocations, so one buffer now has to absorb\n * the payloads of many invocations rather than one. 256 is the size that held up under load testing that scenario.\n */\nconst DEFAULT_TRANSPORT_BUFFER_SIZE = 256;\n\n/**\n * This is a modified promise buffer that collects tasks until drain is called.\n * We need this in the edge runtime because edge function invocations may not share I/O objects, like fetch requests\n * and responses, and the normal PromiseBuffer inherently buffers stuff inbetween incoming requests.\n *\n * A limitation we need to be aware of is that DEFAULT_TRANSPORT_BUFFER_SIZE is the maximum amount of payloads the\n * SDK can send for a given edge function invocation.\n */\nexport class IsolatedPromiseBuffer {\n // We just have this field because the promise buffer interface requires it.\n // If we ever remove it from the interface we should also remove it here.\n public $: Array<PromiseLike<TransportMakeRequestResponse>>;\n\n /**\n * Abort signal of the drain that is starting its requests. It is set only while `drain()` runs the task\n * producers, so a request reads the signal of the drain that sends it.\n */\n public drainSignal: AbortSignal | undefined;\n\n private _taskProducers: (() => PromiseLike<TransportMakeRequestResponse>)[];\n\n private readonly _bufferSize: number;\n\n public constructor(_bufferSize = DEFAULT_TRANSPORT_BUFFER_SIZE) {\n this.$ = [];\n this._taskProducers = [];\n this._bufferSize = _bufferSize;\n }\n\n /**\n * @inheritdoc\n */\n public add(taskProducer: () => PromiseLike<TransportMakeRequestResponse>): PromiseLike<TransportMakeRequestResponse> {\n if (this._taskProducers.length >= this._bufferSize) {\n return Promise.reject(SENTRY_BUFFER_FULL_ERROR);\n }\n\n this._taskProducers.push(taskProducer);\n return Promise.resolve({});\n }\n\n /**\n * @inheritdoc\n */\n public drain(timeout?: number): PromiseLike<boolean> {\n const oldTaskProducers = [...this._taskProducers];\n this._taskProducers = [];\n\n const drainController = new AbortController();\n this.drainSignal = drainController.signal;\n const tasks = oldTaskProducers.map(taskProducer => {\n // A request that throws synchronously, such as a custom `fetch`, must not stop the other requests\n // or throw into the caller.\n try {\n return taskProducer();\n } catch (error) {\n return Promise.reject(error);\n }\n });\n this.drainSignal = undefined;\n\n return new Promise(resolve => {\n const timer = setTimeout(() => {\n if (timeout && timeout > 0) {\n // Requests still pending when the drain times out are aborted. Otherwise Cloudflare keeps them\n // until it cancels the invocation's `waitUntil` work and logs a warning.\n drainController.abort();\n resolve(false);\n }\n }, timeout);\n\n // This cannot reject\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n Promise.all(\n tasks.map(task =>\n task.then(null, () => {\n // catch all failed requests\n }),\n ),\n ).then(() => {\n // resolve to true if all fetch requests settled\n clearTimeout(timer);\n resolve(true);\n });\n });\n }\n}\n\n/**\n * Creates a Transport that uses the native fetch API to send events to Sentry.\n */\nexport function makeCloudflareTransport(options: CloudflareTransportOptions): Transport {\n const buffer = new IsolatedPromiseBuffer(options.bufferSize);\n\n function makeRequest(request: TransportRequest): PromiseLike<TransportMakeRequestResponse> {\n const drainSignal = buffer.drainSignal;\n const callerSignal = options.fetchOptions?.signal ?? undefined;\n const signal =\n drainSignal && callerSignal ? AbortSignal.any([drainSignal, callerSignal]) : (drainSignal ?? callerSignal);\n\n const requestOptions: RequestInit = {\n body: request.body as BodyInit,\n method: 'POST',\n headers: options.headers,\n ...options.fetchOptions,\n ...(signal ? { signal } : {}),\n };\n\n return suppressTracing(() => {\n return (options.fetch ?? fetch)(options.url, requestOptions).then(async response => {\n // Consume the response body to satisfy Cloudflare Workers' fetch requirements.\n // The runtime requires all fetch response bodies to be read or explicitly canceled\n // to prevent connection stalls and potential deadlocks. We read the body as text\n // even though we don't use the content, as Sentry's response information is in the headers.\n // See: https://github.com/getsentry/sentry-javascript/issues/18534\n try {\n await response.text();\n } catch {\n // no-op\n }\n\n return {\n statusCode: response.status,\n headers: {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n },\n };\n });\n });\n }\n\n return createTransport(options, makeRequest, buffer);\n}\n"],"mappings":";;;;;;;;AAgBA,MAAM,gCAAgC;;;;;;;;;AAUtC,IAAa,wBAAb,MAAmC;CAe1B,YAAY,cAAc,+BAA+B;EAC9D,KAAK,IAAI,CAAC;EACV,KAAK,iBAAiB,CAAC;EACvB,KAAK,cAAc;CACrB;;;;CAKO,IAAI,cAA0G;EACnH,IAAI,KAAK,eAAe,UAAU,KAAK,aACrC,OAAO,QAAQ,OAAOA,aAAAA,wBAAwB;EAGhD,KAAK,eAAe,KAAK,YAAY;EACrC,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAC3B;;;;CAKO,MAAM,SAAwC;EACnD,MAAM,mBAAmB,CAAC,GAAG,KAAK,cAAc;EAChD,KAAK,iBAAiB,CAAC;EAEvB,MAAM,kBAAkB,IAAI,gBAAgB;EAC5C,KAAK,cAAc,gBAAgB;EACnC,MAAM,QAAQ,iBAAiB,KAAI,iBAAgB;GAGjD,IAAI;IACF,OAAO,aAAa;GACtB,SAAS,OAAO;IACd,OAAO,QAAQ,OAAO,KAAK;GAC7B;EACF,CAAC;EACD,KAAK,cAAc,KAAA;EAEnB,OAAO,IAAI,SAAQ,YAAW;GAC5B,MAAM,QAAQ,iBAAiB;IAC7B,IAAI,WAAW,UAAU,GAAG;KAG1B,gBAAgB,MAAM;KACtB,QAAQ,KAAK;IACf;GACF,GAAG,OAAO;GAIV,QAAQ,IACN,MAAM,KAAI,SACR,KAAK,KAAK,YAAY,CAEtB,CAAC,CACH,CACF,CAAC,CAAC,WAAW;IAEX,aAAa,KAAK;IAClB,QAAQ,IAAI;GACd,CAAC;EACH,CAAC;CACH;AACF;;;;AAKA,SAAgB,wBAAwB,SAAgD;CACtF,MAAM,SAAS,IAAI,sBAAsB,QAAQ,UAAU;CAE3D,SAAS,YAAY,SAAsE;EACzF,MAAM,cAAc,OAAO;EAC3B,MAAM,eAAe,QAAQ,cAAc,UAAU,KAAA;EACrD,MAAM,SACJ,eAAe,eAAe,YAAY,IAAI,CAAC,aAAa,YAAY,CAAC,IAAK,eAAe;EAE/F,MAAM,iBAA8B;GAClC,MAAM,QAAQ;GACd,QAAQ;GACR,SAAS,QAAQ;GACjB,GAAG,QAAQ;GACX,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;EAC7B;EAEA,QAAA,GAAOC,aAAAA,gBAAAA,OAAsB;GAC3B,QAAQ,QAAQ,SAAS,MAAA,CAAO,QAAQ,KAAK,cAAc,CAAC,CAAC,KAAK,OAAM,aAAY;IAMlF,IAAI;KACF,MAAM,SAAS,KAAK;IACtB,QAAQ,CAER;IAEA,OAAO;KACL,YAAY,SAAS;KACrB,SAAS;MACP,wBAAwB,SAAS,QAAQ,IAAI,sBAAsB;MACnE,eAAe,SAAS,QAAQ,IAAI,aAAa;KACnD;IACF;GACF,CAAC;EACH,CAAC;CACH;CAEA,QAAA,GAAOC,aAAAA,gBAAAA,CAAgB,SAAS,aAAa,MAAM;AACrD"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
let _sentry_core = require("@sentry/core");
|
|
2
|
+
let _sentry_server_utils_no_diagnostic_channels = require("@sentry/server-utils/no-diagnostic-channels");
|
|
3
|
+
// src/utils/asyncContextStrategy.ts
|
|
4
|
+
/**
|
|
5
|
+
* Installs the AsyncLocalStorage strategy unless an OpenTelemetry strategy is installed. Both use the same storage,
|
|
6
|
+
* so a switch during a request breaks it (#24603).
|
|
7
|
+
*/
|
|
6
8
|
function setAsyncLocalStorageAsyncContextStrategyForWorker() {
|
|
7
|
-
|
|
8
|
-
noDiagnosticChannels.setAsyncLocalStorageAsyncContextStrategy();
|
|
9
|
-
}
|
|
9
|
+
if (!(0, _sentry_core.getAsyncContextStrategy)((0, _sentry_core.getMainCarrier)()).withActiveSpan) (0, _sentry_server_utils_no_diagnostic_channels.setAsyncLocalStorageAsyncContextStrategy)();
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
exports.setAsyncLocalStorageAsyncContextStrategyForWorker = setAsyncLocalStorageAsyncContextStrategyForWorker;
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=asyncContextStrategy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asyncContextStrategy.js","sources":["../../../../src/utils/asyncContextStrategy.ts"],"sourcesContent":["import { getAsyncContextStrategy, getMainCarrier } from '@sentry/core';\nimport { setAsyncLocalStorageAsyncContextStrategy } from '@sentry/server-utils/no-diagnostic-channels';\n\n/**\n * Installs the AsyncLocalStorage strategy unless an OpenTelemetry strategy is installed. Both use the same storage,\n * so a switch during a request breaks it (#24603).\n */\nexport function setAsyncLocalStorageAsyncContextStrategyForWorker(): void {\n if (!getAsyncContextStrategy(getMainCarrier()).withActiveSpan) {\n setAsyncLocalStorageAsyncContextStrategy();\n }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"asyncContextStrategy.js","names":["getAsyncContextStrategy","getMainCarrier","setAsyncLocalStorageAsyncContextStrategy"],"sources":["../../../../src/utils/asyncContextStrategy.ts"],"sourcesContent":["import { getAsyncContextStrategy, getMainCarrier } from '@sentry/core';\nimport { setAsyncLocalStorageAsyncContextStrategy } from '@sentry/server-utils/no-diagnostic-channels';\n\n/**\n * Installs the AsyncLocalStorage strategy unless an OpenTelemetry strategy is installed. Both use the same storage,\n * so a switch during a request breaks it (#24603).\n */\nexport function setAsyncLocalStorageAsyncContextStrategyForWorker(): void {\n if (!getAsyncContextStrategy(getMainCarrier()).withActiveSpan) {\n setAsyncLocalStorageAsyncContextStrategy();\n }\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,oDAA0D;CACxE,IAAI,EAAA,GAACA,aAAAA,wBAAAA,EAAAA,GAAwBC,aAAAA,eAAAA,CAAe,CAAC,CAAC,CAAC,gBAC7CC,CAAAA,GAAAA,4CAAAA,yCAAAA,CAAyC;AAE7C"}
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const core = require('@sentry/core');
|
|
4
|
-
|
|
1
|
+
let _sentry_core = require("@sentry/core");
|
|
2
|
+
// src/utils/bindingPropagation.ts
|
|
5
3
|
const PROPAGATE_TO_NONE = () => false;
|
|
4
|
+
/**
|
|
5
|
+
* Builds the per-binding predicate that decides whether a binding takes part in trace propagation.
|
|
6
|
+
*/
|
|
6
7
|
function createBindingPropagationResolver(bindings) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
return (bindingName) => core.matchesTracePropagationTargets(bindingName, bindings, true);
|
|
8
|
+
if (!bindings?.length) return PROPAGATE_TO_NONE;
|
|
9
|
+
return (bindingName) => (0, _sentry_core.matchesTracePropagationTargets)(bindingName, bindings, true);
|
|
11
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Builds the per-binding predicate that decides whether a binding takes part in RPC trace
|
|
13
|
+
* propagation.
|
|
14
|
+
*
|
|
15
|
+
* Callers only. Receivers continue an incoming trace whenever one arrives, so they have nothing to
|
|
16
|
+
* match against.
|
|
17
|
+
*/
|
|
12
18
|
function createRpcPropagationResolver(options) {
|
|
13
|
-
|
|
19
|
+
return createBindingPropagationResolver(options?.rpcTracePropagationBindings);
|
|
14
20
|
}
|
|
15
|
-
|
|
16
21
|
exports.createBindingPropagationResolver = createBindingPropagationResolver;
|
|
17
22
|
exports.createRpcPropagationResolver = createRpcPropagationResolver;
|
|
18
|
-
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=bindingPropagation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindingPropagation.js","sources":["../../../../src/utils/bindingPropagation.ts"],"sourcesContent":["import { matchesTracePropagationTargets, type TracePropagationTargets } from '@sentry/core';\nimport type { CloudflareOptions } from '../client';\n\nconst PROPAGATE_TO_NONE = () => false;\n\n/**\n * Builds the per-binding predicate that decides whether a binding takes part in trace propagation.\n */\nexport function createBindingPropagationResolver(\n bindings: TracePropagationTargets | undefined,\n): (bindingName: string) => boolean {\n if (!bindings?.length) {\n return PROPAGATE_TO_NONE;\n }\n\n // Strings must match a binding name exactly, without this, an entry of `DB` would also enable\n // propagation for a binding named `MY_DB`. Regular expressions still give pattern matching.\n return (bindingName: string) => matchesTracePropagationTargets(bindingName, bindings, true);\n}\n\n/**\n * Builds the per-binding predicate that decides whether a binding takes part in RPC trace\n * propagation.\n *\n * Callers only. Receivers continue an incoming trace whenever one arrives, so they have nothing to\n * match against.\n */\nexport function createRpcPropagationResolver(options: CloudflareOptions | undefined): (bindingName: string) => boolean {\n return createBindingPropagationResolver(options?.rpcTracePropagationBindings);\n}\n"],"
|
|
1
|
+
{"version":3,"file":"bindingPropagation.js","names":["matchesTracePropagationTargets"],"sources":["../../../../src/utils/bindingPropagation.ts"],"sourcesContent":["import { matchesTracePropagationTargets, type TracePropagationTargets } from '@sentry/core';\nimport type { CloudflareOptions } from '../client';\n\nconst PROPAGATE_TO_NONE = () => false;\n\n/**\n * Builds the per-binding predicate that decides whether a binding takes part in trace propagation.\n */\nexport function createBindingPropagationResolver(\n bindings: TracePropagationTargets | undefined,\n): (bindingName: string) => boolean {\n if (!bindings?.length) {\n return PROPAGATE_TO_NONE;\n }\n\n // Strings must match a binding name exactly, without this, an entry of `DB` would also enable\n // propagation for a binding named `MY_DB`. Regular expressions still give pattern matching.\n return (bindingName: string) => matchesTracePropagationTargets(bindingName, bindings, true);\n}\n\n/**\n * Builds the per-binding predicate that decides whether a binding takes part in RPC trace\n * propagation.\n *\n * Callers only. Receivers continue an incoming trace whenever one arrives, so they have nothing to\n * match against.\n */\nexport function createRpcPropagationResolver(options: CloudflareOptions | undefined): (bindingName: string) => boolean {\n return createBindingPropagationResolver(options?.rpcTracePropagationBindings);\n}\n"],"mappings":";;AAGA,MAAM,0BAA0B;;;;AAKhC,SAAgB,iCACd,UACkC;CAClC,IAAI,CAAC,UAAU,QACb,OAAO;CAKT,QAAQ,iBAAA,GAAwBA,aAAAA,+BAAAA,CAA+B,aAAa,UAAU,IAAI;AAC5F;;;;;;;;AASA,SAAgB,6BAA6B,SAA0E;CACrH,OAAO,iCAAiC,SAAS,2BAA2B;AAC9E"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
let _sentry_core = require("@sentry/core");
|
|
2
|
+
// src/utils/cloudflareTrace.ts
|
|
3
|
+
const TRACE_ID_REGEXP = /^(?!0{32})[0-9a-f]{32}$/;
|
|
4
|
+
const SPAN_ID_REGEXP = /^(?!0{16})[0-9a-f]{16}$/;
|
|
5
|
+
/**
|
|
6
|
+
* Sets the propagation context of the current scope to the Cloudflare trace of the invocation, so
|
|
7
|
+
* errors, logs and spans get the trace id of the spans that Cloudflare exports.
|
|
8
|
+
*
|
|
9
|
+
* Only runs when Sentry tracing is not set up (no `tracesSampleRate` or `tracesSampler`), so a trace
|
|
10
|
+
* has one source: either the SDK or Cloudflare, never a mix of both.
|
|
11
|
+
*
|
|
12
|
+
* Does nothing when the current scope already continues a trace, for example an incoming Sentry
|
|
13
|
+
* trace, when Cloudflare does not trace the invocation, or when the runtime does not expose
|
|
14
|
+
* `Span.spanContext()`.
|
|
15
|
+
*/
|
|
16
|
+
function continueCloudflareTrace(context) {
|
|
17
|
+
if ((0, _sentry_core.hasSpansEnabled)() || (0, _sentry_core.isContinuingTrace)((0, _sentry_core.getCurrentScope)().getPropagationContext())) return;
|
|
18
|
+
let spanContext;
|
|
19
|
+
try {
|
|
20
|
+
const span = context?.tracing?.getActiveSpan?.();
|
|
21
|
+
spanContext = span?.isTraced ? span.spanContext?.() : void 0;
|
|
22
|
+
} catch {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (!spanContext || !TRACE_ID_REGEXP.test(spanContext.traceId) || !SPAN_ID_REGEXP.test(spanContext.spanId)) return;
|
|
26
|
+
(0, _sentry_core.getCurrentScope)().setPropagationContext({
|
|
27
|
+
traceId: spanContext.traceId,
|
|
28
|
+
parentSpanId: spanContext.spanId,
|
|
29
|
+
sampleRand: (0, _sentry_core._INTERNAL_safeMathRandom)()
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.continueCloudflareTrace = continueCloudflareTrace;
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=cloudflareTrace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflareTrace.js","names":["hasSpansEnabled","isContinuingTrace","getCurrentScope","_INTERNAL_safeMathRandom"],"sources":["../../../../src/utils/cloudflareTrace.ts"],"sourcesContent":["import { _INTERNAL_safeMathRandom, getCurrentScope, hasSpansEnabled, isContinuingTrace } from '@sentry/core';\n\ninterface CloudflareSpanContext {\n traceId: string;\n spanId: string;\n}\n\n// The part of `ctx.tracing` the SDK reads. `getActiveSpan` and `Span.spanContext` exist only in\n// newer runtimes, so every member is optional.\ninterface CloudflareTracing {\n getActiveSpan?: () =>\n | {\n readonly isTraced?: boolean;\n spanContext?: () => CloudflareSpanContext;\n }\n | undefined;\n}\n\nconst TRACE_ID_REGEXP = /^(?!0{32})[0-9a-f]{32}$/;\nconst SPAN_ID_REGEXP = /^(?!0{16})[0-9a-f]{16}$/;\n\n/**\n * Sets the propagation context of the current scope to the Cloudflare trace of the invocation, so\n * errors, logs and spans get the trace id of the spans that Cloudflare exports.\n *\n * Only runs when Sentry tracing is not set up (no `tracesSampleRate` or `tracesSampler`), so a trace\n * has one source: either the SDK or Cloudflare, never a mix of both.\n *\n * Does nothing when the current scope already continues a trace, for example an incoming Sentry\n * trace, when Cloudflare does not trace the invocation, or when the runtime does not expose\n * `Span.spanContext()`.\n */\nexport function continueCloudflareTrace(context: unknown): void {\n if (hasSpansEnabled() || isContinuingTrace(getCurrentScope().getPropagationContext())) {\n return;\n }\n\n let spanContext: CloudflareSpanContext | undefined;\n try {\n const span = (context as { tracing?: CloudflareTracing } | undefined)?.tracing?.getActiveSpan?.();\n spanContext = span?.isTraced ? span.spanContext?.() : undefined;\n } catch {\n // Runtime getters on the execution context can throw on foreign or already-torn-down contexts.\n return;\n }\n\n if (!spanContext || !TRACE_ID_REGEXP.test(spanContext.traceId) || !SPAN_ID_REGEXP.test(spanContext.spanId)) {\n return;\n }\n\n // No `dsc` and no `sampled`: the SDK is the head of the Sentry trace, so it builds the dynamic\n // sampling context itself.\n getCurrentScope().setPropagationContext({\n traceId: spanContext.traceId,\n parentSpanId: spanContext.spanId,\n sampleRand: _INTERNAL_safeMathRandom(),\n });\n}\n"],"mappings":";;AAkBA,MAAM,kBAAkB;AACxB,MAAM,iBAAiB;;;;;;;;;;;;AAavB,SAAgB,wBAAwB,SAAwB;CAC9D,KAAA,GAAIA,aAAAA,gBAAAA,CAAgB,MAAA,GAAKC,aAAAA,kBAAAA,EAAAA,GAAkBC,aAAAA,gBAAAA,CAAgB,CAAC,CAAC,sBAAsB,CAAC,GAClF;CAGF,IAAI;CACJ,IAAI;EACF,MAAM,OAAQ,SAAyD,SAAS,gBAAgB;EAChG,cAAc,MAAM,WAAW,KAAK,cAAc,IAAI,KAAA;CACxD,QAAQ;EAEN;CACF;CAEA,IAAI,CAAC,eAAe,CAAC,gBAAgB,KAAK,YAAY,OAAO,KAAK,CAAC,eAAe,KAAK,YAAY,MAAM,GACvG;CAKFA,CAAAA,GAAAA,aAAAA,gBAAAA,CAAgB,CAAC,CAAC,sBAAsB;EACtC,SAAS,YAAY;EACrB,cAAc,YAAY;EAC1B,aAAA,GAAYC,aAAAA,yBAAAA,CAAyB;CACvC,CAAC;AACH"}
|
|
@@ -1,63 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const require_instrumentDurableObjectStorage = require("../instrumentations/instrumentDurableObjectStorage.js");
|
|
2
|
+
// src/utils/instrumentContext.ts
|
|
3
|
+
/**
|
|
4
|
+
* Instruments an execution context or DurableObjectState with Sentry tracing.
|
|
5
|
+
*
|
|
6
|
+
* Creates a copy of the context that:
|
|
7
|
+
* - Allows overriding of methods (e.g., waitUntil)
|
|
8
|
+
* - For DurableObjectState: instruments storage operations (get, put, delete, list, etc.)
|
|
9
|
+
* to create Sentry spans automatically
|
|
10
|
+
*
|
|
11
|
+
* @param ctx - The execution context or DurableObjectState to instrument
|
|
12
|
+
* @returns An instrumented copy of the context
|
|
13
|
+
*/
|
|
5
14
|
function instrumentContext(ctx) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
get: () => originalStorage
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
return Object.create(ctx, descriptors);
|
|
15
|
+
if (!ctx) return ctx;
|
|
16
|
+
const overrides = /* @__PURE__ */ new Map();
|
|
17
|
+
const contextPrototype = Object.getPrototypeOf(ctx);
|
|
18
|
+
const prototypeMethodNames = Object.getOwnPropertyNames(contextPrototype);
|
|
19
|
+
const ownPropertyNames = Object.getOwnPropertyNames(ctx);
|
|
20
|
+
const instrumented = /* @__PURE__ */ new Set(["constructor"]);
|
|
21
|
+
const descriptors = {};
|
|
22
|
+
for (const methodName of [...ownPropertyNames, ...prototypeMethodNames]) {
|
|
23
|
+
if (instrumented.has(methodName) || typeof ctx[methodName] !== "function") continue;
|
|
24
|
+
instrumented.add(methodName);
|
|
25
|
+
descriptors[methodName] = makeOverridableDescriptor(overrides, ctx, methodName);
|
|
26
|
+
}
|
|
27
|
+
if ("storage" in ctx && ctx.storage) {
|
|
28
|
+
const originalStorage = ctx.storage;
|
|
29
|
+
const waitUntil = "waitUntil" in ctx && typeof ctx.waitUntil === "function" ? ctx.waitUntil.bind(ctx) : void 0;
|
|
30
|
+
let instrumentedStorage;
|
|
31
|
+
descriptors.storage = {
|
|
32
|
+
configurable: true,
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: () => {
|
|
35
|
+
if (!instrumentedStorage) instrumentedStorage = require_instrumentDurableObjectStorage.instrumentDurableObjectStorage(originalStorage, waitUntil);
|
|
36
|
+
return instrumentedStorage;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
descriptors.originalStorage = {
|
|
40
|
+
configurable: true,
|
|
41
|
+
enumerable: false,
|
|
42
|
+
get: () => originalStorage
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return Object.create(ctx, descriptors);
|
|
41
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Creates a property descriptor that allows overriding of a method on the given context object.
|
|
49
|
+
*
|
|
50
|
+
* This descriptor supports property overriding with functions only. It delegates method calls to
|
|
51
|
+
* the provided store if an override exists or to the original method on the context otherwise.
|
|
52
|
+
*
|
|
53
|
+
* @param {OverridesStore<ContextType>} store - The storage for overridden methods specific to the context type.
|
|
54
|
+
* @param {ContextType} ctx - The context object that contains the method to be overridden.
|
|
55
|
+
* @param {keyof ContextType} method - The method on the context object to create the overridable descriptor for.
|
|
56
|
+
* @return {PropertyDescriptor} A property descriptor enabling the overriding of the specified method.
|
|
57
|
+
*/
|
|
42
58
|
function makeOverridableDescriptor(store, ctx, method) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
return {
|
|
60
|
+
configurable: true,
|
|
61
|
+
enumerable: true,
|
|
62
|
+
set: (newValue) => {
|
|
63
|
+
if (typeof newValue == "function") {
|
|
64
|
+
store.set(method, newValue);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
Reflect.set(ctx, method, newValue);
|
|
68
|
+
},
|
|
69
|
+
get: () => {
|
|
70
|
+
if (store.has(method)) return store.get(method);
|
|
71
|
+
const methodFunction = Reflect.get(ctx, method);
|
|
72
|
+
if (typeof methodFunction !== "function") return methodFunction;
|
|
73
|
+
return methodFunction.bind(ctx);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
60
76
|
}
|
|
61
|
-
|
|
62
77
|
exports.instrumentContext = instrumentContext;
|
|
63
|
-
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=instrumentContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentContext.js","sources":["../../../../src/utils/instrumentContext.ts"],"sourcesContent":["import { type DurableObjectState, type DurableObjectStorage, type ExecutionContext } from '@cloudflare/workers-types';\nimport { instrumentDurableObjectStorage } from '../instrumentations/instrumentDurableObjectStorage';\n\ntype ContextType = ExecutionContext | DurableObjectState;\ntype OverridesStore<T extends ContextType> = Map<keyof T, (...args: unknown[]) => unknown>;\n\n/**\n * Instruments an execution context or DurableObjectState with Sentry tracing.\n *\n * Creates a copy of the context that:\n * - Allows overriding of methods (e.g., waitUntil)\n * - For DurableObjectState: instruments storage operations (get, put, delete, list, etc.)\n * to create Sentry spans automatically\n *\n * @param ctx - The execution context or DurableObjectState to instrument\n * @returns An instrumented copy of the context\n */\nexport function instrumentContext<T extends ContextType>(ctx: T): T {\n if (!ctx) return ctx;\n\n const overrides: OverridesStore<T> = new Map();\n const contextPrototype = Object.getPrototypeOf(ctx);\n const prototypeMethodNames = Object.getOwnPropertyNames(contextPrototype) as unknown as (keyof T)[];\n const ownPropertyNames = Object.getOwnPropertyNames(ctx) as unknown as (keyof T)[];\n const instrumented = new Set<unknown>(['constructor']);\n const descriptors: PropertyDescriptorMap = {};\n\n for (const methodName of [...ownPropertyNames, ...prototypeMethodNames]) {\n if (instrumented.has(methodName) || typeof ctx[methodName] !== 'function') {\n continue;\n }\n\n instrumented.add(methodName);\n descriptors[methodName as string] = makeOverridableDescriptor(overrides, ctx, methodName);\n }\n\n // Check if this is a DurableObjectState context with a storage property\n // If so, wrap the storage with instrumentation\n if ('storage' in ctx && ctx.storage) {\n const originalStorage = ctx.storage;\n const waitUntil = 'waitUntil' in ctx && typeof ctx.waitUntil === 'function' ? ctx.waitUntil.bind(ctx) : undefined;\n let instrumentedStorage: DurableObjectStorage | undefined;\n descriptors.storage = {\n configurable: true,\n enumerable: true,\n get: () => {\n if (!instrumentedStorage) {\n instrumentedStorage = instrumentDurableObjectStorage(originalStorage, waitUntil);\n }\n return instrumentedStorage;\n },\n };\n // Expose the original uninstrumented storage for internal Sentry operations\n // This avoids creating spans for internal storage operations\n descriptors.originalStorage = {\n configurable: true,\n enumerable: false,\n get: () => originalStorage,\n };\n }\n\n return Object.create(ctx, descriptors);\n}\n\n/**\n * Creates a property descriptor that allows overriding of a method on the given context object.\n *\n * This descriptor supports property overriding with functions only. It delegates method calls to\n * the provided store if an override exists or to the original method on the context otherwise.\n *\n * @param {OverridesStore<ContextType>} store - The storage for overridden methods specific to the context type.\n * @param {ContextType} ctx - The context object that contains the method to be overridden.\n * @param {keyof ContextType} method - The method on the context object to create the overridable descriptor for.\n * @return {PropertyDescriptor} A property descriptor enabling the overriding of the specified method.\n */\nfunction makeOverridableDescriptor<T extends ContextType>(\n store: OverridesStore<T>,\n ctx: T,\n method: keyof T,\n): PropertyDescriptor {\n return {\n configurable: true,\n enumerable: true,\n set: newValue => {\n if (typeof newValue == 'function') {\n store.set(method, newValue);\n return;\n }\n Reflect.set(ctx, method, newValue);\n },\n\n get: () => {\n if (store.has(method)) return store.get(method);\n const methodFunction = Reflect.get(ctx, method);\n if (typeof methodFunction !== 'function') return methodFunction;\n // We should do bind() to make sure that the method is bound to the context object - otherwise it will not work\n return methodFunction.bind(ctx);\n },\n };\n}\n"],"
|
|
1
|
+
{"version":3,"file":"instrumentContext.js","names":["instrumentDurableObjectStorage"],"sources":["../../../../src/utils/instrumentContext.ts"],"sourcesContent":["import { type DurableObjectState, type DurableObjectStorage, type ExecutionContext } from '@cloudflare/workers-types';\nimport { instrumentDurableObjectStorage } from '../instrumentations/instrumentDurableObjectStorage';\n\ntype ContextType = ExecutionContext | DurableObjectState;\ntype OverridesStore<T extends ContextType> = Map<keyof T, (...args: unknown[]) => unknown>;\n\n/**\n * Instruments an execution context or DurableObjectState with Sentry tracing.\n *\n * Creates a copy of the context that:\n * - Allows overriding of methods (e.g., waitUntil)\n * - For DurableObjectState: instruments storage operations (get, put, delete, list, etc.)\n * to create Sentry spans automatically\n *\n * @param ctx - The execution context or DurableObjectState to instrument\n * @returns An instrumented copy of the context\n */\nexport function instrumentContext<T extends ContextType>(ctx: T): T {\n if (!ctx) return ctx;\n\n const overrides: OverridesStore<T> = new Map();\n const contextPrototype = Object.getPrototypeOf(ctx);\n const prototypeMethodNames = Object.getOwnPropertyNames(contextPrototype) as unknown as (keyof T)[];\n const ownPropertyNames = Object.getOwnPropertyNames(ctx) as unknown as (keyof T)[];\n const instrumented = new Set<unknown>(['constructor']);\n const descriptors: PropertyDescriptorMap = {};\n\n for (const methodName of [...ownPropertyNames, ...prototypeMethodNames]) {\n if (instrumented.has(methodName) || typeof ctx[methodName] !== 'function') {\n continue;\n }\n\n instrumented.add(methodName);\n descriptors[methodName as string] = makeOverridableDescriptor(overrides, ctx, methodName);\n }\n\n // Check if this is a DurableObjectState context with a storage property\n // If so, wrap the storage with instrumentation\n if ('storage' in ctx && ctx.storage) {\n const originalStorage = ctx.storage;\n const waitUntil = 'waitUntil' in ctx && typeof ctx.waitUntil === 'function' ? ctx.waitUntil.bind(ctx) : undefined;\n let instrumentedStorage: DurableObjectStorage | undefined;\n descriptors.storage = {\n configurable: true,\n enumerable: true,\n get: () => {\n if (!instrumentedStorage) {\n instrumentedStorage = instrumentDurableObjectStorage(originalStorage, waitUntil);\n }\n return instrumentedStorage;\n },\n };\n // Expose the original uninstrumented storage for internal Sentry operations\n // This avoids creating spans for internal storage operations\n descriptors.originalStorage = {\n configurable: true,\n enumerable: false,\n get: () => originalStorage,\n };\n }\n\n return Object.create(ctx, descriptors);\n}\n\n/**\n * Creates a property descriptor that allows overriding of a method on the given context object.\n *\n * This descriptor supports property overriding with functions only. It delegates method calls to\n * the provided store if an override exists or to the original method on the context otherwise.\n *\n * @param {OverridesStore<ContextType>} store - The storage for overridden methods specific to the context type.\n * @param {ContextType} ctx - The context object that contains the method to be overridden.\n * @param {keyof ContextType} method - The method on the context object to create the overridable descriptor for.\n * @return {PropertyDescriptor} A property descriptor enabling the overriding of the specified method.\n */\nfunction makeOverridableDescriptor<T extends ContextType>(\n store: OverridesStore<T>,\n ctx: T,\n method: keyof T,\n): PropertyDescriptor {\n return {\n configurable: true,\n enumerable: true,\n set: newValue => {\n if (typeof newValue == 'function') {\n store.set(method, newValue);\n return;\n }\n Reflect.set(ctx, method, newValue);\n },\n\n get: () => {\n if (store.has(method)) return store.get(method);\n const methodFunction = Reflect.get(ctx, method);\n if (typeof methodFunction !== 'function') return methodFunction;\n // We should do bind() to make sure that the method is bound to the context object - otherwise it will not work\n return methodFunction.bind(ctx);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAiBA,SAAgB,kBAAyC,KAAW;CAClE,IAAI,CAAC,KAAK,OAAO;CAEjB,MAAM,4BAA+B,IAAI,IAAI;CAC7C,MAAM,mBAAmB,OAAO,eAAe,GAAG;CAClD,MAAM,uBAAuB,OAAO,oBAAoB,gBAAgB;CACxE,MAAM,mBAAmB,OAAO,oBAAoB,GAAG;CACvD,MAAM,+BAAe,IAAI,IAAa,CAAC,aAAa,CAAC;CACrD,MAAM,cAAqC,CAAC;CAE5C,KAAK,MAAM,cAAc,CAAC,GAAG,kBAAkB,GAAG,oBAAoB,GAAG;EACvE,IAAI,aAAa,IAAI,UAAU,KAAK,OAAO,IAAI,gBAAgB,YAC7D;EAGF,aAAa,IAAI,UAAU;EAC3B,YAAY,cAAwB,0BAA0B,WAAW,KAAK,UAAU;CAC1F;CAIA,IAAI,aAAa,OAAO,IAAI,SAAS;EACnC,MAAM,kBAAkB,IAAI;EAC5B,MAAM,YAAY,eAAe,OAAO,OAAO,IAAI,cAAc,aAAa,IAAI,UAAU,KAAK,GAAG,IAAI,KAAA;EACxG,IAAI;EACJ,YAAY,UAAU;GACpB,cAAc;GACd,YAAY;GACZ,WAAW;IACT,IAAI,CAAC,qBACH,sBAAsBA,uCAAAA,+BAA+B,iBAAiB,SAAS;IAEjF,OAAO;GACT;EACF;EAGA,YAAY,kBAAkB;GAC5B,cAAc;GACd,YAAY;GACZ,WAAW;EACb;CACF;CAEA,OAAO,OAAO,OAAO,KAAK,WAAW;AACvC;;;;;;;;;;;;AAaA,SAAS,0BACP,OACA,KACA,QACoB;CACpB,OAAO;EACL,cAAc;EACd,YAAY;EACZ,MAAK,aAAY;GACf,IAAI,OAAO,YAAY,YAAY;IACjC,MAAM,IAAI,QAAQ,QAAQ;IAC1B;GACF;GACA,QAAQ,IAAI,KAAK,QAAQ,QAAQ;EACnC;EAEA,WAAW;GACT,IAAI,MAAM,IAAI,MAAM,GAAG,OAAO,MAAM,IAAI,MAAM;GAC9C,MAAM,iBAAiB,QAAQ,IAAI,KAAK,MAAM;GAC9C,IAAI,OAAO,mBAAmB,YAAY,OAAO;GAEjD,OAAO,eAAe,KAAK,GAAG;EAChC;CACF;AACF"}
|
|
@@ -1,32 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
let _sentry_core = require("@sentry/core");
|
|
2
|
+
// src/utils/internalSqlQuery.ts
|
|
3
|
+
/**
|
|
4
|
+
* Cloudflare frameworks that build on Durable Objects (`agents`, `partyserver`, ...) manage their
|
|
5
|
+
* own internal SQLite tables, all namespaced with a `cf_` prefix — e.g. `cf_agents_schedules`,
|
|
6
|
+
* `cf_agent_state`, `cf_ai_chat_stream_chunks`. Queries against them (schedule polling, chat-stream
|
|
7
|
+
* persistence, state bookkeeping) are framework implementation details that otherwise flood traces
|
|
8
|
+
* with dozens of zero-signal `db.query` spans per request. The exact set of tables even varies
|
|
9
|
+
* between framework versions, so we match the reserved prefix rather than an enumerated list.
|
|
10
|
+
*
|
|
11
|
+
* The `cf_` prefix is a reserved convention for framework-managed tables, so user tables should not
|
|
12
|
+
* use it. The same goes for `pi_`: the `PiHarness` of `agents` keeps the state of pi-durable in
|
|
13
|
+
* tables with that prefix, and one run writes close to 200 statements. In case a user table does
|
|
14
|
+
* collide with a prefix, the `durableObjectSqlSpanAllowlist` option lets them opt those tables back
|
|
15
|
+
* into instrumentation.
|
|
16
|
+
*
|
|
17
|
+
* The check operates on the query summary produced by `getSqlQuerySummary` (`{operation} {table} ...`,
|
|
18
|
+
* the same value used as the span name), so table targets are already isolated from the rest of the
|
|
19
|
+
* query. The one exception is `CREATE INDEX`: its summary carries the index name, not the indexed
|
|
20
|
+
* table (upstream OTel convention), so the `cf_` target only appears in the ON clause of the full
|
|
21
|
+
* statement, which `queryText` is needed for.
|
|
22
|
+
*/
|
|
5
23
|
function targetsCloudflareInternalTable(querySummary, allowlist, queryText) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return isCloudflareInternalTable(indexedTable, allowlist);
|
|
12
|
-
}
|
|
13
|
-
const [, ...tables] = querySummary.split(" ");
|
|
14
|
-
return tables.some((table) => isCloudflareInternalTable(table, allowlist));
|
|
24
|
+
if (!querySummary) return false;
|
|
25
|
+
const indexedTable = queryText ? CREATE_INDEX_TABLE_RE.exec(queryText)?.groups?.["table"] : void 0;
|
|
26
|
+
if (indexedTable) return isCloudflareInternalTable(indexedTable, allowlist);
|
|
27
|
+
const [, ...tables] = querySummary.split(" ");
|
|
28
|
+
return tables.some((table) => isCloudflareInternalTable(table, allowlist));
|
|
15
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Returns `false` when the raw `query` has no word that starts with `cf_` or `pi_`, so it cannot
|
|
32
|
+
* target a Cloudflare internal table. Needs no sanitizing, which makes it cheap enough to run on
|
|
33
|
+
* every query.
|
|
34
|
+
*/
|
|
16
35
|
function mayTargetCloudflareInternalTable(query) {
|
|
17
|
-
|
|
36
|
+
return INTERNAL_PREFIX_RE.test(query);
|
|
18
37
|
}
|
|
19
38
|
const INTERNAL_TABLE_PREFIXES = ["cf_", "pi_"];
|
|
20
39
|
const INTERNAL_PREFIX_RE = /\b(?:cf|pi)_/i;
|
|
21
40
|
const CREATE_INDEX_TABLE_RE = /^\s*CREATE\s+(?:UNIQUE\s+)?INDEX(?:\s+IF\s+(?:NOT\s+)?EXISTS)?\s+[^\s(,;)]+\s+ON\s+(?<table>[^\s(,;)]+)/i;
|
|
22
41
|
function isCloudflareInternalTable(table, allowlist) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
return !allowlist?.length || !core.stringMatchesSomePattern(table, allowlist, true);
|
|
42
|
+
const name = table.toLowerCase();
|
|
43
|
+
if (!INTERNAL_TABLE_PREFIXES.some((prefix) => name.startsWith(prefix))) return false;
|
|
44
|
+
return !allowlist?.length || !(0, _sentry_core.stringMatchesSomePattern)(table, allowlist, true);
|
|
28
45
|
}
|
|
29
|
-
|
|
30
46
|
exports.mayTargetCloudflareInternalTable = mayTargetCloudflareInternalTable;
|
|
31
47
|
exports.targetsCloudflareInternalTable = targetsCloudflareInternalTable;
|
|
32
|
-
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=internalSqlQuery.js.map
|