@sentry/cloudflare 10.68.0 → 11.0.0-alpha.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/README.md +3 -7
- package/build/cjs/dev/baseSdk.js +83 -0
- package/build/cjs/dev/baseSdk.js.map +1 -0
- package/build/cjs/{client.js → dev/client.js} +5 -0
- package/build/cjs/dev/client.js.map +1 -0
- package/build/cjs/dev/debug-build.js.map +1 -0
- package/build/cjs/dev/defineCloudflareOptions.js.map +1 -0
- package/build/cjs/dev/durableobject.js +234 -0
- package/build/cjs/dev/durableobject.js.map +1 -0
- package/build/cjs/dev/flush.js.map +1 -0
- package/build/cjs/{index.js → dev/index.js} +18 -17
- package/build/cjs/{index.js.map → dev/index.js.map} +1 -1
- package/build/cjs/dev/instrument.js.map +1 -0
- package/build/cjs/dev/instrumentations/agents/index.js +16 -0
- package/build/cjs/dev/instrumentations/agents/index.js.map +1 -0
- package/build/cjs/dev/instrumentations/agents/instrumentAgentCallableRpc.js +52 -0
- package/build/cjs/dev/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -0
- package/build/cjs/dev/instrumentations/agents/instrumentAgentRequestConversation.js +19 -0
- package/build/cjs/dev/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -0
- package/build/cjs/dev/instrumentations/agents/instrumentChatAgentConversation.js +31 -0
- package/build/cjs/dev/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -0
- package/build/cjs/dev/instrumentations/agents/types.js +77 -0
- package/build/cjs/dev/instrumentations/agents/types.js.map +1 -0
- package/build/cjs/dev/instrumentations/instrumentDurableObjectNamespace.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/instrumentDurableObjectStorage.js +6 -0
- package/build/cjs/dev/instrumentations/instrumentDurableObjectStorage.js.map +1 -0
- package/build/cjs/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/instrumentSqlStorage.js +1 -1
- package/build/cjs/dev/instrumentations/instrumentSqlStorage.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/instrumentWorkerEntrypoint.js +3 -3
- package/build/cjs/dev/instrumentations/instrumentWorkerEntrypoint.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentD1.js +0 -4
- package/build/cjs/dev/instrumentations/worker/instrumentD1.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentEmail.js +3 -1
- package/build/cjs/dev/instrumentations/worker/instrumentEmail.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentEnv.js +3 -4
- package/build/cjs/dev/instrumentations/worker/instrumentEnv.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentFetch.js +9 -3
- package/build/cjs/dev/instrumentations/worker/instrumentFetch.js.map +1 -0
- package/build/cjs/dev/instrumentations/worker/instrumentFetcher.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentQueue.js +3 -2
- package/build/cjs/dev/instrumentations/worker/instrumentQueue.js.map +1 -0
- package/build/cjs/dev/instrumentations/worker/instrumentQueueProducer.js.map +1 -0
- package/build/cjs/dev/instrumentations/worker/instrumentR2.js.map +1 -0
- package/build/cjs/dev/instrumentations/worker/instrumentRateLimit.js.map +1 -0
- package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentScheduled.js +3 -1
- package/build/cjs/dev/instrumentations/worker/instrumentScheduled.js.map +1 -0
- package/build/cjs/dev/instrumentations/worker/instrumentTail.js.map +1 -0
- package/build/cjs/{integrations → dev/integrations}/fetch.js +1 -1
- package/build/cjs/dev/integrations/fetch.js.map +1 -0
- package/build/cjs/{integrations → dev/integrations}/httpServer.js +5 -4
- package/build/cjs/dev/integrations/httpServer.js.map +1 -0
- package/build/cjs/dev/integrations/spotlight.js +64 -0
- package/build/cjs/dev/integrations/spotlight.js.map +1 -0
- package/build/cjs/{nodejs_compat → dev}/integrations/tracing/vercelai.js +6 -6
- package/build/cjs/dev/integrations/tracing/vercelai.js.map +1 -0
- package/build/cjs/dev/opentelemetry/tracer.js.map +1 -0
- package/build/cjs/dev/options.js +50 -0
- package/build/cjs/dev/options.js.map +1 -0
- package/build/cjs/{pages-plugin.js → dev/pages-plugin.js} +8 -3
- package/build/cjs/dev/pages-plugin.js.map +1 -0
- package/build/cjs/{request.js → dev/request.js} +23 -12
- package/build/cjs/dev/request.js.map +1 -0
- package/build/cjs/dev/scope-utils.js.map +1 -0
- package/build/cjs/dev/sdk.js +19 -0
- package/build/cjs/dev/sdk.js.map +1 -0
- package/build/cjs/dev/transport.js.map +1 -0
- package/build/cjs/{utils → dev/utils}/instrumentContext.js +8 -13
- package/build/cjs/dev/utils/instrumentContext.js.map +1 -0
- package/build/cjs/dev/utils/internalSqlQuery.js +25 -0
- package/build/cjs/dev/utils/internalSqlQuery.js.map +1 -0
- package/build/cjs/dev/utils/internalStorageKey.js +44 -0
- package/build/cjs/dev/utils/internalStorageKey.js.map +1 -0
- package/build/cjs/dev/utils/invocationScope.js +12 -0
- package/build/cjs/dev/utils/invocationScope.js.map +1 -0
- package/build/cjs/dev/utils/isBinding.js.map +1 -0
- package/build/cjs/dev/utils/isCloudflareClass.js.map +1 -0
- package/build/cjs/{utils → dev/utils}/rpcMeta.js +4 -0
- package/build/cjs/dev/utils/rpcMeta.js.map +1 -0
- package/build/cjs/dev/utils/streaming.js.map +1 -0
- package/build/cjs/dev/utils/traceLinks.js.map +1 -0
- package/build/cjs/dev/vendor/stacktrace.js.map +1 -0
- package/build/cjs/dev/vite/agentClass.js +114 -0
- package/build/cjs/dev/vite/agentClass.js.map +1 -0
- package/build/cjs/{vite → dev/vite}/autoInstrument.js +17 -4
- package/build/cjs/dev/vite/autoInstrument.js.map +1 -0
- package/build/cjs/{vite → dev/vite}/index.js +4 -2
- package/build/cjs/dev/vite/index.js.map +1 -0
- package/build/cjs/dev/vite/instrumentFile.js.map +1 -0
- package/build/cjs/dev/vite/moduleShape.js +231 -0
- package/build/cjs/dev/vite/moduleShape.js.map +1 -0
- package/build/cjs/{vite → dev/vite}/transform.js +6 -1
- package/build/cjs/dev/vite/transform.js.map +1 -0
- package/build/cjs/dev/vite/workerEntrypoint.js.map +1 -0
- package/build/cjs/{vite → dev/vite}/wranglerConfig.js +1 -1
- package/build/cjs/dev/vite/wranglerConfig.js.map +1 -0
- package/build/cjs/{withSentry.js → dev/withSentry.js} +2 -19
- package/build/cjs/dev/withSentry.js.map +1 -0
- package/build/cjs/{workflows.js → dev/workflows.js} +9 -4
- package/build/cjs/dev/workflows.js.map +1 -0
- package/build/cjs/{wrapMethodWithSentry.js → dev/wrapMethodWithSentry.js} +2 -3
- package/build/cjs/dev/wrapMethodWithSentry.js.map +1 -0
- package/build/cjs/{sdk.js → prod/baseSdk.js} +25 -17
- package/build/cjs/prod/baseSdk.js.map +1 -0
- package/build/cjs/prod/client.js +122 -0
- package/build/cjs/prod/client.js.map +1 -0
- package/build/cjs/prod/debug-build.js +6 -0
- package/build/cjs/prod/debug-build.js.map +1 -0
- package/build/cjs/prod/defineCloudflareOptions.js +11 -0
- package/build/cjs/prod/defineCloudflareOptions.js.map +1 -0
- package/build/cjs/prod/durableobject.js +234 -0
- package/build/cjs/prod/durableobject.js.map +1 -0
- package/build/cjs/prod/flush.js +87 -0
- package/build/cjs/prod/flush.js.map +1 -0
- package/build/cjs/{nodejs_compat → prod}/index.js +34 -35
- package/build/cjs/{nodejs_compat → prod}/index.js.map +1 -1
- package/build/cjs/prod/instrument.js +52 -0
- package/build/cjs/prod/instrument.js.map +1 -0
- package/build/cjs/prod/instrumentations/agents/index.js +16 -0
- package/build/cjs/prod/instrumentations/agents/index.js.map +1 -0
- package/build/cjs/prod/instrumentations/agents/instrumentAgentCallableRpc.js +52 -0
- package/build/cjs/prod/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -0
- package/build/cjs/prod/instrumentations/agents/instrumentAgentRequestConversation.js +19 -0
- package/build/cjs/prod/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -0
- package/build/cjs/prod/instrumentations/agents/instrumentChatAgentConversation.js +31 -0
- package/build/cjs/prod/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -0
- package/build/cjs/prod/instrumentations/agents/types.js +77 -0
- package/build/cjs/prod/instrumentations/agents/types.js.map +1 -0
- package/build/cjs/prod/instrumentations/instrumentDurableObjectNamespace.js +41 -0
- package/build/cjs/prod/instrumentations/instrumentDurableObjectNamespace.js.map +1 -0
- package/build/cjs/prod/instrumentations/instrumentDurableObjectStorage.js +72 -0
- package/build/cjs/prod/instrumentations/instrumentDurableObjectStorage.js.map +1 -0
- package/build/cjs/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js +40 -0
- package/build/cjs/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -0
- package/build/cjs/prod/instrumentations/instrumentSqlStorage.js +42 -0
- package/build/cjs/prod/instrumentations/instrumentSqlStorage.js.map +1 -0
- package/build/cjs/prod/instrumentations/instrumentWorkerEntrypoint.js +139 -0
- package/build/cjs/prod/instrumentations/instrumentWorkerEntrypoint.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentD1.js +161 -0
- package/build/cjs/prod/instrumentations/worker/instrumentD1.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentEmail.js +63 -0
- package/build/cjs/prod/instrumentations/worker/instrumentEmail.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentEnv.js +90 -0
- package/build/cjs/prod/instrumentations/worker/instrumentEnv.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentFetch.js +54 -0
- package/build/cjs/prod/instrumentations/worker/instrumentFetch.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentFetcher.js +24 -0
- package/build/cjs/prod/instrumentations/worker/instrumentFetcher.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentQueue.js +82 -0
- package/build/cjs/prod/instrumentations/worker/instrumentQueue.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentQueueProducer.js +80 -0
- package/build/cjs/prod/instrumentations/worker/instrumentQueueProducer.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentR2.js +124 -0
- package/build/cjs/prod/instrumentations/worker/instrumentR2.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentRateLimit.js +29 -0
- package/build/cjs/prod/instrumentations/worker/instrumentRateLimit.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentScheduled.js +78 -0
- package/build/cjs/prod/instrumentations/worker/instrumentScheduled.js.map +1 -0
- package/build/cjs/prod/instrumentations/worker/instrumentTail.js +60 -0
- package/build/cjs/prod/instrumentations/worker/instrumentTail.js.map +1 -0
- package/build/cjs/prod/integrations/fetch.js +119 -0
- package/build/cjs/prod/integrations/fetch.js.map +1 -0
- package/build/cjs/prod/integrations/httpServer.js +36 -0
- package/build/cjs/prod/integrations/httpServer.js.map +1 -0
- package/build/cjs/prod/integrations/spotlight.js +64 -0
- package/build/cjs/prod/integrations/spotlight.js.map +1 -0
- package/build/cjs/{integrations → prod/integrations}/tracing/vercelai.js +5 -5
- package/build/cjs/prod/integrations/tracing/vercelai.js.map +1 -0
- package/build/cjs/prod/opentelemetry/tracer.js +49 -0
- package/build/cjs/prod/opentelemetry/tracer.js.map +1 -0
- package/build/cjs/{options.js → prod/options.js} +5 -1
- package/build/cjs/prod/options.js.map +1 -0
- package/build/cjs/prod/pages-plugin.js +24 -0
- package/build/cjs/prod/pages-plugin.js.map +1 -0
- package/build/cjs/prod/request.js +132 -0
- package/build/cjs/prod/request.js.map +1 -0
- package/build/cjs/prod/scope-utils.js +22 -0
- package/build/cjs/prod/scope-utils.js.map +1 -0
- package/build/cjs/prod/sdk.js +19 -0
- package/build/cjs/prod/sdk.js.map +1 -0
- package/build/cjs/prod/transport.js +75 -0
- package/build/cjs/prod/transport.js.map +1 -0
- package/build/cjs/prod/utils/instrumentContext.js +63 -0
- package/build/cjs/prod/utils/instrumentContext.js.map +1 -0
- package/build/cjs/prod/utils/internalSqlQuery.js +25 -0
- package/build/cjs/prod/utils/internalSqlQuery.js.map +1 -0
- package/build/cjs/prod/utils/internalStorageKey.js +44 -0
- package/build/cjs/prod/utils/internalStorageKey.js.map +1 -0
- package/build/cjs/prod/utils/invocationScope.js +12 -0
- package/build/cjs/prod/utils/invocationScope.js.map +1 -0
- package/build/cjs/prod/utils/isBinding.js +37 -0
- package/build/cjs/prod/utils/isBinding.js.map +1 -0
- package/build/cjs/prod/utils/isCloudflareClass.js +23 -0
- package/build/cjs/prod/utils/isCloudflareClass.js.map +1 -0
- package/build/cjs/prod/utils/rpcMeta.js +39 -0
- package/build/cjs/prod/utils/rpcMeta.js.map +1 -0
- package/build/cjs/prod/utils/streaming.js +16 -0
- package/build/cjs/prod/utils/streaming.js.map +1 -0
- package/build/cjs/prod/utils/traceLinks.js +54 -0
- package/build/cjs/prod/utils/traceLinks.js.map +1 -0
- package/build/cjs/prod/vendor/stacktrace.js +28 -0
- package/build/cjs/prod/vendor/stacktrace.js.map +1 -0
- package/build/cjs/prod/vite/agentClass.js +114 -0
- package/build/cjs/prod/vite/agentClass.js.map +1 -0
- package/build/cjs/prod/vite/autoInstrument.js +94 -0
- package/build/cjs/prod/vite/autoInstrument.js.map +1 -0
- package/build/cjs/prod/vite/index.js +16 -0
- package/build/cjs/prod/vite/index.js.map +1 -0
- package/build/cjs/prod/vite/instrumentFile.js +31 -0
- package/build/cjs/prod/vite/instrumentFile.js.map +1 -0
- package/build/cjs/prod/vite/moduleShape.js +231 -0
- package/build/cjs/prod/vite/moduleShape.js.map +1 -0
- package/build/cjs/prod/vite/transform.js +149 -0
- package/build/cjs/prod/vite/transform.js.map +1 -0
- package/build/cjs/prod/vite/workerEntrypoint.js +66 -0
- package/build/cjs/prod/vite/workerEntrypoint.js.map +1 -0
- package/build/cjs/prod/vite/wranglerConfig.js +54 -0
- package/build/cjs/prod/vite/wranglerConfig.js.map +1 -0
- package/build/cjs/prod/withSentry.js +29 -0
- package/build/cjs/prod/withSentry.js.map +1 -0
- package/build/cjs/prod/workflows.js +139 -0
- package/build/cjs/prod/workflows.js.map +1 -0
- package/build/cjs/prod/wrapMethodWithSentry.js +134 -0
- package/build/cjs/prod/wrapMethodWithSentry.js.map +1 -0
- package/build/esm/dev/baseSdk.js +79 -0
- package/build/esm/dev/baseSdk.js.map +1 -0
- package/build/esm/{client.js → dev/client.js} +6 -1
- package/build/esm/dev/client.js.map +1 -0
- package/build/esm/dev/debug-build.js.map +1 -0
- package/build/esm/dev/defineCloudflareOptions.js.map +1 -0
- package/build/esm/dev/durableobject.js +229 -0
- package/build/esm/dev/durableobject.js.map +1 -0
- package/build/esm/dev/flush.js.map +1 -0
- package/build/esm/dev/index.js +15 -0
- package/build/esm/{index.js.map → dev/index.js.map} +1 -1
- package/build/esm/dev/instrument.js.map +1 -0
- package/build/esm/dev/instrumentations/agents/index.js +14 -0
- package/build/esm/dev/instrumentations/agents/index.js.map +1 -0
- package/build/esm/dev/instrumentations/agents/instrumentAgentCallableRpc.js +50 -0
- package/build/esm/dev/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -0
- package/build/esm/dev/instrumentations/agents/instrumentAgentRequestConversation.js +17 -0
- package/build/esm/dev/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -0
- package/build/esm/dev/instrumentations/agents/instrumentChatAgentConversation.js +29 -0
- package/build/esm/dev/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -0
- package/build/esm/dev/instrumentations/agents/types.js +69 -0
- package/build/esm/dev/instrumentations/agents/types.js.map +1 -0
- package/build/esm/dev/instrumentations/instrumentDurableObjectNamespace.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/instrumentDurableObjectStorage.js +7 -1
- package/build/esm/dev/instrumentations/instrumentDurableObjectStorage.js.map +1 -0
- package/build/esm/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/instrumentSqlStorage.js +1 -1
- package/build/esm/dev/instrumentations/instrumentSqlStorage.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/instrumentWorkerEntrypoint.js +2 -2
- package/build/esm/dev/instrumentations/instrumentWorkerEntrypoint.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentD1.js +1 -4
- package/build/esm/dev/instrumentations/worker/instrumentD1.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentEmail.js +3 -1
- package/build/esm/dev/instrumentations/worker/instrumentEmail.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentEnv.js +3 -4
- package/build/esm/dev/instrumentations/worker/instrumentEnv.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentFetch.js +10 -4
- package/build/esm/dev/instrumentations/worker/instrumentFetch.js.map +1 -0
- package/build/esm/dev/instrumentations/worker/instrumentFetcher.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentQueue.js +4 -3
- package/build/esm/dev/instrumentations/worker/instrumentQueue.js.map +1 -0
- package/build/esm/dev/instrumentations/worker/instrumentQueueProducer.js.map +1 -0
- package/build/esm/dev/instrumentations/worker/instrumentR2.js.map +1 -0
- package/build/esm/dev/instrumentations/worker/instrumentRateLimit.js.map +1 -0
- package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentScheduled.js +3 -1
- package/build/esm/dev/instrumentations/worker/instrumentScheduled.js.map +1 -0
- package/build/esm/dev/instrumentations/worker/instrumentTail.js.map +1 -0
- package/build/esm/{integrations → dev/integrations}/fetch.js +1 -1
- package/build/esm/dev/integrations/fetch.js.map +1 -0
- package/build/esm/{integrations → dev/integrations}/httpServer.js +5 -4
- package/build/esm/dev/integrations/httpServer.js.map +1 -0
- package/build/esm/dev/integrations/spotlight.js +61 -0
- package/build/esm/dev/integrations/spotlight.js.map +1 -0
- package/build/esm/{integrations → dev/integrations}/tracing/vercelai.js +5 -5
- package/build/esm/dev/integrations/tracing/vercelai.js.map +1 -0
- package/build/esm/dev/opentelemetry/tracer.js.map +1 -0
- package/build/esm/dev/options.js +48 -0
- package/build/esm/dev/options.js.map +1 -0
- package/build/esm/dev/package.json +1 -0
- package/build/esm/{pages-plugin.js → dev/pages-plugin.js} +8 -3
- package/build/esm/dev/pages-plugin.js.map +1 -0
- package/build/esm/{request.js → dev/request.js} +24 -14
- package/build/esm/dev/request.js.map +1 -0
- package/build/esm/dev/scope-utils.js.map +1 -0
- package/build/esm/dev/sdk.js +16 -0
- package/build/esm/dev/sdk.js.map +1 -0
- package/build/esm/dev/transport.js.map +1 -0
- package/build/esm/{utils → dev/utils}/instrumentContext.js +8 -13
- package/build/esm/dev/utils/instrumentContext.js.map +1 -0
- package/build/esm/dev/utils/internalSqlQuery.js +23 -0
- package/build/esm/dev/utils/internalSqlQuery.js.map +1 -0
- package/build/esm/dev/utils/internalStorageKey.js +41 -0
- package/build/esm/dev/utils/internalStorageKey.js.map +1 -0
- package/build/esm/dev/utils/invocationScope.js +10 -0
- package/build/esm/dev/utils/invocationScope.js.map +1 -0
- package/build/esm/dev/utils/isBinding.js.map +1 -0
- package/build/esm/dev/utils/isCloudflareClass.js.map +1 -0
- package/build/esm/{utils → dev/utils}/rpcMeta.js +4 -1
- package/build/esm/dev/utils/rpcMeta.js.map +1 -0
- package/build/esm/dev/utils/streaming.js.map +1 -0
- package/build/esm/dev/utils/traceLinks.js.map +1 -0
- package/build/esm/dev/vendor/stacktrace.js.map +1 -0
- package/build/esm/dev/vite/agentClass.js +111 -0
- package/build/esm/dev/vite/agentClass.js.map +1 -0
- package/build/esm/{vite → dev/vite}/autoInstrument.js +17 -4
- package/build/esm/dev/vite/autoInstrument.js.map +1 -0
- package/build/esm/{vite → dev/vite}/index.js +4 -2
- package/build/esm/dev/vite/index.js.map +1 -0
- package/build/esm/dev/vite/instrumentFile.js.map +1 -0
- package/build/esm/dev/vite/moduleShape.js +227 -0
- package/build/esm/dev/vite/moduleShape.js.map +1 -0
- package/build/esm/{vite → dev/vite}/transform.js +6 -1
- package/build/esm/dev/vite/transform.js.map +1 -0
- package/build/esm/dev/vite/workerEntrypoint.js.map +1 -0
- package/build/esm/{vite → dev/vite}/wranglerConfig.js +1 -1
- package/build/esm/dev/vite/wranglerConfig.js.map +1 -0
- package/build/esm/{withSentry.js → dev/withSentry.js} +1 -18
- package/build/esm/dev/withSentry.js.map +1 -0
- package/build/esm/{workflows.js → dev/workflows.js} +9 -4
- package/build/esm/dev/workflows.js.map +1 -0
- package/build/esm/{wrapMethodWithSentry.js → dev/wrapMethodWithSentry.js} +3 -4
- package/build/esm/dev/wrapMethodWithSentry.js.map +1 -0
- package/build/esm/{sdk.js → prod/baseSdk.js} +24 -17
- package/build/esm/prod/baseSdk.js.map +1 -0
- package/build/esm/prod/client.js +120 -0
- package/build/esm/prod/client.js.map +1 -0
- package/build/esm/prod/debug-build.js +4 -0
- package/build/esm/prod/debug-build.js.map +1 -0
- package/build/esm/prod/defineCloudflareOptions.js +9 -0
- package/build/esm/prod/defineCloudflareOptions.js.map +1 -0
- package/build/esm/prod/durableobject.js +229 -0
- package/build/esm/prod/durableobject.js.map +1 -0
- package/build/esm/prod/flush.js +83 -0
- package/build/esm/prod/flush.js.map +1 -0
- package/build/esm/prod/index.js +15 -0
- package/build/esm/{nodejs_compat → prod}/index.js.map +1 -1
- package/build/esm/prod/instrument.js +48 -0
- package/build/esm/prod/instrument.js.map +1 -0
- package/build/esm/prod/instrumentations/agents/index.js +14 -0
- package/build/esm/prod/instrumentations/agents/index.js.map +1 -0
- package/build/esm/prod/instrumentations/agents/instrumentAgentCallableRpc.js +50 -0
- package/build/esm/prod/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -0
- package/build/esm/prod/instrumentations/agents/instrumentAgentRequestConversation.js +17 -0
- package/build/esm/prod/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -0
- package/build/esm/prod/instrumentations/agents/instrumentChatAgentConversation.js +29 -0
- package/build/esm/prod/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -0
- package/build/esm/prod/instrumentations/agents/types.js +69 -0
- package/build/esm/prod/instrumentations/agents/types.js.map +1 -0
- package/build/esm/prod/instrumentations/instrumentDurableObjectNamespace.js +38 -0
- package/build/esm/prod/instrumentations/instrumentDurableObjectNamespace.js.map +1 -0
- package/build/esm/prod/instrumentations/instrumentDurableObjectStorage.js +70 -0
- package/build/esm/prod/instrumentations/instrumentDurableObjectStorage.js.map +1 -0
- package/build/esm/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js +38 -0
- package/build/esm/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -0
- package/build/esm/prod/instrumentations/instrumentSqlStorage.js +40 -0
- package/build/esm/prod/instrumentations/instrumentSqlStorage.js.map +1 -0
- package/build/esm/prod/instrumentations/instrumentWorkerEntrypoint.js +137 -0
- package/build/esm/prod/instrumentations/instrumentWorkerEntrypoint.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentD1.js +159 -0
- package/build/esm/prod/instrumentations/worker/instrumentD1.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentEmail.js +61 -0
- package/build/esm/prod/instrumentations/worker/instrumentEmail.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentEnv.js +88 -0
- package/build/esm/prod/instrumentations/worker/instrumentEnv.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentFetch.js +51 -0
- package/build/esm/prod/instrumentations/worker/instrumentFetch.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentFetcher.js +22 -0
- package/build/esm/prod/instrumentations/worker/instrumentFetcher.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentQueue.js +79 -0
- package/build/esm/prod/instrumentations/worker/instrumentQueue.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentQueueProducer.js +78 -0
- package/build/esm/prod/instrumentations/worker/instrumentQueueProducer.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentR2.js +122 -0
- package/build/esm/prod/instrumentations/worker/instrumentR2.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentRateLimit.js +27 -0
- package/build/esm/prod/instrumentations/worker/instrumentRateLimit.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentScheduled.js +75 -0
- package/build/esm/prod/instrumentations/worker/instrumentScheduled.js.map +1 -0
- package/build/esm/prod/instrumentations/worker/instrumentTail.js +57 -0
- package/build/esm/prod/instrumentations/worker/instrumentTail.js.map +1 -0
- package/build/esm/prod/integrations/fetch.js +117 -0
- package/build/esm/prod/integrations/fetch.js.map +1 -0
- package/build/esm/prod/integrations/httpServer.js +33 -0
- package/build/esm/prod/integrations/httpServer.js.map +1 -0
- package/build/esm/prod/integrations/spotlight.js +61 -0
- package/build/esm/prod/integrations/spotlight.js.map +1 -0
- package/build/esm/prod/integrations/tracing/vercelai.js +16 -0
- package/build/esm/prod/integrations/tracing/vercelai.js.map +1 -0
- package/build/esm/prod/opentelemetry/tracer.js +47 -0
- package/build/esm/prod/opentelemetry/tracer.js.map +1 -0
- package/build/esm/{options.js → prod/options.js} +5 -1
- package/build/esm/prod/options.js.map +1 -0
- package/build/esm/prod/package.json +1 -0
- package/build/esm/prod/pages-plugin.js +22 -0
- package/build/esm/prod/pages-plugin.js.map +1 -0
- package/build/esm/prod/request.js +129 -0
- package/build/esm/prod/request.js.map +1 -0
- package/build/esm/prod/scope-utils.js +18 -0
- package/build/esm/prod/scope-utils.js.map +1 -0
- package/build/esm/prod/sdk.js +16 -0
- package/build/esm/prod/sdk.js.map +1 -0
- package/build/esm/prod/transport.js +72 -0
- package/build/esm/prod/transport.js.map +1 -0
- package/build/esm/prod/utils/instrumentContext.js +61 -0
- package/build/esm/prod/utils/instrumentContext.js.map +1 -0
- package/build/esm/prod/utils/internalSqlQuery.js +23 -0
- package/build/esm/prod/utils/internalSqlQuery.js.map +1 -0
- package/build/esm/prod/utils/internalStorageKey.js +41 -0
- package/build/esm/prod/utils/internalStorageKey.js.map +1 -0
- package/build/esm/prod/utils/invocationScope.js +10 -0
- package/build/esm/prod/utils/invocationScope.js.map +1 -0
- package/build/esm/prod/utils/isBinding.js +29 -0
- package/build/esm/prod/utils/isBinding.js.map +1 -0
- package/build/esm/prod/utils/isCloudflareClass.js +21 -0
- package/build/esm/prod/utils/isCloudflareClass.js.map +1 -0
- package/build/esm/prod/utils/rpcMeta.js +35 -0
- package/build/esm/prod/utils/rpcMeta.js.map +1 -0
- package/build/esm/prod/utils/streaming.js +14 -0
- package/build/esm/prod/utils/streaming.js.map +1 -0
- package/build/esm/prod/utils/traceLinks.js +49 -0
- package/build/esm/prod/utils/traceLinks.js.map +1 -0
- package/build/esm/prod/vendor/stacktrace.js +25 -0
- package/build/esm/prod/vendor/stacktrace.js.map +1 -0
- package/build/esm/prod/vite/agentClass.js +111 -0
- package/build/esm/prod/vite/agentClass.js.map +1 -0
- package/build/esm/prod/vite/autoInstrument.js +92 -0
- package/build/esm/prod/vite/autoInstrument.js.map +1 -0
- package/build/esm/prod/vite/index.js +14 -0
- package/build/esm/prod/vite/index.js.map +1 -0
- package/build/esm/prod/vite/instrumentFile.js +27 -0
- package/build/esm/prod/vite/instrumentFile.js.map +1 -0
- package/build/esm/prod/vite/moduleShape.js +227 -0
- package/build/esm/prod/vite/moduleShape.js.map +1 -0
- package/build/esm/prod/vite/transform.js +147 -0
- package/build/esm/prod/vite/transform.js.map +1 -0
- package/build/esm/prod/vite/workerEntrypoint.js +64 -0
- package/build/esm/prod/vite/workerEntrypoint.js.map +1 -0
- package/build/esm/prod/vite/wranglerConfig.js +52 -0
- package/build/esm/prod/vite/wranglerConfig.js.map +1 -0
- package/build/esm/prod/withSentry.js +27 -0
- package/build/esm/prod/withSentry.js.map +1 -0
- package/build/esm/prod/workflows.js +136 -0
- package/build/esm/prod/workflows.js.map +1 -0
- package/build/esm/prod/wrapMethodWithSentry.js +132 -0
- package/build/esm/prod/wrapMethodWithSentry.js.map +1 -0
- package/build/types/baseSdk.d.ts +28 -0
- package/build/types/baseSdk.d.ts.map +1 -0
- package/build/types/client.d.ts +43 -33
- package/build/types/client.d.ts.map +1 -1
- package/build/types/defineCloudflareOptions.d.ts +2 -2
- package/build/types/defineCloudflareOptions.d.ts.map +1 -1
- package/build/types/durableobject.d.ts +93 -2
- package/build/types/durableobject.d.ts.map +1 -1
- package/build/types/flush.d.ts +1 -1
- package/build/types/flush.d.ts.map +1 -1
- package/build/types/index.d.ts +5 -6
- package/build/types/index.d.ts.map +1 -1
- package/build/types/instrumentations/agents/index.d.ts +25 -0
- package/build/types/instrumentations/agents/index.d.ts.map +1 -0
- package/build/types/instrumentations/agents/instrumentAgentCallableRpc.d.ts +14 -0
- package/build/types/instrumentations/agents/instrumentAgentCallableRpc.d.ts.map +1 -0
- package/build/types/instrumentations/agents/instrumentAgentRequestConversation.d.ts +16 -0
- package/build/types/instrumentations/agents/instrumentAgentRequestConversation.d.ts.map +1 -0
- package/build/types/instrumentations/agents/instrumentChatAgentConversation.d.ts +23 -0
- package/build/types/instrumentations/agents/instrumentChatAgentConversation.d.ts.map +1 -0
- package/build/types/instrumentations/agents/types.d.ts +94 -0
- package/build/types/instrumentations/agents/types.d.ts.map +1 -0
- package/build/types/instrumentations/instrumentDurableObjectStorage.d.ts.map +1 -1
- package/build/types/instrumentations/instrumentSqlStorage.d.ts.map +1 -1
- package/build/types/instrumentations/instrumentWorkerEntrypoint.d.ts +2 -1
- package/build/types/instrumentations/instrumentWorkerEntrypoint.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentD1.d.ts +0 -16
- package/build/types/instrumentations/worker/instrumentD1.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentEmail.d.ts +2 -2
- package/build/types/instrumentations/worker/instrumentEmail.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentEnv.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentFetch.d.ts +2 -2
- package/build/types/instrumentations/worker/instrumentFetch.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentQueue.d.ts +2 -2
- package/build/types/instrumentations/worker/instrumentQueue.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentScheduled.d.ts +2 -2
- package/build/types/instrumentations/worker/instrumentScheduled.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentTail.d.ts +2 -2
- package/build/types/instrumentations/worker/instrumentTail.d.ts.map +1 -1
- package/build/types/integrations/httpServer.d.ts.map +1 -1
- package/build/types/integrations/spotlight.d.ts +22 -0
- package/build/types/integrations/spotlight.d.ts.map +1 -0
- package/build/types/integrations/tracing/vercelai.d.ts +2 -9
- package/build/types/integrations/tracing/vercelai.d.ts.map +1 -1
- package/build/types/options.d.ts.map +1 -1
- package/build/types/pages-plugin.d.ts +1 -1
- package/build/types/pages-plugin.d.ts.map +1 -1
- package/build/types/request.d.ts +17 -2
- package/build/types/request.d.ts.map +1 -1
- package/build/types/sdk.d.ts +8 -3
- package/build/types/sdk.d.ts.map +1 -1
- package/build/types/transport.d.ts.map +1 -1
- package/build/types/types.d.ts +85 -0
- package/build/types/types.d.ts.map +1 -0
- package/build/types/utils/instrumentContext.d.ts.map +1 -1
- package/build/types/utils/internalSqlQuery.d.ts +4 -2
- package/build/types/utils/internalSqlQuery.d.ts.map +1 -1
- package/build/types/utils/internalStorageKey.d.ts +22 -0
- package/build/types/utils/internalStorageKey.d.ts.map +1 -0
- package/build/types/utils/invocationScope.d.ts +24 -0
- package/build/types/utils/invocationScope.d.ts.map +1 -0
- package/build/types/utils/isCloudflareClass.d.ts +1 -1
- package/build/types/utils/isCloudflareClass.d.ts.map +1 -1
- package/build/types/utils/rpcMeta.d.ts +8 -0
- package/build/types/utils/rpcMeta.d.ts.map +1 -1
- package/build/types/vite/agentClass.d.ts +41 -0
- package/build/types/vite/agentClass.d.ts.map +1 -0
- package/build/types/vite/autoInstrument.d.ts +7 -6
- package/build/types/vite/autoInstrument.d.ts.map +1 -1
- package/build/types/vite/index.d.ts +31 -45
- package/build/types/vite/index.d.ts.map +1 -1
- package/build/types/vite/moduleShape.d.ts +52 -0
- package/build/types/vite/moduleShape.d.ts.map +1 -0
- package/build/types/vite/transform.d.ts +6 -1
- package/build/types/vite/transform.d.ts.map +1 -1
- package/build/types/withSentry.d.ts +2 -2
- package/build/types/withSentry.d.ts.map +1 -1
- package/build/types/workflows.d.ts +5 -4
- package/build/types/workflows.d.ts.map +1 -1
- package/build/types/wrapMethodWithSentry.d.ts +1 -1
- package/build/types/wrapMethodWithSentry.d.ts.map +1 -1
- package/package.json +28 -51
- package/build/cjs/async.js +0 -63
- package/build/cjs/async.js.map +0 -1
- package/build/cjs/client.js.map +0 -1
- package/build/cjs/debug-build.js.map +0 -1
- package/build/cjs/defineCloudflareOptions.js.map +0 -1
- package/build/cjs/durableobject.js +0 -120
- package/build/cjs/durableobject.js.map +0 -1
- package/build/cjs/flush.js.map +0 -1
- package/build/cjs/instrument.js.map +0 -1
- package/build/cjs/instrumentations/instrumentDurableObjectNamespace.js.map +0 -1
- package/build/cjs/instrumentations/instrumentDurableObjectStorage.js.map +0 -1
- package/build/cjs/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +0 -1
- package/build/cjs/instrumentations/instrumentSqlStorage.js.map +0 -1
- package/build/cjs/instrumentations/instrumentWorkerEntrypoint.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentD1.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentEmail.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentEnv.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentFetch.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentFetcher.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentQueue.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentQueueProducer.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentR2.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentRateLimit.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentScheduled.js.map +0 -1
- package/build/cjs/instrumentations/worker/instrumentTail.js.map +0 -1
- package/build/cjs/integrations/fetch.js.map +0 -1
- package/build/cjs/integrations/hono.js +0 -52
- package/build/cjs/integrations/hono.js.map +0 -1
- package/build/cjs/integrations/httpServer.js.map +0 -1
- package/build/cjs/integrations/tracing/vercelai.js.map +0 -1
- package/build/cjs/nodejs_compat/integrations/tracing/vercelai.js.map +0 -1
- package/build/cjs/opentelemetry/tracer.js.map +0 -1
- package/build/cjs/options.js.map +0 -1
- package/build/cjs/pages-plugin.js.map +0 -1
- package/build/cjs/request.js.map +0 -1
- package/build/cjs/scope-utils.js.map +0 -1
- package/build/cjs/sdk.js.map +0 -1
- package/build/cjs/transport.js.map +0 -1
- package/build/cjs/utils/instrumentContext.js.map +0 -1
- package/build/cjs/utils/internalSqlQuery.js +0 -19
- package/build/cjs/utils/internalSqlQuery.js.map +0 -1
- package/build/cjs/utils/isBinding.js.map +0 -1
- package/build/cjs/utils/isCloudflareClass.js.map +0 -1
- package/build/cjs/utils/rpcMeta.js.map +0 -1
- package/build/cjs/utils/rpcOptions.js +0 -26
- package/build/cjs/utils/rpcOptions.js.map +0 -1
- package/build/cjs/utils/streaming.js.map +0 -1
- package/build/cjs/utils/traceLinks.js.map +0 -1
- package/build/cjs/vendor/stacktrace.js.map +0 -1
- package/build/cjs/vite/autoInstrument.js.map +0 -1
- package/build/cjs/vite/index.js.map +0 -1
- package/build/cjs/vite/instrumentFile.js.map +0 -1
- package/build/cjs/vite/transform.js.map +0 -1
- package/build/cjs/vite/workerEntrypoint.js.map +0 -1
- package/build/cjs/vite/wranglerConfig.js.map +0 -1
- package/build/cjs/withSentry.js.map +0 -1
- package/build/cjs/workflows.js.map +0 -1
- package/build/cjs/wrapMethodWithSentry.js.map +0 -1
- package/build/esm/async.js +0 -61
- package/build/esm/async.js.map +0 -1
- package/build/esm/client.js.map +0 -1
- package/build/esm/debug-build.js.map +0 -1
- package/build/esm/defineCloudflareOptions.js.map +0 -1
- package/build/esm/durableobject.js +0 -118
- package/build/esm/durableobject.js.map +0 -1
- package/build/esm/flush.js.map +0 -1
- package/build/esm/index.js +0 -16
- package/build/esm/instrument.js.map +0 -1
- package/build/esm/instrumentations/instrumentDurableObjectNamespace.js.map +0 -1
- package/build/esm/instrumentations/instrumentDurableObjectStorage.js.map +0 -1
- package/build/esm/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +0 -1
- package/build/esm/instrumentations/instrumentSqlStorage.js.map +0 -1
- package/build/esm/instrumentations/instrumentWorkerEntrypoint.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentD1.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentEmail.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentEnv.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentFetch.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentFetcher.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentQueue.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentQueueProducer.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentR2.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentRateLimit.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentScheduled.js.map +0 -1
- package/build/esm/instrumentations/worker/instrumentTail.js.map +0 -1
- package/build/esm/integrations/fetch.js.map +0 -1
- package/build/esm/integrations/hono.js +0 -49
- package/build/esm/integrations/hono.js.map +0 -1
- package/build/esm/integrations/httpServer.js.map +0 -1
- package/build/esm/integrations/tracing/vercelai.js.map +0 -1
- package/build/esm/nodejs_compat/index.js +0 -17
- package/build/esm/nodejs_compat/integrations/tracing/vercelai.js +0 -16
- package/build/esm/nodejs_compat/integrations/tracing/vercelai.js.map +0 -1
- package/build/esm/opentelemetry/tracer.js.map +0 -1
- package/build/esm/options.js.map +0 -1
- package/build/esm/package.json +0 -1
- package/build/esm/pages-plugin.js.map +0 -1
- package/build/esm/request.js.map +0 -1
- package/build/esm/scope-utils.js.map +0 -1
- package/build/esm/sdk.js.map +0 -1
- package/build/esm/transport.js.map +0 -1
- package/build/esm/utils/instrumentContext.js.map +0 -1
- package/build/esm/utils/internalSqlQuery.js +0 -17
- package/build/esm/utils/internalSqlQuery.js.map +0 -1
- package/build/esm/utils/isBinding.js.map +0 -1
- package/build/esm/utils/isCloudflareClass.js.map +0 -1
- package/build/esm/utils/rpcMeta.js.map +0 -1
- package/build/esm/utils/rpcOptions.js +0 -24
- package/build/esm/utils/rpcOptions.js.map +0 -1
- package/build/esm/utils/streaming.js.map +0 -1
- package/build/esm/utils/traceLinks.js.map +0 -1
- package/build/esm/vendor/stacktrace.js.map +0 -1
- package/build/esm/vite/autoInstrument.js.map +0 -1
- package/build/esm/vite/index.js.map +0 -1
- package/build/esm/vite/instrumentFile.js.map +0 -1
- package/build/esm/vite/transform.js.map +0 -1
- package/build/esm/vite/workerEntrypoint.js.map +0 -1
- package/build/esm/vite/wranglerConfig.js.map +0 -1
- package/build/esm/withSentry.js.map +0 -1
- package/build/esm/workflows.js.map +0 -1
- package/build/esm/wrapMethodWithSentry.js.map +0 -1
- package/build/types/async.d.ts +0 -11
- package/build/types/async.d.ts.map +0 -1
- package/build/types/integrations/hono.d.ts +0 -42
- package/build/types/integrations/hono.d.ts.map +0 -1
- package/build/types/nodejs_compat/index.d.ts +0 -4
- package/build/types/nodejs_compat/index.d.ts.map +0 -1
- package/build/types/nodejs_compat/integrations/tracing/vercelai.d.ts +0 -37
- package/build/types/nodejs_compat/integrations/tracing/vercelai.d.ts.map +0 -1
- package/build/types/utils/rpcOptions.d.ts +0 -13
- package/build/types/utils/rpcOptions.d.ts.map +0 -1
- package/build/types-ts3.8/async.d.ts +0 -11
- package/build/types-ts3.8/client.d.ts +0 -166
- package/build/types-ts3.8/debug-build.d.ts +0 -7
- package/build/types-ts3.8/defineCloudflareOptions.d.ts +0 -38
- package/build/types-ts3.8/durableobject.d.ts +0 -37
- package/build/types-ts3.8/executionContext.d.ts +0 -13
- package/build/types-ts3.8/flush.d.ts +0 -47
- package/build/types-ts3.8/index.d.ts +0 -18
- package/build/types-ts3.8/instrument.d.ts +0 -20
- package/build/types-ts3.8/instrumentations/instrumentDurableObjectNamespace.d.ts +0 -13
- package/build/types-ts3.8/instrumentations/instrumentDurableObjectStorage.d.ts +0 -19
- package/build/types-ts3.8/instrumentations/instrumentDurableObjectSyncKvStorage.d.ts +0 -3
- package/build/types-ts3.8/instrumentations/instrumentSqlStorage.d.ts +0 -9
- package/build/types-ts3.8/instrumentations/instrumentWorkerEntrypoint.d.ts +0 -42
- package/build/types-ts3.8/instrumentations/worker/instrumentD1.d.ts +0 -19
- package/build/types-ts3.8/instrumentations/worker/instrumentEmail.d.ts +0 -8
- package/build/types-ts3.8/instrumentations/worker/instrumentEnv.d.ts +0 -18
- package/build/types-ts3.8/instrumentations/worker/instrumentFetch.d.ts +0 -12
- package/build/types-ts3.8/instrumentations/worker/instrumentFetcher.d.ts +0 -10
- package/build/types-ts3.8/instrumentations/worker/instrumentQueue.d.ts +0 -12
- package/build/types-ts3.8/instrumentations/worker/instrumentQueueProducer.d.ts +0 -10
- package/build/types-ts3.8/instrumentations/worker/instrumentR2.d.ts +0 -9
- package/build/types-ts3.8/instrumentations/worker/instrumentRateLimit.d.ts +0 -6
- package/build/types-ts3.8/instrumentations/worker/instrumentScheduled.d.ts +0 -12
- package/build/types-ts3.8/instrumentations/worker/instrumentTail.d.ts +0 -12
- package/build/types-ts3.8/integrations/fetch.d.ts +0 -19
- package/build/types-ts3.8/integrations/hono.d.ts +0 -42
- package/build/types-ts3.8/integrations/httpServer.d.ts +0 -63
- package/build/types-ts3.8/integrations/tracing/vercelai.d.ts +0 -47
- package/build/types-ts3.8/nodejs_compat/index.d.ts +0 -4
- package/build/types-ts3.8/nodejs_compat/integrations/tracing/vercelai.d.ts +0 -37
- package/build/types-ts3.8/opentelemetry/tracer.d.ts +0 -6
- package/build/types-ts3.8/options.d.ts +0 -17
- package/build/types-ts3.8/pages-plugin.d.ts +0 -34
- package/build/types-ts3.8/request.d.ts +0 -25
- package/build/types-ts3.8/scope-utils.d.ts +0 -15
- package/build/types-ts3.8/sdk.d.ts +0 -10
- package/build/types-ts3.8/transport.d.ts +0 -34
- package/build/types-ts3.8/utils/instrumentContext.d.ts +0 -16
- package/build/types-ts3.8/utils/internalSqlQuery.d.ts +0 -18
- package/build/types-ts3.8/utils/isBinding.d.ts +0 -77
- package/build/types-ts3.8/utils/isCloudflareClass.d.ts +0 -30
- package/build/types-ts3.8/utils/rpcMeta.d.ts +0 -15
- package/build/types-ts3.8/utils/rpcOptions.d.ts +0 -13
- package/build/types-ts3.8/utils/streaming.d.ts +0 -17
- package/build/types-ts3.8/utils/traceLinks.d.ts +0 -28
- package/build/types-ts3.8/vendor/stacktrace.d.ts +0 -11
- package/build/types-ts3.8/vite/autoInstrument.d.ts +0 -21
- package/build/types-ts3.8/vite/index.d.ts +0 -88
- package/build/types-ts3.8/vite/instrumentFile.d.ts +0 -22
- package/build/types-ts3.8/vite/transform.d.ts +0 -60
- package/build/types-ts3.8/vite/workerEntrypoint.d.ts +0 -12
- package/build/types-ts3.8/vite/wranglerConfig.d.ts +0 -43
- package/build/types-ts3.8/withSentry.d.ts +0 -16
- package/build/types-ts3.8/workflows.d.ts +0 -25
- package/build/types-ts3.8/wrapMethodWithSentry.d.ts +0 -43
- /package/build/cjs/{debug-build.js → dev/debug-build.js} +0 -0
- /package/build/cjs/{defineCloudflareOptions.js → dev/defineCloudflareOptions.js} +0 -0
- /package/build/cjs/{flush.js → dev/flush.js} +0 -0
- /package/build/cjs/{instrument.js → dev/instrument.js} +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/instrumentDurableObjectNamespace.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/instrumentDurableObjectSyncKvStorage.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentFetcher.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentQueueProducer.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentR2.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentRateLimit.js +0 -0
- /package/build/cjs/{instrumentations → dev/instrumentations}/worker/instrumentTail.js +0 -0
- /package/build/cjs/{opentelemetry → dev/opentelemetry}/tracer.js +0 -0
- /package/build/cjs/{scope-utils.js → dev/scope-utils.js} +0 -0
- /package/build/cjs/{transport.js → dev/transport.js} +0 -0
- /package/build/cjs/{utils → dev/utils}/isBinding.js +0 -0
- /package/build/cjs/{utils → dev/utils}/isCloudflareClass.js +0 -0
- /package/build/cjs/{utils → dev/utils}/streaming.js +0 -0
- /package/build/cjs/{utils → dev/utils}/traceLinks.js +0 -0
- /package/build/cjs/{vendor → dev/vendor}/stacktrace.js +0 -0
- /package/build/cjs/{vite → dev/vite}/instrumentFile.js +0 -0
- /package/build/cjs/{vite → dev/vite}/workerEntrypoint.js +0 -0
- /package/build/esm/{debug-build.js → dev/debug-build.js} +0 -0
- /package/build/esm/{defineCloudflareOptions.js → dev/defineCloudflareOptions.js} +0 -0
- /package/build/esm/{flush.js → dev/flush.js} +0 -0
- /package/build/esm/{instrument.js → dev/instrument.js} +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/instrumentDurableObjectNamespace.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/instrumentDurableObjectSyncKvStorage.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentFetcher.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentQueueProducer.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentR2.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentRateLimit.js +0 -0
- /package/build/esm/{instrumentations → dev/instrumentations}/worker/instrumentTail.js +0 -0
- /package/build/esm/{opentelemetry → dev/opentelemetry}/tracer.js +0 -0
- /package/build/esm/{scope-utils.js → dev/scope-utils.js} +0 -0
- /package/build/esm/{transport.js → dev/transport.js} +0 -0
- /package/build/esm/{utils → dev/utils}/isBinding.js +0 -0
- /package/build/esm/{utils → dev/utils}/isCloudflareClass.js +0 -0
- /package/build/esm/{utils → dev/utils}/streaming.js +0 -0
- /package/build/esm/{utils → dev/utils}/traceLinks.js +0 -0
- /package/build/esm/{vendor → dev/vendor}/stacktrace.js +0 -0
- /package/build/esm/{vite → dev/vite}/instrumentFile.js +0 -0
- /package/build/esm/{vite → dev/vite}/workerEntrypoint.js +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { GEN_AI_AGENT_NAME } from '@sentry/conventions/attributes';
|
|
2
|
+
import { getIsolationScope, getCurrentScope, debug, uuid4 } from '@sentry/core';
|
|
3
|
+
import { DEBUG_BUILD } from '../../debug-build.js';
|
|
4
|
+
|
|
5
|
+
const AGENT_SPAN_ORIGIN = "auto.faas.cloudflare.agents";
|
|
6
|
+
const AGENT_CONVERSATION_ID_STORAGE_KEY = "__SENTRY_AGENT_CONVERSATION_ID__";
|
|
7
|
+
const AGENT_CONVERSATION_ID_SYMBOL = /* @__PURE__ */ Symbol("sentryAgentConversationId");
|
|
8
|
+
const AGENT_APPLIED_CONVERSATION_ID_SYMBOL = /* @__PURE__ */ Symbol("sentryAgentAppliedConversationId");
|
|
9
|
+
function getAgentAttributes(instance) {
|
|
10
|
+
const attributes = {};
|
|
11
|
+
const agentClass = instance._ParentClass?.name;
|
|
12
|
+
if (typeof agentClass === "string" && agentClass) {
|
|
13
|
+
attributes[GEN_AI_AGENT_NAME] = agentClass;
|
|
14
|
+
}
|
|
15
|
+
return attributes;
|
|
16
|
+
}
|
|
17
|
+
function storeAgentConversationId(instance, conversationId) {
|
|
18
|
+
instance[AGENT_CONVERSATION_ID_SYMBOL] = conversationId;
|
|
19
|
+
const storage = resolveStorage(instance);
|
|
20
|
+
if (!storage) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
storage.put(AGENT_CONVERSATION_ID_STORAGE_KEY, conversationId).catch((error) => DEBUG_BUILD && debug.log("[Sentry] Failed to persist agent conversation id", error));
|
|
25
|
+
} catch (error) {
|
|
26
|
+
DEBUG_BUILD && debug.log("[Sentry] Failed to persist agent conversation id", error);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async function setAgentConversationId(instance) {
|
|
30
|
+
const isolationScope = getIsolationScope();
|
|
31
|
+
const existing = isolationScope.getScopeData().conversationId ?? getCurrentScope().getScopeData().conversationId;
|
|
32
|
+
if (existing && existing !== instance[AGENT_APPLIED_CONVERSATION_ID_SYMBOL]) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const conversationId = instance[AGENT_CONVERSATION_ID_SYMBOL] ?? await loadAgentConversationId(instance);
|
|
36
|
+
instance[AGENT_APPLIED_CONVERSATION_ID_SYMBOL] = conversationId;
|
|
37
|
+
isolationScope.setConversationId(conversationId);
|
|
38
|
+
}
|
|
39
|
+
async function loadAgentConversationId(instance) {
|
|
40
|
+
let stored;
|
|
41
|
+
let readFailed = false;
|
|
42
|
+
try {
|
|
43
|
+
stored = await resolveStorage(instance)?.get(AGENT_CONVERSATION_ID_STORAGE_KEY);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
readFailed = true;
|
|
46
|
+
DEBUG_BUILD && debug.log("[Sentry] Failed to read agent conversation id from storage", error);
|
|
47
|
+
}
|
|
48
|
+
const cached = instance[AGENT_CONVERSATION_ID_SYMBOL];
|
|
49
|
+
if (cached !== void 0) {
|
|
50
|
+
return cached;
|
|
51
|
+
}
|
|
52
|
+
if (typeof stored === "string" && stored) {
|
|
53
|
+
instance[AGENT_CONVERSATION_ID_SYMBOL] = stored;
|
|
54
|
+
return stored;
|
|
55
|
+
}
|
|
56
|
+
const conversationId = uuid4();
|
|
57
|
+
if (readFailed) {
|
|
58
|
+
instance[AGENT_CONVERSATION_ID_SYMBOL] = conversationId;
|
|
59
|
+
} else {
|
|
60
|
+
storeAgentConversationId(instance, conversationId);
|
|
61
|
+
}
|
|
62
|
+
return conversationId;
|
|
63
|
+
}
|
|
64
|
+
function resolveStorage(instance) {
|
|
65
|
+
return instance.ctx?.originalStorage ?? instance.ctx?.storage;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { AGENT_APPLIED_CONVERSATION_ID_SYMBOL, AGENT_CONVERSATION_ID_STORAGE_KEY, AGENT_CONVERSATION_ID_SYMBOL, AGENT_SPAN_ORIGIN, getAgentAttributes, setAgentConversationId, storeAgentConversationId };
|
|
69
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../../src/instrumentations/agents/types.ts"],"sourcesContent":["import { GEN_AI_AGENT_NAME } from '@sentry/conventions/attributes';\nimport type { DurableObjectStorage } from '@cloudflare/workers-types';\nimport { debug, getCurrentScope, getIsolationScope, uuid4 } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport type { InstrumentedDurableObjectState } from '../../wrapMethodWithSentry';\n\nexport const AGENT_SPAN_ORIGIN = 'auto.faas.cloudflare.agents';\n\n/** DO storage key under which the conversation id is persisted so it survives hibernation. */\nexport const AGENT_CONVERSATION_ID_STORAGE_KEY = '__SENTRY_AGENT_CONVERSATION_ID__';\n\n/**\n * Instance keys for our conversation-id bookkeeping, keyed by symbol so the state stays invisible\n * to anything enumerating the user-owned agent instance (`Object.keys`, `JSON.stringify`, spread).\n * Exported because the exported `AgentInternals` interface references them.\n */\nexport const AGENT_CONVERSATION_ID_SYMBOL: unique symbol = Symbol('sentryAgentConversationId');\nexport const AGENT_APPLIED_CONVERSATION_ID_SYMBOL: unique symbol = Symbol('sentryAgentAppliedConversationId');\n\n/**\n * The subset of the `agents` `Agent` instance internals that we instrument. These are runtime\n * implementation details of the `agents` package (v0.13.x) rather than part of its public type\n * surface, so every access is guarded and wrapping degrades gracefully if a name changes upstream.\n */\nexport interface AgentInternals {\n /** Central choke-point through which all `agents:*` observability events are published. */\n _emit?: (type: string, payload?: Record<string, unknown>) => void;\n /** WebSocket message handler; dispatches `@callable()` RPC requests. */\n onMessage?: (...args: unknown[]) => unknown;\n /**\n * Chat-turn handler. Only `AIChatAgent` (from `@cloudflare/ai-chat`) defines this; a plain `Agent`\n * does not, so its presence discriminates a chat agent.\n */\n onChatMessage?: (...args: unknown[]) => unknown;\n /** HTTP request handler; the router sends every non-WebSocket request here. */\n onRequest?: (...args: unknown[]) => unknown;\n /** The user's Agent class (used by the SDK for the observability event `agent` field). */\n _ParentClass?: { name?: string };\n /** The Agent instance name, reported as the `cloudflare.agent.name` span attribute. */\n name?: string;\n /**\n * The Durable Object state of the instance. Present on every real Agent; guarded like the other\n * internals so partially-mocked instances keep working.\n */\n ctx?: InstrumentedDurableObjectState;\n /**\n * The current conversation id for this agent instance. It is cached in memory after being loaded\n * from Durable Object storage and updated when the conversation rotates. `undefined` means storage\n * has not been read yet.\n */\n [AGENT_CONVERSATION_ID_SYMBOL]?: string;\n /**\n * The conversation id this instrumentation most recently applied to the isolation scope. It lets\n * subsequent units of work distinguish an SDK-applied id, which may be replaced after rotation,\n * from an id explicitly set by the user, which must be preserved.\n */\n [AGENT_APPLIED_CONVERSATION_ID_SYMBOL]?: string;\n}\n\n/** Reads best-effort agent identity attributes from the instance, tolerating missing internals. */\nexport function getAgentAttributes(instance: AgentInternals): Record<string, string> {\n const attributes: Record<string, string> = {};\n\n const agentClass = instance._ParentClass?.name;\n if (typeof agentClass === 'string' && agentClass) {\n attributes[GEN_AI_AGENT_NAME] = agentClass;\n }\n\n return attributes;\n}\n\n/**\n * Persists the conversation id to Durable Object storage, so it survives hibernation, and updates\n * the in-memory cache synchronously so the current wake is immediately consistent even if the\n * write fails. Uses the async storage API, which exists on KV- and SQLite-backed DOs alike.\n * The write is fire-and-forget: DO storage writes are tracked by the runtime and land without\n * awaiting (`waitUntil` is a no-op in Durable Objects), and the catch keeps a rejection from\n * surfacing as unhandled — a failed write just means the next wake starts a new conversation,\n * which must never throw into user code. Uses the original uninstrumented storage so internal\n * bookkeeping doesn't create spans.\n */\nexport function storeAgentConversationId(instance: AgentInternals, conversationId: string): void {\n instance[AGENT_CONVERSATION_ID_SYMBOL] = conversationId;\n\n const storage = resolveStorage(instance);\n if (!storage) {\n return;\n }\n\n try {\n storage\n .put(AGENT_CONVERSATION_ID_STORAGE_KEY, conversationId)\n .catch(error => DEBUG_BUILD && debug.log('[Sentry] Failed to persist agent conversation id', error));\n } catch (error) {\n DEBUG_BUILD && debug.log('[Sentry] Failed to persist agent conversation id', error);\n }\n}\n\n/**\n * Sets the agent instance's conversation id on the active scope for the duration of the\n * surrounding unit of work (chat turn, callable RPC call, HTTP request). In the Agents model one\n * instance is one long-lived conversation, so the id is minted once per instance and persisted to\n * DO storage — for chat and plain agents alike, since plain agents run LLM calls too (e.g. inside\n * `@callable()` methods). The instance `name` is deliberately not used: it is caller-chosen and can\n * be a stable, guessable, or shared value, whereas a conversation id should identify exactly one\n * conversation. Clearing the chat rotates it (see `storeAgentConversationId`) so subsequent LLM\n * calls group under the fresh conversation.\n *\n * Every handler wrapper awaits this before invoking the original, so the id is on the scope before\n * the unit of work — and any `gen_ai` span it creates — starts. Only the first unit of work per wake\n * pays the storage read; the rest resolve from the in-memory cache. Awaiting is safe on all three\n * paths because the `agents` `Agent` constructor already replaces `onMessage` and `onRequest` with\n * `async` wrappers of its own, and `onChatMessage` is async by contract, so every caller upstream\n * already handles a promise.\n *\n * An id the user set explicitly outranks this inferred one, in either order: a `setConversationId()`\n * call that already happened is detected here and left alone, and one made inside the handler lands\n * on the same scope afterwards and therefore wins. That is why the write targets the isolation scope\n * — it is the scope the public `Sentry.setConversationId()` writes to, and `conversationIdIntegration`\n * prefers the current scope over it, so writing there would make a user's call unoverridable.\n *\n * `conversationIdIntegration` reads the id off the scope at `spanStart` and stamps\n * `gen_ai.conversation.id` onto AI spans created within the unit of work, correlating its model and\n * tool calls.\n */\nexport async function setAgentConversationId(instance: AgentInternals): Promise<void> {\n const isolationScope = getIsolationScope();\n const existing = isolationScope.getScopeData().conversationId ?? getCurrentScope().getScopeData().conversationId;\n\n // An id that isn't the one we put there ourselves came from the user — never override it.\n if (existing && existing !== instance[AGENT_APPLIED_CONVERSATION_ID_SYMBOL]) {\n return;\n }\n\n const conversationId = instance[AGENT_CONVERSATION_ID_SYMBOL] ?? (await loadAgentConversationId(instance));\n\n instance[AGENT_APPLIED_CONVERSATION_ID_SYMBOL] = conversationId;\n isolationScope.setConversationId(conversationId);\n}\n\n/**\n * Reads the persisted id into the instance cache, minting and persisting a fresh one when storage\n * holds none, so subsequent units of work resolve from memory. The async `get` exists on KV- and\n * SQLite-backed DOs alike, so this one path covers both.\n *\n * Anything already cached by the time the read lands wins over the read: that covers a rotation\n * (cleared chat) racing the read, and a second concurrent unit of work that must not mint and\n * persist a competing id for the same conversation.\n */\nasync function loadAgentConversationId(instance: AgentInternals): Promise<string> {\n let stored: unknown;\n let readFailed = false;\n\n try {\n stored = await resolveStorage(instance)?.get<string>(AGENT_CONVERSATION_ID_STORAGE_KEY);\n } catch (error) {\n readFailed = true;\n DEBUG_BUILD && debug.log('[Sentry] Failed to read agent conversation id from storage', error);\n }\n\n const cached = instance[AGENT_CONVERSATION_ID_SYMBOL];\n\n if (cached !== undefined) {\n return cached;\n }\n\n if (typeof stored === 'string' && stored) {\n instance[AGENT_CONVERSATION_ID_SYMBOL] = stored;\n\n return stored;\n }\n\n const conversationId = uuid4();\n\n if (readFailed) {\n // Cache without persisting: a read that failed may still have an id behind it, and overwriting\n // it would split the conversation for good instead of just for this wake.\n instance[AGENT_CONVERSATION_ID_SYMBOL] = conversationId;\n } else {\n storeAgentConversationId(instance, conversationId);\n }\n\n return conversationId;\n}\n\n/**\n * Resolves the uninstrumented DO storage for internal reads/writes, so they don't create spans of\n * their own. Falls back to the instance's regular storage when the uninstrumented one isn't\n * exposed (e.g. when `instrumentCloudflareAgent` is used directly, without `instrumentContext`).\n */\nfunction resolveStorage(instance: AgentInternals): DurableObjectStorage | undefined {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../utils/rpcMeta.js';
|
|
2
|
+
import { instrumentFetcher } from './worker/instrumentFetcher.js';
|
|
3
|
+
|
|
4
|
+
const STUB_NON_RPC_METHODS = /* @__PURE__ */ new Set(["fetch", "connect", "dup"]);
|
|
5
|
+
function instrumentDurableObjectNamespace(namespace) {
|
|
6
|
+
return new Proxy(namespace, {
|
|
7
|
+
get(target, prop, _receiver) {
|
|
8
|
+
const value = Reflect.get(target, prop);
|
|
9
|
+
if (typeof value !== "function") {
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
if (prop === "get" || prop === "getByName") {
|
|
13
|
+
return function(...args) {
|
|
14
|
+
const stub = Reflect.apply(value, target, args);
|
|
15
|
+
return instrumentDurableObjectStub(stub);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return value.bind(target);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function instrumentDurableObjectStub(stub) {
|
|
23
|
+
return new Proxy(stub, {
|
|
24
|
+
get(target, prop) {
|
|
25
|
+
const value = Reflect.get(target, prop);
|
|
26
|
+
if (prop === "fetch" && typeof value === "function") {
|
|
27
|
+
return instrumentFetcher((...args) => Reflect.apply(value, target, args));
|
|
28
|
+
}
|
|
29
|
+
if (typeof value === "function" && typeof prop === "string" && !STUB_NON_RPC_METHODS.has(prop)) {
|
|
30
|
+
return (...args) => Reflect.apply(value, target, appendRpcMeta(args));
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { STUB_NON_RPC_METHODS, instrumentDurableObjectNamespace };
|
|
38
|
+
//# sourceMappingURL=instrumentDurableObjectNamespace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentDurableObjectNamespace.js","sources":["../../../../src/instrumentations/instrumentDurableObjectNamespace.ts"],"sourcesContent":["import type { DurableObjectNamespace, DurableObjectStub } from '@cloudflare/workers-types';\nimport { appendRpcMeta } from '../utils/rpcMeta';\nimport { instrumentFetcher } from './worker/instrumentFetcher';\n\n// Built-in DurableObjectStub methods that are not RPC calls.\nexport const STUB_NON_RPC_METHODS = new Set(['fetch', 'connect', 'dup']);\n\n/**\n * Instruments a DurableObjectNamespace binding to create spans for DO interactions.\n *\n * Wraps:\n * - `namespace.get(id)` / `namespace.getByName(name)` with a span + instruments returned stub\n * - `namespace.idFromName(name)` / `namespace.idFromString(id)` / `namespace.newUniqueId()` with breadcrumbs\n *\n * @param namespace - The DurableObjectNamespace to instrument\n */\nexport function instrumentDurableObjectNamespace(namespace: DurableObjectNamespace): DurableObjectNamespace {\n return new Proxy(namespace, {\n get(target, prop, _receiver) {\n const value = Reflect.get(target, prop) as unknown;\n\n if (typeof value !== 'function') {\n return value;\n }\n\n if (prop === 'get' || prop === 'getByName') {\n return function (this: unknown, ...args: unknown[]) {\n const stub = Reflect.apply(value, target, args);\n\n return instrumentDurableObjectStub(stub);\n };\n }\n\n return value.bind(target);\n },\n });\n}\n\n/**\n * Instruments a DurableObjectStub to create spans for outgoing fetch calls\n * and propagate trace context across RPC calls.\n *\n * @param stub - The DurableObjectStub to instrument\n */\nfunction instrumentDurableObjectStub(stub: DurableObjectStub): DurableObjectStub {\n return new Proxy(stub, {\n get(target, prop) {\n const value = Reflect.get(target, prop);\n\n if (prop === 'fetch' && typeof value === 'function') {\n return instrumentFetcher((...args) => Reflect.apply(value, target, args));\n }\n\n if (typeof value === 'function' && typeof prop === 'string' && !STUB_NON_RPC_METHODS.has(prop)) {\n return (...args: unknown[]) => Reflect.apply(value, target, appendRpcMeta(args));\n }\n\n return value;\n },\n });\n}\n"],"names":[],"mappings":";;;AAKO,MAAM,uCAAuB,IAAI,GAAA,CAAI,CAAC,OAAA,EAAS,SAAA,EAAW,KAAK,CAAC;AAWhE,SAAS,iCAAiC,SAAA,EAA2D;AAC1G,EAAA,OAAO,IAAI,MAAM,SAAA,EAAW;AAAA,IAC1B,GAAA,CAAI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AA,GACD,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { getClient, startSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, isThenable } from '@sentry/core';
|
|
2
|
+
import { getStorageKeys, targetsCloudflareInternalKey } from '../utils/internalStorageKey.js';
|
|
3
|
+
import { storeSpanContext } from '../utils/traceLinks.js';
|
|
4
|
+
import { instrumentDurableObjectSyncKvStorage } from './instrumentDurableObjectSyncKvStorage.js';
|
|
5
|
+
import { instrumentSqlStorage } from './instrumentSqlStorage.js';
|
|
6
|
+
|
|
7
|
+
const STORAGE_METHODS_TO_INSTRUMENT = ["get", "put", "delete", "list", "setAlarm", "getAlarm", "deleteAlarm"];
|
|
8
|
+
function instrumentDurableObjectStorage(storage, waitUntil) {
|
|
9
|
+
return new Proxy(storage, {
|
|
10
|
+
get(target, prop, _receiver) {
|
|
11
|
+
const original = Reflect.get(target, prop, target);
|
|
12
|
+
if (prop === "kv" && original != null && "get" in original && "put" in original) {
|
|
13
|
+
return instrumentDurableObjectSyncKvStorage(original);
|
|
14
|
+
}
|
|
15
|
+
if (prop === "sql" && original != null && "databaseSize" in original && "exec" in original) {
|
|
16
|
+
return instrumentSqlStorage(original);
|
|
17
|
+
}
|
|
18
|
+
if (typeof original !== "function") {
|
|
19
|
+
return original;
|
|
20
|
+
}
|
|
21
|
+
const methodName = prop;
|
|
22
|
+
if (!STORAGE_METHODS_TO_INSTRUMENT.includes(methodName)) {
|
|
23
|
+
return original.bind(target);
|
|
24
|
+
}
|
|
25
|
+
return function(...args) {
|
|
26
|
+
const allowlist = getClient()?.getOptions()?.durableObjectStorageSpanAllowlist;
|
|
27
|
+
const keys = getStorageKeys(methodName, args);
|
|
28
|
+
if (keys && keys.length > 0 && keys.every((key) => targetsCloudflareInternalKey(key, allowlist))) {
|
|
29
|
+
return original.apply(target, args);
|
|
30
|
+
}
|
|
31
|
+
return startSpan(
|
|
32
|
+
{
|
|
33
|
+
// Use underscore naming to match Cloudflare's native instrumentation (e.g., "durable_object_storage_get")
|
|
34
|
+
name: `durable_object_storage_${methodName}`,
|
|
35
|
+
op: "db",
|
|
36
|
+
attributes: {
|
|
37
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.db.cloudflare.durable_object",
|
|
38
|
+
"db.system.name": "cloudflare.durable_object.storage",
|
|
39
|
+
"db.operation.name": methodName
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
() => {
|
|
43
|
+
const teardown = async () => {
|
|
44
|
+
if (methodName === "setAlarm") {
|
|
45
|
+
storeSpanContext(target, "alarm");
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const result = original.apply(target, args);
|
|
49
|
+
if (!isThenable(result)) {
|
|
50
|
+
waitUntil?.(teardown());
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
return result.then(
|
|
54
|
+
(res) => {
|
|
55
|
+
waitUntil?.(teardown());
|
|
56
|
+
return res;
|
|
57
|
+
},
|
|
58
|
+
(e) => {
|
|
59
|
+
throw e;
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { instrumentDurableObjectStorage };
|
|
70
|
+
//# sourceMappingURL=instrumentDurableObjectStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentDurableObjectStorage.js","sources":["../../../../src/instrumentations/instrumentDurableObjectStorage.ts"],"sourcesContent":["import type { DurableObjectStorage, SyncKvStorage, SqlStorage } from '@cloudflare/workers-types';\nimport { getClient, isThenable, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core';\nimport type { CloudflareClientOptions } from '../client';\nimport { getStorageKeys, targetsCloudflareInternalKey } from '../utils/internalStorageKey';\nimport { storeSpanContext } from '../utils/traceLinks';\nimport { instrumentDurableObjectSyncKvStorage } from './instrumentDurableObjectSyncKvStorage';\nimport { instrumentSqlStorage } from './instrumentSqlStorage';\n\nconst STORAGE_METHODS_TO_INSTRUMENT = ['get', 'put', 'delete', 'list', 'setAlarm', 'getAlarm', 'deleteAlarm'] as const;\n\ntype StorageMethod = (typeof STORAGE_METHODS_TO_INSTRUMENT)[number];\n\ntype WaitUntil = (promise: Promise<unknown>) => void;\n\n/**\n * Instruments DurableObjectStorage methods with Sentry spans.\n *\n * Wraps the following async methods:\n * - get, put, delete, list (KV API)\n * - setAlarm, getAlarm, deleteAlarm (Alarm API)\n *\n * When setAlarm is called, it also stores the current span context so that when\n * the alarm fires later, it can link back to the trace that called setAlarm.\n *\n * @param storage - The DurableObjectStorage instance to instrument\n * @param waitUntil - Optional waitUntil function to defer span context storage\n * @returns An instrumented DurableObjectStorage instance\n */\nexport function instrumentDurableObjectStorage(\n storage: DurableObjectStorage,\n waitUntil?: WaitUntil,\n): DurableObjectStorage {\n return new Proxy(storage, {\n get(target, prop, _receiver) {\n // Use `target` as the receiver instead of the proxy (`_receiver`).\n // Native workerd getters (e.g., `storage.sql`) validate `this` via\n // internal slots. Passing the proxy as receiver breaks that check,\n // causing \"Illegal invocation: function called with incorrect `this`\n // reference\" errors.\n const original = Reflect.get(target, prop, target);\n\n if (prop === 'kv' && original != null && 'get' in original && 'put' in original) {\n return instrumentDurableObjectSyncKvStorage(original as SyncKvStorage);\n }\n\n if (prop === 'sql' && original != null && 'databaseSize' in original && 'exec' in original) {\n return instrumentSqlStorage(original as SqlStorage);\n }\n\n if (typeof original !== 'function') {\n return original;\n }\n\n const methodName = prop as string;\n if (!STORAGE_METHODS_TO_INSTRUMENT.includes(methodName as StorageMethod)) {\n return (original as (...args: unknown[]) => unknown).bind(target);\n }\n\n return function (this: unknown, ...args: unknown[]) {\n // KV entries managed by the DO framework itself (agents/partyserver state) are bookkeeping\n // rather than user work — skip the span, mirroring how `cf_` SQL tables are treated.\n // oxlint-disable-next-line typescript/no-unnecessary-type-assertion -- rule false positive: the cast reaches the Cloudflare-only `durableObjectStorageSpanAllowlist`; tsc errors without it\n const allowlist = (getClient()?.getOptions() as CloudflareClientOptions | undefined)\n ?.durableObjectStorageSpanAllowlist;\n const keys = getStorageKeys(methodName, args);\n if (keys && keys.length > 0 && keys.every(key => targetsCloudflareInternalKey(key, allowlist))) {\n return (original as (...a: unknown[]) => unknown).apply(target, args);\n }\n\n return startSpan(\n {\n // Use underscore naming to match Cloudflare's native instrumentation (e.g., \"durable_object_storage_get\")\n name: `durable_object_storage_${methodName}`,\n op: 'db',\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object',\n 'db.system.name': 'cloudflare.durable_object.storage',\n 'db.operation.name': methodName,\n },\n },\n () => {\n const teardown = async (): Promise<void> => {\n // When setAlarm is called, store the current span context so that when the alarm\n // fires later, it can link back to the trace that called setAlarm.\n // We use the original (uninstrumented) storage (target) to avoid creating a span\n // for this internal operation. The storage is deferred via waitUntil to not block.\n if (methodName === 'setAlarm') {\n storeSpanContext(target, 'alarm');\n }\n };\n\n const result = (original as (...args: unknown[]) => unknown).apply(target, args);\n\n if (!isThenable(result)) {\n waitUntil?.(teardown());\n\n return result;\n }\n\n return result.then(\n res => {\n waitUntil?.(teardown());\n return res;\n },\n e => {\n throw e;\n },\n );\n },\n );\n };\n },\n });\n}\n"],"names":[],"mappings":";;;;;;AAQA,MAAM,6BAAA,GAAgC,CAAC,KAAA,EAAO,KAAA,EAAO,UAAU,MAAA,EAAQ,UAAA,EAAY,YAAY,aAAa,CAAA;AAoBrG,SAAS,8BAAA,CACd,SACA,SAAA,EACsB;AACtB,EAAA,OAAO,IAAI,MAAM,OAAA,EAAS;AAAA,IACxB,GAAA,CAAI,MAAA,EAAQ,IAAA,EAAM,SAAA,EAAW;AAM3B,MAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,GAAA,CAAI,MAAA,EAAQ,MAAM,MAAM,CAAA;AAEjD,MAAA,I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MAAM;AACJ,YAAA,MAAM,WAAW,YAA2B;AAK1C,cAAA,IAAI,eAAe,UAAA,EAAY;AAC7B,gBAAA,gBAAA,CAAiB,QAAQ,OAAO,CAAA;AAAA,cAClC;AAAA,YACF,CAAA;AAEA,YAAA,MAAM,MAAA,GAAU,QAAA,CAA6C,KAAA,CAAM,MAAA,EAAQ,IAAI,CAAA;AAE/E,YAAA,IAAI,CAAC,UAAA,CAAW,MAAM,CAAA,EAAG;AACvB,cAAA,SAAA,GAAY,UAAU,CAAA;AAEtB,cAAA,OAAO,MAAA;AAAA,YACT;AAEA,YAAA,OAAO,MAAA,CAAO,IAAA;AAAA,cACZ,CAAA,GAAA,KAAO;AACL,gBAAA,SAAA,GAAY,UAAU,CAAA;AACtB,gBAAA,OAAO,GAAA;AAAA,cACT,CAAA;AAAA,cACA,CAAA,CAAA,KAAK;AACH,gBAAA,MAAM,CAAA;AAAA,cACR;AAAA,aACF;AAAA,UACF;AAAA,SACF;AAAA,MACF,CAAA;AAAA,IACF;AAAA,GACD,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { startSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
2
|
+
|
|
3
|
+
const SYNC_KV_METHODS_TO_INSTRUMENT = ["get", "put", "delete", "list"];
|
|
4
|
+
function instrumentDurableObjectSyncKvStorage(syncKv) {
|
|
5
|
+
return new Proxy(syncKv, {
|
|
6
|
+
get(target, prop, _receiver) {
|
|
7
|
+
const original = Reflect.get(target, prop, target);
|
|
8
|
+
if (typeof original !== "function") {
|
|
9
|
+
return original;
|
|
10
|
+
}
|
|
11
|
+
const methodName = prop;
|
|
12
|
+
if (!SYNC_KV_METHODS_TO_INSTRUMENT.includes(methodName)) {
|
|
13
|
+
return original.bind(target);
|
|
14
|
+
}
|
|
15
|
+
return function(...args) {
|
|
16
|
+
return startSpan(
|
|
17
|
+
{
|
|
18
|
+
name: `durable_object_storage_kv_${methodName}`,
|
|
19
|
+
op: "db",
|
|
20
|
+
attributes: {
|
|
21
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.db.cloudflare.durable_object",
|
|
22
|
+
// keeping the value as close as possible to the Cloudflare Worker KV instrumentation
|
|
23
|
+
// https://github.com/cloudflare/workerd/blob/6b8b11787e2b2a800ab0edd0690bfab3857b0529/src/workerd/api/sync-kv.c%2B%2B#L19
|
|
24
|
+
"db.system.name": "cloudflare-durable-object-sql",
|
|
25
|
+
"db.operation.name": methodName
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
() => {
|
|
29
|
+
return original.apply(target, args);
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { instrumentDurableObjectSyncKvStorage };
|
|
38
|
+
//# sourceMappingURL=instrumentDurableObjectSyncKvStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentDurableObjectSyncKvStorage.js","sources":["../../../../src/instrumentations/instrumentDurableObjectSyncKvStorage.ts"],"sourcesContent":["import type { SyncKvStorage } from '@cloudflare/workers-types';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core';\n\nconst SYNC_KV_METHODS_TO_INSTRUMENT = ['get', 'put', 'delete', 'list'] as const;\n\ntype SyncKvMethod = (typeof SYNC_KV_METHODS_TO_INSTRUMENT)[number];\n\nexport function instrumentDurableObjectSyncKvStorage(syncKv: SyncKvStorage): SyncKvStorage {\n return new Proxy(syncKv, {\n get(target, prop, _receiver) {\n const original = Reflect.get(target, prop, target);\n\n if (typeof original !== 'function') {\n return original;\n }\n\n const methodName = prop as SyncKvMethod;\n\n if (!SYNC_KV_METHODS_TO_INSTRUMENT.includes(methodName)) {\n return (original as (...args: unknown[]) => unknown).bind(target);\n }\n\n return function (this: unknown, ...args: unknown[]) {\n return startSpan(\n {\n name: `durable_object_storage_kv_${methodName}`,\n op: 'db',\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object',\n // keeping the value as close as possible to the Cloudflare Worker KV instrumentation\n // https://github.com/cloudflare/workerd/blob/6b8b11787e2b2a800ab0edd0690bfab3857b0529/src/workerd/api/sync-kv.c%2B%2B#L19\n 'db.system.name': 'cloudflare-durable-object-sql',\n 'db.operation.name': methodName,\n },\n },\n () => {\n return (original as (...args: unknown[]) => unknown).apply(target, args);\n },\n );\n };\n },\n });\n}\n"],"names":[],"mappings":";;AAGA,MAAM,6BAAA,GAAgC,CAAC,KAAA,EAAO,KAAA,EAAO,UAAU,MAAM,CAAA;AAI9D,SAAS,qCAAqC,MAAA,EAAsC;AACzF,EAAA,OAAO,IAAI,MAAM,MAAA,EAAQ;AAAA,IACvB,GAAA,CAAI,MAAA,EAAQ,IAAA,EAAM,SAAA,EAAW;AAC3B,MAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,GAAA,CAAI,MAAA,EAAQ,MAAM,MAAM,CAAA;AAEjD,MAAA,IAAI,OAAO,aAAa,UAAA,EAAY;AAClC,QAAA,OAAO,QAAA;AAAA,MACT;AAEA,MAAA,MAAM,UAAA,GAAa,IAAA;AAEnB,MAAA,IAAI,CAAC,6BAAA,CAA8B,QAAA,CAAS,UAAU,CAAA,EAAG;AACvD,QAAA,OAAQ,QAAA,CAA6C,KAAK,MAAM,CAAA;AAAA,MAClE;AAEA,MAAA,OAAO,YAA4B,IAAA,EAAiB;AAClD,QAAA,OAAO,SAAA;AAAA,UACL;AAAA,YACE,IAAA,EAAM,6BAA6B,UAAU,CAAA,CAAA;AAAA,YAC7C,EAAA,EAAI,IAAA;AAAA,YACJ,UAAA,EAAY;AAAA,cACV,CAAC,gCAAgC,GAAG,mCAAA;AAAA;AAAA;AAAA,cAGpC,gBAAA,EAAkB,+BAAA;AAAA,cAClB,mBAAA,EAAqB;AAAA;AACvB,WACF;AAAA,UACA,MAAM;AACJ,YAAA,OAAQ,QAAA,CAA6C,KAAA,CAAM,MAAA,EAAQ,IAAI,CAAA;AAAA,UACzE;AAAA,SACF;AAAA,MACF,CAAA;AAAA,IACF;AAAA,GACD,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { _INTERNAL_sanitizeSqlQuery, _INTERNAL_getSqlQuerySummary, getClient, startSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
2
|
+
import { targetsCloudflareInternalTable } from '../utils/internalSqlQuery.js';
|
|
3
|
+
|
|
4
|
+
function instrumentSqlStorage(sql) {
|
|
5
|
+
return new Proxy(sql, {
|
|
6
|
+
get(target, prop, _receiver) {
|
|
7
|
+
const original = Reflect.get(target, prop, target);
|
|
8
|
+
if (prop !== "exec" || typeof original !== "function") {
|
|
9
|
+
return original;
|
|
10
|
+
}
|
|
11
|
+
return function(...args) {
|
|
12
|
+
const [query, ...bindings] = args;
|
|
13
|
+
const sanitizedQuery = _INTERNAL_sanitizeSqlQuery(query);
|
|
14
|
+
const querySummary = _INTERNAL_getSqlQuerySummary(sanitizedQuery);
|
|
15
|
+
const allowlist = getClient()?.getOptions()?.durableObjectSqlSpanAllowlist;
|
|
16
|
+
if (targetsCloudflareInternalTable(querySummary, allowlist, sanitizedQuery)) {
|
|
17
|
+
return original.apply(target, args);
|
|
18
|
+
}
|
|
19
|
+
return startSpan(
|
|
20
|
+
{
|
|
21
|
+
op: "db.query",
|
|
22
|
+
name: querySummary || sanitizedQuery,
|
|
23
|
+
attributes: {
|
|
24
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.db.cloudflare.durable_object.sql",
|
|
25
|
+
"db.system.name": "cloudflare-durable-object-sql",
|
|
26
|
+
"db.operation.name": "exec",
|
|
27
|
+
"db.query.text": sanitizedQuery,
|
|
28
|
+
"db.query.summary": querySummary,
|
|
29
|
+
"cloudflare.durable_object.query.bindings": bindings.length
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
() => original.apply(target, args)
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { instrumentSqlStorage };
|
|
40
|
+
//# sourceMappingURL=instrumentSqlStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentSqlStorage.js","sources":["../../../../src/instrumentations/instrumentSqlStorage.ts"],"sourcesContent":["import type { SqlStorage } from '@cloudflare/workers-types';\nimport {\n _INTERNAL_getSqlQuerySummary,\n _INTERNAL_sanitizeSqlQuery,\n getClient,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n startSpan,\n} from '@sentry/core';\nimport type { CloudflareClientOptions } from '../client';\nimport { targetsCloudflareInternalTable } from '../utils/internalSqlQuery';\n\n/**\n * Instruments the Durable Object SqlStorage `exec` method with Sentry spans.\n *\n * @param sql - The SqlStorage instance to instrument\n * @returns An instrumented SqlStorage instance\n */\nexport function instrumentSqlStorage(sql: SqlStorage): SqlStorage {\n return new Proxy(sql, {\n get(target, prop, _receiver) {\n const original = Reflect.get(target, prop, target);\n\n if (prop !== 'exec' || typeof original !== 'function') {\n return original;\n }\n\n return function (this: unknown, ...args: unknown[]) {\n const [query, ...bindings] = args as [string, ...unknown[]];\n\n const sanitizedQuery = _INTERNAL_sanitizeSqlQuery(query);\n const querySummary = _INTERNAL_getSqlQuerySummary(sanitizedQuery);\n\n // oxlint-disable-next-line typescript/no-unnecessary-type-assertion -- rule false positive: the cast reaches the Cloudflare-only `durableObjectSqlSpanAllowlist`; tsc errors without it\n const allowlist = (getClient()?.getOptions() as CloudflareClientOptions | undefined)\n ?.durableObjectSqlSpanAllowlist;\n\n if (targetsCloudflareInternalTable(querySummary, allowlist, sanitizedQuery)) {\n return (original as (...a: unknown[]) => ReturnType<SqlStorage['exec']>).apply(target, args);\n }\n\n return startSpan(\n {\n op: 'db.query',\n name: querySummary || sanitizedQuery,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql',\n 'db.system.name': 'cloudflare-durable-object-sql',\n 'db.operation.name': 'exec',\n 'db.query.text': sanitizedQuery,\n 'db.query.summary': querySummary,\n 'cloudflare.durable_object.query.bindings': bindings.length,\n },\n },\n () => (original as (...a: unknown[]) => ReturnType<SqlStorage['exec']>).apply(target, args),\n );\n };\n },\n });\n}\n"],"names":[],"mappings":";;;AAiBO,SAAS,qBAAqB,GAAA,EAA6B;AAChE,EAAA,OAAO,IAAI,MAAM,GAAA,EAAK;AAAA,IACpB,GAAA,CAAI,MAAA,EAAQ,IAAA,EAAM,SAAA,EAAW;AAC3B,MAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,GAAA,CAAI,MAAA,EAAQ,MAAM,MAAM,CAAA;AAEjD,MAAA,IAAI,IAAA,KAAS,MAAA,IAAU,OAAO,QAAA,KAAa,UAAA,EAAY;AACrD,QAAA,OAAO,QAAA;AAAA,MACT;AAEA,MAAA,OAAO,YAA4B,IAAA,EAAiB;AAClD,QAAA,MAAM,CAAC,KAAA,EAAO,GAAG,QAAQ,CAAA,GAAI,IAAA;AAE7B,QAAA,MAAM,cAAA,GAAiB,2BAA2B,KAAK,CAAA;AACvD,QAAA,MAAM,YAAA,GAAe,6BAA6B,cAAc,CAAA;AAGhE,QAAA,MAAM,SAAA,GAAa,SAAA,EAAU,EAAG,UAAA,EAAW,EACvC,6BAAA;AAEJ,QAAA,IAAI,8BAAA,CAA+B,YAAA,EAAc,SAAA,EAAW,cAAc,CAAA,EAAG;AAC3E,UAAA,OAAQ,QAAA,CAAiE,KAAA,CAAM,MAAA,EAAQ,IAAI,CAAA;AAAA,QAC7F;AAEA,QAAA,OAAO,SAAA;AAAA,UACL;AAAA,YACE,EAAA,EAAI,UAAA;AAAA,YACJ,MAAM,YAAA,IAAgB,cAAA;AAAA,YACtB,UAAA,EAAY;AAAA,cACV,CAAC,gCAAgC,GAAG,uCAAA;AAAA,cACpC,gBAAA,EAAkB,+BAAA;AAAA,cAClB,mBAAA,EAAqB,MAAA;AAAA,cACrB,eAAA,EAAiB,cAAA;AAAA,cACjB,kBAAA,EAAoB,YAAA;AAAA,cACpB,4CAA4C,QAAA,CAAS;AAAA;AACvD,WACF;AAAA,UACA,MAAO,QAAA,CAAiE,KAAA,CAAM,MAAA,EAAQ,IAAI;AAAA,SAC5F;AAAA,MACF,CAAA;AAAA,IACF;AAAA,GACD,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { setAsyncLocalStorageAsyncContextStrategy } from '@sentry/server-utils/no-diagnostic-channels';
|
|
2
|
+
import { getFinalOptions } from '../options.js';
|
|
3
|
+
import { instrumentContext } from '../utils/instrumentContext.js';
|
|
4
|
+
import { extractRpcMeta } from '../utils/rpcMeta.js';
|
|
5
|
+
import { wrapMethodWithSentry } from '../wrapMethodWithSentry.js';
|
|
6
|
+
import { instrumentEnv } from './worker/instrumentEnv.js';
|
|
7
|
+
import { instrumentWorkerEntrypointFetch } from './worker/instrumentFetch.js';
|
|
8
|
+
import { instrumentWorkerEntrypointQueue } from './worker/instrumentQueue.js';
|
|
9
|
+
import { instrumentWorkerEntrypointScheduled } from './worker/instrumentScheduled.js';
|
|
10
|
+
import { instrumentWorkerEntrypointTail } from './worker/instrumentTail.js';
|
|
11
|
+
|
|
12
|
+
const WORKER_ENTRYPOINT_ORIGIN = "auto.faas.cloudflare.worker_entrypoint";
|
|
13
|
+
const RESERVED_METHODS = /* @__PURE__ */ new Set([
|
|
14
|
+
"connect",
|
|
15
|
+
"constructor",
|
|
16
|
+
"dup",
|
|
17
|
+
"email",
|
|
18
|
+
"fetch",
|
|
19
|
+
"queue",
|
|
20
|
+
"scheduled",
|
|
21
|
+
"tail",
|
|
22
|
+
"tailStream",
|
|
23
|
+
"test",
|
|
24
|
+
"trace"
|
|
25
|
+
]);
|
|
26
|
+
function isPrototypeMethod(instance, prop, method) {
|
|
27
|
+
let prototype = Object.getPrototypeOf(instance);
|
|
28
|
+
while (prototype && prototype !== Object.prototype) {
|
|
29
|
+
const descriptor = Object.getOwnPropertyDescriptor(prototype, prop);
|
|
30
|
+
if (descriptor) {
|
|
31
|
+
return descriptor.value === method;
|
|
32
|
+
}
|
|
33
|
+
prototype = Object.getPrototypeOf(prototype);
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
function bindToInstance(instance, proxy, method) {
|
|
38
|
+
return new Proxy(method, {
|
|
39
|
+
apply(target, thisArg, args) {
|
|
40
|
+
return Reflect.apply(target, thisArg === proxy ? instance : thisArg, args);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function instrumentMethod(instance, proxy, prop, method, options, context) {
|
|
45
|
+
const ownDescriptor = Object.getOwnPropertyDescriptor(instance, prop);
|
|
46
|
+
if (ownDescriptor && "value" in ownDescriptor && !ownDescriptor.configurable && !ownDescriptor.writable) {
|
|
47
|
+
return method;
|
|
48
|
+
}
|
|
49
|
+
const boundMethod = bindToInstance(instance, proxy, method);
|
|
50
|
+
if (typeof prop !== "string" || RESERVED_METHODS.has(prop) || !isPrototypeMethod(instance, prop, method)) {
|
|
51
|
+
return boundMethod;
|
|
52
|
+
}
|
|
53
|
+
const captureMethod = wrapMethodWithSentry(
|
|
54
|
+
{ options, context, spanOp: "rpc", origin: WORKER_ENTRYPOINT_ORIGIN },
|
|
55
|
+
boundMethod,
|
|
56
|
+
void 0,
|
|
57
|
+
true
|
|
58
|
+
);
|
|
59
|
+
if (options.enableRpcTracePropagation === false) {
|
|
60
|
+
return captureMethod;
|
|
61
|
+
}
|
|
62
|
+
const tracedMethod = wrapMethodWithSentry(
|
|
63
|
+
{ options, context, spanName: prop, spanOp: "rpc", origin: WORKER_ENTRYPOINT_ORIGIN },
|
|
64
|
+
boundMethod,
|
|
65
|
+
void 0,
|
|
66
|
+
true
|
|
67
|
+
);
|
|
68
|
+
return (...args) => {
|
|
69
|
+
const { rpcMeta } = extractRpcMeta(args);
|
|
70
|
+
return rpcMeta ? tracedMethod.call(proxy, ...args) : captureMethod.call(proxy, ...args);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function instrumentWorkerEntrypoint(optionsCallback, WorkerEntrypointClass) {
|
|
74
|
+
setAsyncLocalStorageAsyncContextStrategy();
|
|
75
|
+
return new Proxy(WorkerEntrypointClass, {
|
|
76
|
+
construct(target, [ctx, env]) {
|
|
77
|
+
const context = instrumentContext(ctx);
|
|
78
|
+
const options = getFinalOptions(optionsCallback(env), env);
|
|
79
|
+
const instrumentedEnv = instrumentEnv(env, options);
|
|
80
|
+
const obj = new target(context, instrumentedEnv);
|
|
81
|
+
if ("ctx" in obj) {
|
|
82
|
+
Object.defineProperty(obj, "ctx", {
|
|
83
|
+
value: context,
|
|
84
|
+
writable: true,
|
|
85
|
+
enumerable: true,
|
|
86
|
+
configurable: true
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if ("env" in obj) {
|
|
90
|
+
Object.defineProperty(obj, "env", {
|
|
91
|
+
value: instrumentedEnv,
|
|
92
|
+
writable: true,
|
|
93
|
+
enumerable: true,
|
|
94
|
+
configurable: true
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
Object.defineProperty(obj, "__SENTRY_CONTEXT__", {
|
|
98
|
+
value: context,
|
|
99
|
+
enumerable: false,
|
|
100
|
+
writable: false,
|
|
101
|
+
configurable: false
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(obj, "__SENTRY_OPTIONS__", {
|
|
104
|
+
value: options,
|
|
105
|
+
enumerable: false,
|
|
106
|
+
writable: false,
|
|
107
|
+
configurable: false
|
|
108
|
+
});
|
|
109
|
+
const entrypoint = obj;
|
|
110
|
+
instrumentWorkerEntrypointFetch(entrypoint, options, context);
|
|
111
|
+
instrumentWorkerEntrypointScheduled(entrypoint, options, context);
|
|
112
|
+
instrumentWorkerEntrypointQueue(entrypoint, options, context);
|
|
113
|
+
instrumentWorkerEntrypointTail(entrypoint, options, context);
|
|
114
|
+
const methodCache = /* @__PURE__ */ new Map();
|
|
115
|
+
const proxy = new Proxy(obj, {
|
|
116
|
+
get(instance, prop) {
|
|
117
|
+
const value = Reflect.get(instance, prop, instance);
|
|
118
|
+
if (typeof value !== "function") {
|
|
119
|
+
return value;
|
|
120
|
+
}
|
|
121
|
+
const method = value;
|
|
122
|
+
const cached = methodCache.get(prop);
|
|
123
|
+
if (cached?.source === method) {
|
|
124
|
+
return cached.wrapped;
|
|
125
|
+
}
|
|
126
|
+
const wrapped = instrumentMethod(instance, proxy, prop, method, options, context);
|
|
127
|
+
methodCache.set(prop, { source: method, wrapped });
|
|
128
|
+
return wrapped;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
return proxy;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export { instrumentWorkerEntrypoint };
|
|
137
|
+
//# sourceMappingURL=instrumentWorkerEntrypoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentWorkerEntrypoint.js","sources":["../../../../src/instrumentations/instrumentWorkerEntrypoint.ts"],"sourcesContent":["import type { RpcStub, WorkerEntrypoint } from 'cloudflare:workers';\nimport { setAsyncLocalStorageAsyncContextStrategy } from '@sentry/server-utils/no-diagnostic-channels';\nimport type { CloudflareOptions } from '../client';\nimport { getFinalOptions } from '../options';\nimport type { DefaultEnv, ResolveEnv } from '../types';\nimport { instrumentContext } from '../utils/instrumentContext';\nimport { extractRpcMeta } from '../utils/rpcMeta';\nimport { type UncheckedMethod, wrapMethodWithSentry } from '../wrapMethodWithSentry';\nimport { instrumentEnv } from './worker/instrumentEnv';\nimport { instrumentWorkerEntrypointFetch } from './worker/instrumentFetch';\nimport { instrumentWorkerEntrypointQueue } from './worker/instrumentQueue';\nimport { instrumentWorkerEntrypointScheduled } from './worker/instrumentScheduled';\nimport { instrumentWorkerEntrypointTail } from './worker/instrumentTail';\n\nconst WORKER_ENTRYPOINT_ORIGIN = 'auto.faas.cloudflare.worker_entrypoint';\n\ntype ReservedMethod =\n | Exclude<Extract<keyof WorkerEntrypoint, string>, '__WORKER_ENTRYPOINT_BRAND'>\n | Extract<keyof ExportedHandler, string>\n | Exclude<Extract<keyof RpcStub<(...args: unknown[]) => unknown>, string>, '__RPC_STUB_BRAND'>\n | 'constructor';\n\nconst RESERVED_METHODS = new Set<string>([\n 'connect',\n 'constructor',\n 'dup',\n 'email',\n 'fetch',\n 'queue',\n 'scheduled',\n 'tail',\n 'tailStream',\n 'test',\n 'trace',\n] satisfies ReservedMethod[]);\n\ninterface CachedMethod {\n source: UncheckedMethod;\n wrapped: UncheckedMethod;\n}\n\nexport type WorkerEntrypointConstructor<Env = unknown, Props = {}> = new (\n ctx: ExecutionContext,\n // WorkerEntrypoint subclasses can define different `env` shapes, so this constructor must accept all of them.\n // oxlint-disable-next-line typescript/no-explicit-any\n env: any,\n) => InstanceType<typeof WorkerEntrypoint<Env, Props>>;\n\nfunction isPrototypeMethod(instance: object, prop: string, method: UncheckedMethod): boolean {\n let prototype = Object.getPrototypeOf(instance);\n\n while (prototype && prototype !== Object.prototype) {\n const descriptor = Object.getOwnPropertyDescriptor(prototype, prop);\n if (descriptor) {\n return descriptor.value === method;\n }\n prototype = Object.getPrototypeOf(prototype);\n }\n\n return false;\n}\n\nfunction bindToInstance(instance: object, proxy: object, method: UncheckedMethod): UncheckedMethod {\n return new Proxy(method, {\n apply(target, thisArg, args) {\n return Reflect.apply(target, thisArg === proxy ? instance : thisArg, args);\n },\n });\n}\n\nfunction instrumentMethod(\n instance: object,\n proxy: object,\n prop: PropertyKey,\n method: UncheckedMethod,\n options: CloudflareOptions,\n context: ExecutionContext,\n): UncheckedMethod {\n const ownDescriptor = Object.getOwnPropertyDescriptor(instance, prop);\n if (ownDescriptor && 'value' in ownDescriptor && !ownDescriptor.configurable && !ownDescriptor.writable) {\n return method;\n }\n\n const boundMethod = bindToInstance(instance, proxy, method);\n\n if (typeof prop !== 'string' || RESERVED_METHODS.has(prop) || !isPrototypeMethod(instance, prop, method)) {\n return boundMethod;\n }\n\n const captureMethod = wrapMethodWithSentry(\n { options, context, spanOp: 'rpc', origin: WORKER_ENTRYPOINT_ORIGIN },\n boundMethod,\n undefined,\n true,\n );\n\n if (options.enableRpcTracePropagation === false) {\n return captureMethod;\n }\n\n const tracedMethod = wrapMethodWithSentry(\n { options, context, spanName: prop, spanOp: 'rpc', origin: WORKER_ENTRYPOINT_ORIGIN },\n boundMethod,\n undefined,\n true,\n );\n\n return (...args: unknown[]) => {\n const { rpcMeta } = extractRpcMeta(args);\n return rpcMeta ? tracedMethod.call(proxy, ...args) : captureMethod.call(proxy, ...args);\n };\n}\n\n/**\n * Instruments a WorkerEntrypoint class to capture errors and performance data.\n *\n * Instruments the following methods (same as `withSentry` for ExportedHandler):\n * - fetch (HTTP requests)\n * - scheduled (cron triggers)\n * - queue (queue consumers)\n * - email (email handlers)\n * - tail (tail workers)\n *\n * as well as any other public RPC methods on the WorkerEntrypoint instance.\n *\n * @param optionsCallback Function that returns the options for the SDK initialization.\n * @param WorkerEntrypointClass The WorkerEntrypoint class to instrument.\n * @returns The instrumented WorkerEntrypoint class.\n *\n * @example\n * ```ts\n * class MyWorkerBase extends WorkerEntrypoint<Env> {\n * async fetch(request: Request): Promise<Response> {\n * return new Response('Hello World!');\n * }\n *\n * async myRpcMethod(arg: string): Promise<string> {\n * return `Hello ${arg}!`;\n * }\n * }\n *\n * export default instrumentWorkerEntrypoint(\n * env => ({\n * dsn: env.SENTRY_DSN,\n * tracesSampleRate: 1.0,\n * }),\n * MyWorkerBase,\n * );\n * ```\n */\nexport function instrumentWorkerEntrypoint<\n Env = DefaultEnv,\n Props = {},\n // oxlint-disable-next-line typescript/no-explicit-any\n T extends WorkerEntrypoint<any, any> = WorkerEntrypoint<Env, Props>,\n // oxlint-disable-next-line typescript/no-explicit-any\n C extends new (ctx: ExecutionContext, env: any) => T = new (ctx: ExecutionContext, env: any) => T,\n>(optionsCallback: (env: ResolveEnv<C, Env>) => CloudflareOptions | undefined, WorkerEntrypointClass: C): C {\n // Set up AsyncLocalStorage strategy ONCE at instrumentation time, not per-request\n // This is critical - calling this per-request would create a new AsyncLocalStorage\n // each time, breaking scope isolation for concurrent requests\n setAsyncLocalStorageAsyncContextStrategy();\n\n return new Proxy(WorkerEntrypointClass, {\n construct(target, [ctx, env]) {\n const context = instrumentContext(ctx);\n const options = getFinalOptions(optionsCallback(env), env);\n const instrumentedEnv = instrumentEnv(env, options);\n const obj = new target(context, instrumentedEnv);\n\n // Override this.ctx to ensure the instrumented context is used\n // This is necessary because the base WorkerEntrypoint class sets this.ctx\n // from the constructor parameter, but we want users accessing this.ctx\n // to get the instrumented version\n if ('ctx' in obj) {\n Object.defineProperty(obj, 'ctx', {\n value: context,\n writable: true,\n enumerable: true,\n configurable: true,\n });\n }\n\n if ('env' in obj) {\n Object.defineProperty(obj, 'env', {\n value: instrumentedEnv,\n writable: true,\n enumerable: true,\n configurable: true,\n });\n }\n\n Object.defineProperty(obj, '__SENTRY_CONTEXT__', {\n value: context,\n enumerable: false,\n writable: false,\n configurable: false,\n });\n\n Object.defineProperty(obj, '__SENTRY_OPTIONS__', {\n value: options,\n enumerable: false,\n writable: false,\n configurable: false,\n });\n\n const entrypoint = obj as WorkerEntrypoint;\n instrumentWorkerEntrypointFetch(entrypoint, options, context);\n instrumentWorkerEntrypointScheduled(entrypoint, options, context);\n instrumentWorkerEntrypointQueue(entrypoint, options, context);\n instrumentWorkerEntrypointTail(entrypoint, options, context);\n\n // workerd resolves RPC methods through property access.\n const methodCache = new Map<PropertyKey, CachedMethod>();\n\n const proxy: typeof obj = new Proxy(obj, {\n get(instance, prop) {\n const value = Reflect.get(instance, prop, instance);\n\n if (typeof value !== 'function') {\n return value;\n }\n\n const method = value as UncheckedMethod;\n\n const cached = methodCache.get(prop);\n if (cached?.source === method) {\n return cached.wrapped;\n }\n\n const wrapped = instrumentMethod(instance, proxy, prop, method, options, context);\n methodCache.set(prop, { source: method, wrapped });\n return wrapped;\n },\n });\n\n return proxy;\n },\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAcA,MAAM,wBAAA,GAA2B,wCAAA;AAQjC,MAAM,gBAAA,uBAAuB,GAAA,CAAY;AAAA,EACvC,SAAA;AAAA,EACA,aAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAA4B,CAAA;AAc5B,SAAS,iBAAA,CAAkB,QAAA,EAAkB,IAAA,EAAc,MAAA,EAAkC;AAC3F,EAAA,IAAI,SAAA,GAAY,MAAA,CAAO,cAAA,CAAe,QAAQ,CAAA;AAE9C,EAAA,OAAO,SAAA,IAAa,SAAA,KAAc,MAAA,CAAO,SAAA,EAAW;AAClD,IAAA,MAAM,UAAA,GAAa,MAAA,CAAO,wBAAA,CAAyB,SAAA,EAAW,IAAI,CAAA;AAClE,IAAA,IAAI,UAAA,EAAY;AACd,MAAA,OAAO,WAAW,KAAA,KAAU,MAAA;AAAA,IAC9B;AACA,IAAA,SAAA,GAAY,MAAA,CAAO,eAAe,SAAS,CAAA;AAAA,EAC7C;AAEA,EAAA,OAAO,KAAA;AACT;AAEA,SAAS,cAAA,CAAe,QAAA,EAAkB,KAAA,EAAe,MAAA,EAA0C;AACjG,EAAA,OAAO,IAAI,MAAM,MAAA,EAAQ;AAAA,IACvB,KAAA,CAAM,MAAA,EAAQ,OAAA,EAAS,IAAA,EAAM;AAC3B,MAAA,OAAO,QAAQ,KAAA,CAAM,MAAA,EAAQ,YAAY,KAAA,GAAQ,QAAA,GAAW,SAAS,IAAI,CAAA;AAAA,IAC3E;AAAA,GACD,CAAA;AACH;AAEA,SAAS,iBACP,QAAA,EACA,KAAA,EACA,IAAA,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