@sentry/cloudflare 11.11.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 +290 -163
- 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 -87
- 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 +100 -76
- package/build/cjs/dev/instrumentations/worker/instrumentQueue.js.map +1 -1
- package/build/cjs/dev/instrumentations/worker/instrumentQueueProducer.js +91 -75
- 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 +24 -0
- package/build/cjs/dev/utils/bindingPropagation.js.map +1 -0
- 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 +33 -0
- package/build/cjs/dev/utils/queueTraceMeta.js.map +1 -0
- 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 +165 -149
- 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 +78 -72
- 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 +290 -163
- 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 -87
- 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 +100 -76
- package/build/cjs/prod/instrumentations/worker/instrumentQueue.js.map +1 -1
- package/build/cjs/prod/instrumentations/worker/instrumentQueueProducer.js +91 -75
- 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 +24 -0
- package/build/cjs/prod/utils/bindingPropagation.js.map +1 -0
- 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 +33 -0
- package/build/cjs/prod/utils/queueTraceMeta.js.map +1 -0
- 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 +165 -149
- 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 +78 -72
- 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 +290 -161
- 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 -85
- 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 +100 -74
- package/build/esm/dev/instrumentations/worker/instrumentQueue.js.map +1 -1
- package/build/esm/dev/instrumentations/worker/instrumentQueueProducer.js +91 -73
- 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 +23 -0
- package/build/esm/dev/utils/bindingPropagation.js.map +1 -0
- 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 +32 -0
- package/build/esm/dev/utils/queueTraceMeta.js.map +1 -0
- 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 +165 -147
- 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 +78 -70
- 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 +290 -161
- 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 -85
- 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 +100 -74
- package/build/esm/prod/instrumentations/worker/instrumentQueue.js.map +1 -1
- package/build/esm/prod/instrumentations/worker/instrumentQueueProducer.js +91 -73
- 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 +23 -0
- package/build/esm/prod/utils/bindingPropagation.js.map +1 -0
- 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 +32 -0
- package/build/esm/prod/utils/queueTraceMeta.js.map +1 -0
- 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 +165 -147
- 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 +78 -70
- package/build/esm/prod/wrapRequestHandlerWithInit.js.map +1 -1
- package/build/types/client.d.ts +32 -1
- package/build/types/client.d.ts.map +1 -1
- package/build/types/durableobject.d.ts.map +1 -1
- package/build/types/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/instrumentEnv.d.ts +1 -1
- package/build/types/instrumentations/worker/instrumentEnv.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/instrumentQueueProducer.d.ts +1 -1
- package/build/types/instrumentations/worker/instrumentQueueProducer.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/{rpcPropagation.d.ts → bindingPropagation.d.ts} +6 -1
- package/build/types/utils/bindingPropagation.d.ts.map +1 -0
- package/build/types/utils/cloudflareTrace.d.ts +13 -0
- package/build/types/utils/cloudflareTrace.d.ts.map +1 -0
- package/build/types/utils/queueTraceMeta.d.ts +7 -0
- package/build/types/utils/queueTraceMeta.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 +20 -21
- package/build/cjs/dev/index.js.map +0 -1
- package/build/cjs/dev/utils/rpcPropagation.js +0 -15
- package/build/cjs/dev/utils/rpcPropagation.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/utils/rpcPropagation.js +0 -15
- package/build/cjs/prod/utils/rpcPropagation.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/utils/rpcPropagation.js +0 -13
- package/build/esm/dev/utils/rpcPropagation.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/utils/rpcPropagation.js +0 -13
- package/build/esm/prod/utils/rpcPropagation.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/utils/rpcPropagation.d.ts.map +0 -1
- package/build/types/vite/flueRuntime.d.ts +0 -12
- package/build/types/vite/flueRuntime.d.ts.map +0 -1
|
@@ -1,127 +1,140 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const core = require('@sentry/core');
|
|
6
|
-
|
|
1
|
+
let _sentry_core = require("@sentry/core");
|
|
2
|
+
let _sentry_conventions_attributes = require("@sentry/conventions/attributes");
|
|
3
|
+
let _sentry_conventions_op = require("@sentry/conventions/op");
|
|
4
|
+
// src/instrumentations/worker/instrumentR2.ts
|
|
7
5
|
const ORIGIN = "auto.faas.cloudflare.r2";
|
|
8
6
|
const R2_OPERATIONS = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
7
|
+
get: {
|
|
8
|
+
spanName: "r2_get",
|
|
9
|
+
op: _sentry_conventions_op.OBJECT_GET,
|
|
10
|
+
operation: "GetObject"
|
|
11
|
+
},
|
|
12
|
+
head: {
|
|
13
|
+
spanName: "r2_head",
|
|
14
|
+
op: _sentry_conventions_op.OBJECT_HEAD,
|
|
15
|
+
operation: "HeadObject"
|
|
16
|
+
},
|
|
17
|
+
put: {
|
|
18
|
+
spanName: "r2_put",
|
|
19
|
+
op: _sentry_conventions_op.OBJECT_PUT,
|
|
20
|
+
operation: "PutObject"
|
|
21
|
+
},
|
|
22
|
+
delete: {
|
|
23
|
+
spanName: "r2_delete",
|
|
24
|
+
op: _sentry_conventions_op.OBJECT_DELETE,
|
|
25
|
+
operation: "DeleteObject"
|
|
26
|
+
},
|
|
27
|
+
list: {
|
|
28
|
+
spanName: "r2_list",
|
|
29
|
+
op: _sentry_conventions_op.OBJECT_LIST,
|
|
30
|
+
operation: "ListObjects"
|
|
31
|
+
},
|
|
32
|
+
uploadPart: {
|
|
33
|
+
spanName: "r2_uploadPart",
|
|
34
|
+
op: _sentry_conventions_op.OBJECT_UPLOAD_PART,
|
|
35
|
+
operation: "UploadPart"
|
|
36
|
+
},
|
|
37
|
+
abortMultipartUpload: {
|
|
38
|
+
spanName: "r2_abortMultipartUpload",
|
|
39
|
+
op: _sentry_conventions_op.OBJECT_MULTIPART_UPLOAD_ABORT,
|
|
40
|
+
operation: "AbortMultipartUpload"
|
|
41
|
+
},
|
|
42
|
+
createMultipartUpload: {
|
|
43
|
+
spanName: "r2_createMultipartUpload",
|
|
44
|
+
op: _sentry_conventions_op.OBJECT_MULTIPART_UPLOAD_CREATE,
|
|
45
|
+
operation: "CreateMultipartUpload"
|
|
46
|
+
},
|
|
47
|
+
completeMultipartUpload: {
|
|
48
|
+
spanName: "r2_completeMultipartUpload",
|
|
49
|
+
op: _sentry_conventions_op.OBJECT_MULTIPART_UPLOAD_COMPLETE,
|
|
50
|
+
operation: "CompleteMultipartUpload"
|
|
51
|
+
}
|
|
30
52
|
};
|
|
31
53
|
function isR2ListOptions(key) {
|
|
32
|
-
|
|
54
|
+
return (0, _sentry_core.isObjectLike)(key) && !Array.isArray(key);
|
|
33
55
|
}
|
|
34
56
|
function createSpanOptions(bindingName, r2Op, key) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
const { spanName, op, operation } = R2_OPERATIONS[r2Op];
|
|
58
|
+
const requestKey = Array.isArray(key) ? key.join(", ") : typeof key === "string" ? key : void 0;
|
|
59
|
+
return {
|
|
60
|
+
op,
|
|
61
|
+
name: spanName,
|
|
62
|
+
attributes: {
|
|
63
|
+
[_sentry_conventions_attributes.CLOUDFLARE_R2_OPERATION]: operation,
|
|
64
|
+
[_sentry_conventions_attributes.CLOUDFLARE_R2_BUCKET]: bindingName,
|
|
65
|
+
[_sentry_conventions_attributes.CLOUDFLARE_R2_REQUEST_KEY]: requestKey,
|
|
66
|
+
...isR2ListOptions(key) && key.prefix !== void 0 && { [_sentry_conventions_attributes.CLOUDFLARE_R2_REQUEST_PREFIX]: key.prefix },
|
|
67
|
+
...isR2ListOptions(key) && key.delimiter !== void 0 && { [_sentry_conventions_attributes.CLOUDFLARE_R2_REQUEST_DELIMITER]: key.delimiter },
|
|
68
|
+
[_sentry_conventions_attributes.SENTRY_OP]: op,
|
|
69
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN
|
|
70
|
+
}
|
|
71
|
+
};
|
|
50
72
|
}
|
|
51
73
|
function instrumentR2MultipartUpload(upload, bindingName) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
const original = Reflect.get(target, prop, receiver);
|
|
83
|
-
return function(...args) {
|
|
84
|
-
return core.startSpan(
|
|
85
|
-
createSpanOptions(bindingName, "completeMultipartUpload", key),
|
|
86
|
-
() => Reflect.apply(original, target, args)
|
|
87
|
-
);
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
return Reflect.get(target, prop, receiver);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
74
|
+
const { key } = upload;
|
|
75
|
+
return new Proxy(upload, { get(target, prop, receiver) {
|
|
76
|
+
if (prop === "uploadPart") {
|
|
77
|
+
const original = Reflect.get(target, prop, receiver);
|
|
78
|
+
return function(...args) {
|
|
79
|
+
const [partNumber] = args;
|
|
80
|
+
const spanOptions = createSpanOptions(bindingName, "uploadPart", key);
|
|
81
|
+
return (0, _sentry_core.startSpan)({
|
|
82
|
+
...spanOptions,
|
|
83
|
+
attributes: {
|
|
84
|
+
...spanOptions.attributes,
|
|
85
|
+
[_sentry_conventions_attributes.CLOUDFLARE_R2_REQUEST_PART_NUMBER]: partNumber
|
|
86
|
+
}
|
|
87
|
+
}, () => Reflect.apply(original, target, args));
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (prop === "abort") {
|
|
91
|
+
const original = Reflect.get(target, prop, receiver);
|
|
92
|
+
return function() {
|
|
93
|
+
return (0, _sentry_core.startSpan)(createSpanOptions(bindingName, "abortMultipartUpload", key), () => Reflect.apply(original, target, []));
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (prop === "complete") {
|
|
97
|
+
const original = Reflect.get(target, prop, receiver);
|
|
98
|
+
return function(...args) {
|
|
99
|
+
return (0, _sentry_core.startSpan)(createSpanOptions(bindingName, "completeMultipartUpload", key), () => Reflect.apply(original, target, args));
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return Reflect.get(target, prop, receiver);
|
|
103
|
+
} });
|
|
93
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Wraps a Cloudflare R2 Bucket binding to create spans on bucket operations.
|
|
107
|
+
*
|
|
108
|
+
* Instrumented methods: get, head, put, delete, list, createMultipartUpload,
|
|
109
|
+
* resumeMultipartUpload (and the resulting multipart upload operations).
|
|
110
|
+
*/
|
|
94
111
|
function instrumentR2Bucket(bucket, bindingName) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
return Reflect.get(target, prop, receiver);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
112
|
+
return new Proxy(bucket, { get(target, prop, receiver) {
|
|
113
|
+
if (prop === "get" || prop === "head" || prop === "put" || prop === "delete" || prop === "list") {
|
|
114
|
+
const original = Reflect.get(target, prop, receiver);
|
|
115
|
+
return function(...args) {
|
|
116
|
+
const [key] = args;
|
|
117
|
+
return (0, _sentry_core.startSpan)(createSpanOptions(bindingName, prop, key), () => Reflect.apply(original, target, args));
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (prop === "createMultipartUpload") {
|
|
121
|
+
const original = Reflect.get(target, prop, receiver);
|
|
122
|
+
return function(...args) {
|
|
123
|
+
const [key] = args;
|
|
124
|
+
return (0, _sentry_core.startSpan)(createSpanOptions(bindingName, "createMultipartUpload", key), async () => {
|
|
125
|
+
return instrumentR2MultipartUpload(await Reflect.apply(original, target, args), bindingName);
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
if (prop === "resumeMultipartUpload") {
|
|
130
|
+
const original = Reflect.get(target, prop, receiver);
|
|
131
|
+
return function(...args) {
|
|
132
|
+
return instrumentR2MultipartUpload(Reflect.apply(original, target, args), bindingName);
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return Reflect.get(target, prop, receiver);
|
|
136
|
+
} });
|
|
124
137
|
}
|
|
125
|
-
|
|
126
138
|
exports.instrumentR2Bucket = instrumentR2Bucket;
|
|
127
|
-
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=instrumentR2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentR2.js","sources":["../../../../../src/instrumentations/worker/instrumentR2.ts"],"sourcesContent":["import type { R2Bucket, R2ListOptions, R2MultipartUpload } from '@cloudflare/workers-types';\nimport {\n CLOUDFLARE_R2_BUCKET,\n CLOUDFLARE_R2_OPERATION,\n CLOUDFLARE_R2_REQUEST_DELIMITER,\n CLOUDFLARE_R2_REQUEST_KEY,\n CLOUDFLARE_R2_REQUEST_PART_NUMBER,\n CLOUDFLARE_R2_REQUEST_PREFIX,\n SENTRY_OP,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport {\n OBJECT_DELETE,\n OBJECT_GET,\n OBJECT_HEAD,\n OBJECT_LIST,\n OBJECT_MULTIPART_UPLOAD_ABORT,\n OBJECT_MULTIPART_UPLOAD_COMPLETE,\n OBJECT_MULTIPART_UPLOAD_CREATE,\n OBJECT_PUT,\n OBJECT_UPLOAD_PART,\n} from '@sentry/conventions/op';\nimport { isObjectLike, startSpan } from '@sentry/core';\n\nconst ORIGIN = 'auto.faas.cloudflare.r2';\n\nconst R2_OPERATIONS = {\n get: { spanName: 'r2_get', op: OBJECT_GET, operation: 'GetObject' },\n head: { spanName: 'r2_head', op: OBJECT_HEAD, operation: 'HeadObject' },\n put: { spanName: 'r2_put', op: OBJECT_PUT, operation: 'PutObject' },\n delete: { spanName: 'r2_delete', op: OBJECT_DELETE, operation: 'DeleteObject' },\n list: { spanName: 'r2_list', op: OBJECT_LIST, operation: 'ListObjects' },\n uploadPart: { spanName: 'r2_uploadPart', op: OBJECT_UPLOAD_PART, operation: 'UploadPart' },\n abortMultipartUpload: {\n spanName: 'r2_abortMultipartUpload',\n op: OBJECT_MULTIPART_UPLOAD_ABORT,\n operation: 'AbortMultipartUpload',\n },\n createMultipartUpload: {\n spanName: 'r2_createMultipartUpload',\n op: OBJECT_MULTIPART_UPLOAD_CREATE,\n operation: 'CreateMultipartUpload',\n },\n completeMultipartUpload: {\n spanName: 'r2_completeMultipartUpload',\n op: OBJECT_MULTIPART_UPLOAD_COMPLETE,\n operation: 'CompleteMultipartUpload',\n },\n} as const;\n\ntype R2OperationKey = keyof typeof R2_OPERATIONS;\n\nfunction isR2ListOptions(key: unknown): key is R2ListOptions {\n return isObjectLike(key) && !Array.isArray(key);\n}\n\nfunction createSpanOptions(bindingName: string, r2Op: R2OperationKey, key?: string | string[] | R2ListOptions) {\n const { spanName, op, operation } = R2_OPERATIONS[r2Op];\n const requestKey = Array.isArray(key) ? key.join(', ') : typeof key === 'string' ? key : undefined;\n\n return {\n op,\n name: spanName,\n attributes: {\n [CLOUDFLARE_R2_OPERATION]: operation,\n [CLOUDFLARE_R2_BUCKET]: bindingName,\n [CLOUDFLARE_R2_REQUEST_KEY]: requestKey,\n ...(isR2ListOptions(key) && key.prefix !== undefined && { [CLOUDFLARE_R2_REQUEST_PREFIX]: key.prefix }),\n ...(isR2ListOptions(key) && key.delimiter !== undefined && { [CLOUDFLARE_R2_REQUEST_DELIMITER]: key.delimiter }),\n [SENTRY_OP]: op,\n [SENTRY_ORIGIN]: ORIGIN,\n },\n };\n}\n\nfunction instrumentR2MultipartUpload(upload: R2MultipartUpload, bindingName: string): R2MultipartUpload {\n const { key } = upload;\n\n return new Proxy(upload, {\n get(target, prop, receiver) {\n if (prop === 'uploadPart') {\n const original = Reflect.get(target, prop, receiver);\n\n return function (this: unknown, ...args: Parameters<R2MultipartUpload['uploadPart']>) {\n const [partNumber] = args;\n const spanOptions = createSpanOptions(bindingName, 'uploadPart', key);\n\n return startSpan(\n {\n ...spanOptions,\n attributes: {\n ...spanOptions.attributes,\n [CLOUDFLARE_R2_REQUEST_PART_NUMBER]: partNumber,\n },\n },\n () => Reflect.apply(original, target, args),\n );\n };\n }\n\n if (prop === 'abort') {\n const original = Reflect.get(target, prop, receiver);\n\n return function (this: unknown) {\n return startSpan(createSpanOptions(bindingName, 'abortMultipartUpload', key), () =>\n Reflect.apply(original, target, []),\n );\n };\n }\n\n if (prop === 'complete') {\n const original = Reflect.get(target, prop, receiver);\n\n return function (this: unknown, ...args: Parameters<R2MultipartUpload['complete']>) {\n return startSpan(createSpanOptions(bindingName, 'completeMultipartUpload', key), () =>\n Reflect.apply(original, target, args),\n );\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n });\n}\n\n/**\n * Wraps a Cloudflare R2 Bucket binding to create spans on bucket operations.\n *\n * Instrumented methods: get, head, put, delete, list, createMultipartUpload,\n * resumeMultipartUpload (and the resulting multipart upload operations).\n */\nexport function instrumentR2Bucket<T extends R2Bucket>(bucket: T, bindingName: string): T {\n return new Proxy(bucket, {\n get(target, prop, receiver) {\n if (prop === 'get' || prop === 'head' || prop === 'put' || prop === 'delete' || prop === 'list') {\n const original = Reflect.get(target, prop, receiver);\n\n return function (this: unknown, ...args: Parameters<R2Bucket[typeof prop]>) {\n const [key] = args;\n\n return startSpan(createSpanOptions(bindingName, prop, key), () => Reflect.apply(original, target, args));\n };\n }\n\n if (prop === 'createMultipartUpload') {\n const original = Reflect.get(target, prop, receiver) as R2Bucket['createMultipartUpload'];\n\n return function (this: unknown, ...args: Parameters<R2Bucket['createMultipartUpload']>) {\n const [key] = args;\n\n return startSpan(createSpanOptions(bindingName, 'createMultipartUpload', key), async () => {\n const upload = await Reflect.apply(original, target, args);\n return instrumentR2MultipartUpload(upload, bindingName);\n });\n };\n }\n\n if (prop === 'resumeMultipartUpload') {\n const original = Reflect.get(target, prop, receiver);\n\n return function (this: unknown, ...args: Parameters<R2Bucket['resumeMultipartUpload']>) {\n const upload = Reflect.apply(original, target, args);\n\n return instrumentR2MultipartUpload(upload, bindingName);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n });\n}\n"],"names":["OBJECT_GET","OBJECT_HEAD","OBJECT_PUT","OBJECT_DELETE","OBJECT_LIST","OBJECT_UPLOAD_PART","OBJECT_MULTIPART_UPLOAD_ABORT","OBJECT_MULTIPART_UPLOAD_CREATE","OBJECT_MULTIPART_UPLOAD_COMPLETE","isObjectLike","CLOUDFLARE_R2_OPERATION","CLOUDFLARE_R2_BUCKET","CLOUDFLARE_R2_REQUEST_KEY","CLOUDFLARE_R2_REQUEST_PREFIX","CLOUDFLARE_R2_REQUEST_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,OAAO,YAA4B,IAAA,EAAqD;AACtF,UAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,KAAA,CAAM,QAAA,EAAU,QAAQ,IAAI,CAAA;AAEnD,UAAA,OAAO,2BAAA,CAA4B,QAAQ,WAAW,CAAA;AAAA,QACxD,CAAA;AAAA,MACF;AAEA,MAAA,OAAO,OAAA,CAAQ,GAAA,CAAI,MAAA,EAAQ,IAAA,EAAM,QAAQ,CAAA;AAAA,IAC3C;AAAA,GACD,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"instrumentR2.js","names":["OBJECT_GET","OBJECT_HEAD","OBJECT_PUT","OBJECT_DELETE","OBJECT_LIST","OBJECT_UPLOAD_PART","OBJECT_MULTIPART_UPLOAD_ABORT","OBJECT_MULTIPART_UPLOAD_CREATE","OBJECT_MULTIPART_UPLOAD_COMPLETE","isObjectLike","CLOUDFLARE_R2_OPERATION","CLOUDFLARE_R2_BUCKET","CLOUDFLARE_R2_REQUEST_KEY","CLOUDFLARE_R2_REQUEST_PREFIX","CLOUDFLARE_R2_REQUEST_DELIMITER","SENTRY_OP","SENTRY_ORIGIN","startSpan","CLOUDFLARE_R2_REQUEST_PART_NUMBER"],"sources":["../../../../../src/instrumentations/worker/instrumentR2.ts"],"sourcesContent":["import type { R2Bucket, R2ListOptions, R2MultipartUpload } from '@cloudflare/workers-types';\nimport {\n CLOUDFLARE_R2_BUCKET,\n CLOUDFLARE_R2_OPERATION,\n CLOUDFLARE_R2_REQUEST_DELIMITER,\n CLOUDFLARE_R2_REQUEST_KEY,\n CLOUDFLARE_R2_REQUEST_PART_NUMBER,\n CLOUDFLARE_R2_REQUEST_PREFIX,\n SENTRY_OP,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport {\n OBJECT_DELETE,\n OBJECT_GET,\n OBJECT_HEAD,\n OBJECT_LIST,\n OBJECT_MULTIPART_UPLOAD_ABORT,\n OBJECT_MULTIPART_UPLOAD_COMPLETE,\n OBJECT_MULTIPART_UPLOAD_CREATE,\n OBJECT_PUT,\n OBJECT_UPLOAD_PART,\n} from '@sentry/conventions/op';\nimport { isObjectLike, startSpan } from '@sentry/core';\n\nconst ORIGIN = 'auto.faas.cloudflare.r2';\n\nconst R2_OPERATIONS = {\n get: { spanName: 'r2_get', op: OBJECT_GET, operation: 'GetObject' },\n head: { spanName: 'r2_head', op: OBJECT_HEAD, operation: 'HeadObject' },\n put: { spanName: 'r2_put', op: OBJECT_PUT, operation: 'PutObject' },\n delete: { spanName: 'r2_delete', op: OBJECT_DELETE, operation: 'DeleteObject' },\n list: { spanName: 'r2_list', op: OBJECT_LIST, operation: 'ListObjects' },\n uploadPart: { spanName: 'r2_uploadPart', op: OBJECT_UPLOAD_PART, operation: 'UploadPart' },\n abortMultipartUpload: {\n spanName: 'r2_abortMultipartUpload',\n op: OBJECT_MULTIPART_UPLOAD_ABORT,\n operation: 'AbortMultipartUpload',\n },\n createMultipartUpload: {\n spanName: 'r2_createMultipartUpload',\n op: OBJECT_MULTIPART_UPLOAD_CREATE,\n operation: 'CreateMultipartUpload',\n },\n completeMultipartUpload: {\n spanName: 'r2_completeMultipartUpload',\n op: OBJECT_MULTIPART_UPLOAD_COMPLETE,\n operation: 'CompleteMultipartUpload',\n },\n} as const;\n\ntype R2OperationKey = keyof typeof R2_OPERATIONS;\n\nfunction isR2ListOptions(key: unknown): key is R2ListOptions {\n return isObjectLike(key) && !Array.isArray(key);\n}\n\nfunction createSpanOptions(bindingName: string, r2Op: R2OperationKey, key?: string | string[] | R2ListOptions) {\n const { spanName, op, operation } = R2_OPERATIONS[r2Op];\n const requestKey = Array.isArray(key) ? key.join(', ') : typeof key === 'string' ? key : undefined;\n\n return {\n op,\n name: spanName,\n attributes: {\n [CLOUDFLARE_R2_OPERATION]: operation,\n [CLOUDFLARE_R2_BUCKET]: bindingName,\n [CLOUDFLARE_R2_REQUEST_KEY]: requestKey,\n ...(isR2ListOptions(key) && key.prefix !== undefined && { [CLOUDFLARE_R2_REQUEST_PREFIX]: key.prefix }),\n ...(isR2ListOptions(key) && key.delimiter !== undefined && { [CLOUDFLARE_R2_REQUEST_DELIMITER]: key.delimiter }),\n [SENTRY_OP]: op,\n [SENTRY_ORIGIN]: ORIGIN,\n },\n };\n}\n\nfunction instrumentR2MultipartUpload(upload: R2MultipartUpload, bindingName: string): R2MultipartUpload {\n const { key } = upload;\n\n return new Proxy(upload, {\n get(target, prop, receiver) {\n if (prop === 'uploadPart') {\n const original = Reflect.get(target, prop, receiver);\n\n return function (this: unknown, ...args: Parameters<R2MultipartUpload['uploadPart']>) {\n const [partNumber] = args;\n const spanOptions = createSpanOptions(bindingName, 'uploadPart', key);\n\n return startSpan(\n {\n ...spanOptions,\n attributes: {\n ...spanOptions.attributes,\n [CLOUDFLARE_R2_REQUEST_PART_NUMBER]: partNumber,\n },\n },\n () => Reflect.apply(original, target, args),\n );\n };\n }\n\n if (prop === 'abort') {\n const original = Reflect.get(target, prop, receiver);\n\n return function (this: unknown) {\n return startSpan(createSpanOptions(bindingName, 'abortMultipartUpload', key), () =>\n Reflect.apply(original, target, []),\n );\n };\n }\n\n if (prop === 'complete') {\n const original = Reflect.get(target, prop, receiver);\n\n return function (this: unknown, ...args: Parameters<R2MultipartUpload['complete']>) {\n return startSpan(createSpanOptions(bindingName, 'completeMultipartUpload', key), () =>\n Reflect.apply(original, target, args),\n );\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n });\n}\n\n/**\n * Wraps a Cloudflare R2 Bucket binding to create spans on bucket operations.\n *\n * Instrumented methods: get, head, put, delete, list, createMultipartUpload,\n * resumeMultipartUpload (and the resulting multipart upload operations).\n */\nexport function instrumentR2Bucket<T extends R2Bucket>(bucket: T, bindingName: string): T {\n return new Proxy(bucket, {\n get(target, prop, receiver) {\n if (prop === 'get' || prop === 'head' || prop === 'put' || prop === 'delete' || prop === 'list') {\n const original = Reflect.get(target, prop, receiver);\n\n return function (this: unknown, ...args: Parameters<R2Bucket[typeof prop]>) {\n const [key] = args;\n\n return startSpan(createSpanOptions(bindingName, prop, key), () => Reflect.apply(original, target, args));\n };\n }\n\n if (prop === 'createMultipartUpload') {\n const original = Reflect.get(target, prop, receiver) as R2Bucket['createMultipartUpload'];\n\n return function (this: unknown, ...args: Parameters<R2Bucket['createMultipartUpload']>) {\n const [key] = args;\n\n return startSpan(createSpanOptions(bindingName, 'createMultipartUpload', key), async () => {\n const upload = await Reflect.apply(original, target, args);\n return instrumentR2MultipartUpload(upload, bindingName);\n });\n };\n }\n\n if (prop === 'resumeMultipartUpload') {\n const original = Reflect.get(target, prop, receiver);\n\n return function (this: unknown, ...args: Parameters<R2Bucket['resumeMultipartUpload']>) {\n const upload = Reflect.apply(original, target, args);\n\n return instrumentR2MultipartUpload(upload, bindingName);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n });\n}\n"],"mappings":";;;;AAwBA,MAAM,SAAS;AAEf,MAAM,gBAAgB;CACpB,KAAK;EAAE,UAAU;EAAU,IAAIA,uBAAAA;EAAY,WAAW;CAAY;CAClE,MAAM;EAAE,UAAU;EAAW,IAAIC,uBAAAA;EAAa,WAAW;CAAa;CACtE,KAAK;EAAE,UAAU;EAAU,IAAIC,uBAAAA;EAAY,WAAW;CAAY;CAClE,QAAQ;EAAE,UAAU;EAAa,IAAIC,uBAAAA;EAAe,WAAW;CAAe;CAC9E,MAAM;EAAE,UAAU;EAAW,IAAIC,uBAAAA;EAAa,WAAW;CAAc;CACvE,YAAY;EAAE,UAAU;EAAiB,IAAIC,uBAAAA;EAAoB,WAAW;CAAa;CACzF,sBAAsB;EACpB,UAAU;EACV,IAAIC,uBAAAA;EACJ,WAAW;CACb;CACA,uBAAuB;EACrB,UAAU;EACV,IAAIC,uBAAAA;EACJ,WAAW;CACb;CACA,yBAAyB;EACvB,UAAU;EACV,IAAIC,uBAAAA;EACJ,WAAW;CACb;AACF;AAIA,SAAS,gBAAgB,KAAoC;CAC3D,QAAA,GAAOC,aAAAA,aAAAA,CAAa,GAAG,KAAK,CAAC,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;GACxD;EACF;EAEA,OAAO,QAAQ,IAAI,QAAQ,MAAM,QAAQ;CAC3C,EACF,CAAC;AACH"}
|
|
@@ -1,102 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
const require_debug_build = require("../../debug-build.js");
|
|
2
|
+
const require_flush = require("../../flush.js");
|
|
3
|
+
const require_instrument = require("../../instrument.js");
|
|
4
|
+
const require_options = require("../../options.js");
|
|
5
|
+
const require_scope_utils = require("../../scope-utils.js");
|
|
6
|
+
const require_sdk = require("../../sdk.js");
|
|
7
|
+
const require_cloudflareTrace = require("../../utils/cloudflareTrace.js");
|
|
8
|
+
const require_instrumentContext = require("../../utils/instrumentContext.js");
|
|
9
|
+
const require_invocationContext = require("../../utils/invocationContext.js");
|
|
10
|
+
const require_instrumentEnv = require("./instrumentEnv.js");
|
|
11
|
+
let _sentry_core = require("@sentry/core");
|
|
12
|
+
let _sentry_conventions_attributes = require("@sentry/conventions/attributes");
|
|
13
|
+
let _sentry_conventions_op = require("@sentry/conventions/op");
|
|
14
|
+
// src/instrumentations/worker/instrumentScheduled.ts
|
|
16
15
|
function wrapScheduledHandler(controller, options, context, fn) {
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
16
|
+
return (0, _sentry_core.withIsolationScope)((isolationScope) => {
|
|
17
|
+
const waitUntil = context.waitUntil.bind(context);
|
|
18
|
+
require_invocationContext.setInvocationState(isolationScope, { ctx: context });
|
|
19
|
+
const client = require_sdk.init({
|
|
20
|
+
...options,
|
|
21
|
+
ctx: context
|
|
22
|
+
});
|
|
23
|
+
isolationScope.setClient(client);
|
|
24
|
+
require_scope_utils.addCloudResourceContext(isolationScope);
|
|
25
|
+
require_cloudflareTrace.continueCloudflareTrace(context);
|
|
26
|
+
const description = `Scheduled Cron ${controller.cron}`;
|
|
27
|
+
return (0, _sentry_core.startSpan)({
|
|
28
|
+
name: client && (0, _sentry_core.hasSpanStreamingEnabled)(client) ? "scheduled" : description,
|
|
29
|
+
attributes: {
|
|
30
|
+
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.FUNCTION,
|
|
31
|
+
[_sentry_conventions_attributes.SENTRY_DESCRIPTION]: description,
|
|
32
|
+
[_sentry_conventions_attributes.CODE_FUNCTION_NAME]: "scheduled",
|
|
33
|
+
[_sentry_conventions_attributes.FAAS_CRON]: controller.cron,
|
|
34
|
+
[_sentry_conventions_attributes.FAAS_TIME]: new Date(controller.scheduledTime).toISOString(),
|
|
35
|
+
[_sentry_conventions_attributes.FAAS_TRIGGER]: "timer",
|
|
36
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: "auto.faas.cloudflare.scheduled",
|
|
37
|
+
[_sentry_conventions_attributes.SENTRY_SEGMENT_NAME_SOURCE]: "task"
|
|
38
|
+
}
|
|
39
|
+
}, async () => {
|
|
40
|
+
let finishCheckIn;
|
|
41
|
+
try {
|
|
42
|
+
finishCheckIn = client?.getIntegrationByName("CronTriggers")?.startCheckIn(controller.cron);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
require_debug_build.DEBUG_BUILD && _sentry_core.debug.warn("Failed to send the in_progress cron check-in", e);
|
|
45
|
+
}
|
|
46
|
+
const finish = (status) => {
|
|
47
|
+
try {
|
|
48
|
+
finishCheckIn?.(status);
|
|
49
|
+
} catch (e) {
|
|
50
|
+
require_debug_build.DEBUG_BUILD && _sentry_core.debug.warn(`Failed to send the ${status} cron check-in`, e);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
try {
|
|
54
|
+
const result = await fn();
|
|
55
|
+
finish("ok");
|
|
56
|
+
return result;
|
|
57
|
+
} catch (e) {
|
|
58
|
+
finish("error");
|
|
59
|
+
(0, _sentry_core.captureException)(e, { mechanism: {
|
|
60
|
+
handled: false,
|
|
61
|
+
type: "auto.faas.cloudflare.scheduled"
|
|
62
|
+
} });
|
|
63
|
+
throw e;
|
|
64
|
+
} finally {
|
|
65
|
+
waitUntil(require_flush.flushAndDispose(client));
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
68
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Instruments a scheduled handler for ExportedHandler (env/ctx come from args).
|
|
72
|
+
*/
|
|
69
73
|
function instrumentExportedHandlerScheduled(handler, optionsCallback) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const options$1 = options.getFinalOptions(optionsCallback(env), env);
|
|
80
|
-
args[1] = instrumentEnv.instrumentEnv(env, options$1);
|
|
81
|
-
args[2] = context;
|
|
82
|
-
return wrapScheduledHandler(controller, options$1, context, () => target.apply(thisArg, args));
|
|
83
|
-
}
|
|
84
|
-
})
|
|
85
|
-
);
|
|
74
|
+
if (!("scheduled" in handler) || typeof handler.scheduled !== "function") return;
|
|
75
|
+
handler.scheduled = require_instrument.ensureInstrumented(handler.scheduled, (original) => new Proxy(original, { apply(target, thisArg, args) {
|
|
76
|
+
const [controller, env, ctx] = args;
|
|
77
|
+
const context = require_instrumentContext.instrumentContext(ctx);
|
|
78
|
+
const options = require_options.getFinalOptions(optionsCallback(env), env);
|
|
79
|
+
args[1] = require_instrumentEnv.instrumentEnv(env, options);
|
|
80
|
+
args[2] = context;
|
|
81
|
+
return wrapScheduledHandler(controller, options, context, () => target.apply(thisArg, args));
|
|
82
|
+
} }));
|
|
86
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Instruments a scheduled method for WorkerEntrypoint (options/context already available).
|
|
86
|
+
*/
|
|
87
87
|
function instrumentWorkerEntrypointScheduled(instance, options, context) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const [controller] = args;
|
|
95
|
-
return wrapScheduledHandler(controller, options, context, () => Reflect.apply(target, thisArg, args));
|
|
96
|
-
}
|
|
97
|
-
});
|
|
88
|
+
if (!instance.scheduled) return;
|
|
89
|
+
const original = instance.scheduled.bind(instance);
|
|
90
|
+
instance.scheduled = new Proxy(original, { apply(target, thisArg, args) {
|
|
91
|
+
const [controller] = args;
|
|
92
|
+
return wrapScheduledHandler(controller, options, context, () => Reflect.apply(target, thisArg, args));
|
|
93
|
+
} });
|
|
98
94
|
}
|
|
99
|
-
|
|
100
95
|
exports.instrumentExportedHandlerScheduled = instrumentExportedHandlerScheduled;
|
|
101
96
|
exports.instrumentWorkerEntrypointScheduled = instrumentWorkerEntrypointScheduled;
|
|
102
|
-
|
|
97
|
+
|
|
98
|
+
//# sourceMappingURL=instrumentScheduled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentScheduled.js","sources":["../../../../../src/instrumentations/worker/instrumentScheduled.ts"],"sourcesContent":["import type { ScheduledController } from '@cloudflare/workers-types';\nimport type { AnyExportedHandler } from '../../types';\nimport type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';\nimport {\n SENTRY_SEGMENT_NAME_SOURCE,\n CODE_FUNCTION_NAME,\n SENTRY_OP,\n FAAS_CRON,\n FAAS_TIME,\n FAAS_TRIGGER,\n SENTRY_DESCRIPTION,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport { FUNCTION } from '@sentry/conventions/op';\nimport { captureException, debug, hasSpanStreamingEnabled, startSpan, withIsolationScope } from '@sentry/core';\nimport type { CloudflareOptions } from '../../client';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { flushAndDispose } from '../../flush';\nimport { ensureInstrumented } from '../../instrument';\nimport type { CronTriggersIntegration } from '../../integrations/cronTriggers';\nimport { getFinalOptions } from '../../options';\nimport { addCloudResourceContext } from '../../scope-utils';\nimport { init } from '../../sdk';\nimport { instrumentContext } from '../../utils/instrumentContext';\nimport { setInvocationState } from '../../utils/invocationContext';\nimport { instrumentEnv } from './instrumentEnv';\n\nfunction wrapScheduledHandler(\n controller: ScheduledController,\n options: CloudflareOptions,\n context: ExecutionContext,\n fn: () => unknown,\n): unknown {\n return withIsolationScope(isolationScope => {\n const waitUntil = context.waitUntil.bind(context);\n\n setInvocationState(isolationScope, { ctx: context });\n\n const client = init({ ...options, ctx: context });\n isolationScope.setClient(client);\n\n addCloudResourceContext(isolationScope);\n\n const description = `Scheduled Cron ${controller.cron}`;\n\n return startSpan(\n {\n name: client && hasSpanStreamingEnabled(client) ? 'scheduled' : description,\n attributes: {\n [SENTRY_OP]: FUNCTION,\n // override description inference by Relay to preserve the original (transaction-based) description.\n // sentry-conventions can't map the special case for the \"Scheduled Cron\" prefix and the chron string.\n [SENTRY_DESCRIPTION]: description,\n [CODE_FUNCTION_NAME]: 'scheduled',\n [FAAS_CRON]: controller.cron,\n [FAAS_TIME]: new Date(controller.scheduledTime).toISOString(),\n [FAAS_TRIGGER]: 'timer',\n [SENTRY_ORIGIN]: 'auto.faas.cloudflare.scheduled',\n [SENTRY_SEGMENT_NAME_SOURCE]: 'task',\n },\n },\n async () => {\n let finishCheckIn: ReturnType<CronTriggersIntegration['startCheckIn']>;\n try {\n finishCheckIn = client\n ?.getIntegrationByName<CronTriggersIntegration>('CronTriggers')\n ?.startCheckIn(controller.cron);\n } catch (e) {\n DEBUG_BUILD && debug.warn('Failed to send the in_progress cron check-in', e);\n }\n\n const finish = (status: 'ok' | 'error'): void => {\n try {\n finishCheckIn?.(status);\n } catch (e) {\n DEBUG_BUILD && debug.warn(`Failed to send the ${status} cron check-in`, e);\n }\n };\n\n try {\n const result = await fn();\n finish('ok');\n return result;\n } catch (e) {\n finish('error');\n captureException(e, { mechanism: { handled: false, type: 'auto.faas.cloudflare.scheduled' } });\n throw e;\n } finally {\n waitUntil(flushAndDispose(client));\n }\n },\n );\n });\n}\n\n/**\n * Instruments a scheduled handler for ExportedHandler (env/ctx come from args).\n */\nexport function instrumentExportedHandlerScheduled<T extends AnyExportedHandler>(\n handler: T,\n optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined,\n): void {\n if (!('scheduled' in handler) || typeof handler.scheduled !== 'function') {\n return;\n }\n\n handler.scheduled = ensureInstrumented(\n handler.scheduled,\n original =>\n new Proxy(original, {\n apply(target, thisArg, args: Parameters<NonNullable<T['scheduled']>>) {\n const [controller, env, ctx] = args;\n const context = instrumentContext(ctx);\n const options = getFinalOptions(optionsCallback(env), env);\n args[1] = instrumentEnv(env, options);\n args[2] = context;\n\n return wrapScheduledHandler(controller, options, context, () => target.apply(thisArg, args));\n },\n }),\n );\n}\n\n/**\n * Instruments a scheduled method for WorkerEntrypoint (options/context already available).\n */\nexport function instrumentWorkerEntrypointScheduled<T extends WorkerEntrypoint>(\n instance: T,\n options: CloudflareOptions,\n context: ExecutionContext,\n): void {\n if (!instance.scheduled) {\n return;\n }\n\n const original = instance.scheduled.bind(instance);\n instance.scheduled = new Proxy(original, {\n apply(target, thisArg, args: [ScheduledController]) {\n const [controller] = args;\n\n return wrapScheduledHandler(controller, options, context, () => Reflect.apply(target, thisArg, args));\n },\n });\n}\n"],"
|
|
1
|
+
{"version":3,"file":"instrumentScheduled.js","names":["withIsolationScope","setInvocationState","init","addCloudResourceContext","continueCloudflareTrace","startSpan","hasSpanStreamingEnabled","SENTRY_OP","FUNCTION","SENTRY_DESCRIPTION","CODE_FUNCTION_NAME","FAAS_CRON","FAAS_TIME","FAAS_TRIGGER","SENTRY_ORIGIN","SENTRY_SEGMENT_NAME_SOURCE","DEBUG_BUILD","debug","captureException","flushAndDispose","ensureInstrumented","instrumentContext","getFinalOptions","instrumentEnv"],"sources":["../../../../../src/instrumentations/worker/instrumentScheduled.ts"],"sourcesContent":["import type { ScheduledController } from '@cloudflare/workers-types';\nimport type { AnyExportedHandler } from '../../types';\nimport type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';\nimport {\n SENTRY_SEGMENT_NAME_SOURCE,\n CODE_FUNCTION_NAME,\n SENTRY_OP,\n FAAS_CRON,\n FAAS_TIME,\n FAAS_TRIGGER,\n SENTRY_DESCRIPTION,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport { FUNCTION } from '@sentry/conventions/op';\nimport { captureException, debug, hasSpanStreamingEnabled, startSpan, withIsolationScope } from '@sentry/core';\nimport type { CloudflareOptions } from '../../client';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { flushAndDispose } from '../../flush';\nimport { ensureInstrumented } from '../../instrument';\nimport type { CronTriggersIntegration } from '../../integrations/cronTriggers';\nimport { getFinalOptions } from '../../options';\nimport { addCloudResourceContext } from '../../scope-utils';\nimport { init } from '../../sdk';\nimport { continueCloudflareTrace } from '../../utils/cloudflareTrace';\nimport { instrumentContext } from '../../utils/instrumentContext';\nimport { setInvocationState } from '../../utils/invocationContext';\nimport { instrumentEnv } from './instrumentEnv';\n\nfunction wrapScheduledHandler(\n controller: ScheduledController,\n options: CloudflareOptions,\n context: ExecutionContext,\n fn: () => unknown,\n): unknown {\n return withIsolationScope(isolationScope => {\n const waitUntil = context.waitUntil.bind(context);\n\n setInvocationState(isolationScope, { ctx: context });\n\n const client = init({ ...options, ctx: context });\n isolationScope.setClient(client);\n\n addCloudResourceContext(isolationScope);\n continueCloudflareTrace(context);\n\n const description = `Scheduled Cron ${controller.cron}`;\n\n return startSpan(\n {\n name: client && hasSpanStreamingEnabled(client) ? 'scheduled' : description,\n attributes: {\n [SENTRY_OP]: FUNCTION,\n // override description inference by Relay to preserve the original (transaction-based) description.\n // sentry-conventions can't map the special case for the \"Scheduled Cron\" prefix and the chron string.\n [SENTRY_DESCRIPTION]: description,\n [CODE_FUNCTION_NAME]: 'scheduled',\n [FAAS_CRON]: controller.cron,\n [FAAS_TIME]: new Date(controller.scheduledTime).toISOString(),\n [FAAS_TRIGGER]: 'timer',\n [SENTRY_ORIGIN]: 'auto.faas.cloudflare.scheduled',\n [SENTRY_SEGMENT_NAME_SOURCE]: 'task',\n },\n },\n async () => {\n let finishCheckIn: ReturnType<CronTriggersIntegration['startCheckIn']>;\n try {\n finishCheckIn = client\n ?.getIntegrationByName<CronTriggersIntegration>('CronTriggers')\n ?.startCheckIn(controller.cron);\n } catch (e) {\n DEBUG_BUILD && debug.warn('Failed to send the in_progress cron check-in', e);\n }\n\n const finish = (status: 'ok' | 'error'): void => {\n try {\n finishCheckIn?.(status);\n } catch (e) {\n DEBUG_BUILD && debug.warn(`Failed to send the ${status} cron check-in`, e);\n }\n };\n\n try {\n const result = await fn();\n finish('ok');\n return result;\n } catch (e) {\n finish('error');\n captureException(e, { mechanism: { handled: false, type: 'auto.faas.cloudflare.scheduled' } });\n throw e;\n } finally {\n waitUntil(flushAndDispose(client));\n }\n },\n );\n });\n}\n\n/**\n * Instruments a scheduled handler for ExportedHandler (env/ctx come from args).\n */\nexport function instrumentExportedHandlerScheduled<T extends AnyExportedHandler>(\n handler: T,\n optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined,\n): void {\n if (!('scheduled' in handler) || typeof handler.scheduled !== 'function') {\n return;\n }\n\n handler.scheduled = ensureInstrumented(\n handler.scheduled,\n original =>\n new Proxy(original, {\n apply(target, thisArg, args: Parameters<NonNullable<T['scheduled']>>) {\n const [controller, env, ctx] = args;\n const context = instrumentContext(ctx);\n const options = getFinalOptions(optionsCallback(env), env);\n args[1] = instrumentEnv(env, options);\n args[2] = context;\n\n return wrapScheduledHandler(controller, options, context, () => target.apply(thisArg, args));\n },\n }),\n );\n}\n\n/**\n * Instruments a scheduled method for WorkerEntrypoint (options/context already available).\n */\nexport function instrumentWorkerEntrypointScheduled<T extends WorkerEntrypoint>(\n instance: T,\n options: CloudflareOptions,\n context: ExecutionContext,\n): void {\n if (!instance.scheduled) {\n return;\n }\n\n const original = instance.scheduled.bind(instance);\n instance.scheduled = new Proxy(original, {\n apply(target, thisArg, args: [ScheduledController]) {\n const [controller] = args;\n\n return wrapScheduledHandler(controller, options, context, () => Reflect.apply(target, thisArg, args));\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;AA4BA,SAAS,qBACP,YACA,SACA,SACA,IACS;CACT,QAAA,GAAOA,aAAAA,mBAAAA,EAAmB,mBAAkB;EAC1C,MAAM,YAAY,QAAQ,UAAU,KAAK,OAAO;EAEhDC,0BAAAA,mBAAmB,gBAAgB,EAAE,KAAK,QAAQ,CAAC;EAEnD,MAAM,SAASC,YAAAA,KAAK;GAAE,GAAG;GAAS,KAAK;EAAQ,CAAC;EAChD,eAAe,UAAU,MAAM;EAE/BC,oBAAAA,wBAAwB,cAAc;EACtCC,wBAAAA,wBAAwB,OAAO;EAE/B,MAAM,cAAc,kBAAkB,WAAW;EAEjD,QAAA,GAAOC,aAAAA,UAAAA,CACL;GACE,MAAM,WAAA,GAAUC,aAAAA,wBAAAA,CAAwB,MAAM,IAAI,cAAc;GAChE,YAAY;KACTC,+BAAAA,YAAYC,uBAAAA;KAGZC,+BAAAA,qBAAqB;K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