MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / init

Function init

packages/cloudflare/src/sdk.ts:53–81  ·  view source on GitHub ↗
(options: CloudflareOptions)

Source from the content-addressed store, hash-verified

51 * Initializes the cloudflare SDK.
52 */
53export function init(options: CloudflareOptions): CloudflareClient | undefined {
54 if (options.defaultIntegrations === undefined) {
55 options.defaultIntegrations = getDefaultIntegrations(options);
56 }
57
58 const flushLock = options.ctx ? makeFlushLock(options.ctx) : undefined;
59 delete options.ctx;
60
61 const clientOptions: CloudflareClientOptions = {
62 ...options,
63 stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),
64 integrations: getIntegrationsToSetup(options),
65 transport: options.transport || makeCloudflareTransport,
66 flushLock,
67 };
68
69 /**
70 * The Cloudflare SDK is not OpenTelemetry native, however, we set up some OpenTelemetry compatibility
71 * via a custom trace provider.
72 * This ensures that any spans emitted via `@opentelemetry/api` will be captured by Sentry.
73 * HOWEVER, big caveat: This does not handle custom context handling, it will always work off the current scope.
74 * This should be good enough for many, but not all integrations.
75 */
76 if (!options.skipOpenTelemetrySetup) {
77 setupOpenTelemetryTracer();
78 }
79
80 return initAndBind(CloudflareClient, clientOptions) as CloudflareClient;
81}

Callers 9

sdk.test.tsFile · 0.90
wrapRequestHandlerFunction · 0.90
getFunction · 0.90
wrappedFunctionFunction · 0.90
wrapScheduledHandlerFunction · 0.90
wrapEmailHandlerFunction · 0.90
wrapQueueHandlerFunction · 0.90
wrapTailHandlerFunction · 0.90

Calls 6

makeFlushLockFunction · 0.90
getIntegrationsToSetupFunction · 0.90
setupOpenTelemetryTracerFunction · 0.90
initAndBindFunction · 0.90
getDefaultIntegrationsFunction · 0.70

Tested by

no test coverage detected