import type { ClientOptions, Options } from '@sentry/core'; import { ServerRuntimeClient } from '@sentry/core'; import type { makeFlushLock } from './flush'; import type { CloudflareTransportOptions } from './transport'; /** * The Sentry Cloudflare SDK Client. * * @see CloudflareClientOptions for documentation on configuration options. * @see ServerRuntimeClient for usage documentation. */ export declare class CloudflareClient extends ServerRuntimeClient { private readonly _flushLock; private _pendingSpans; private _spanCompletionPromise; private _resolveSpanCompletion; private _unsubscribeSpanStart; private _unsubscribeSpanEnd; /** * Creates a new Cloudflare SDK instance. * @param options Configuration options for this SDK. */ constructor(options: CloudflareClientOptions); /** * Flushes pending operations and ensures all data is processed. * If a timeout is provided, the operation will be completed within the specified time limit. * * It will wait for all pending spans to complete before flushing. * * @param {number} [timeout] - Optional timeout in milliseconds to force the completion of the flush operation. * @return {Promise} A promise that resolves to a boolean indicating whether the flush operation was successful. */ flush(timeout?: number): Promise; /** * Disposes of the client and releases all resources. * * This method clears all Cloudflare-specific state in addition to the base client cleanup. * It unsubscribes from span lifecycle events and clears pending span tracking. * * Call this method after flushing to allow the client to be garbage collected. * After calling dispose(), the client should not be used anymore. */ dispose(): void; /** * Resets the span completion promise and resolve function. */ private _resetSpanCompletionPromise; } interface BaseCloudflareOptions { /** * @ignore Used internally to disable the deDupeIntegration for workflows. * @hidden Used internally to disable the deDupeIntegration for workflows. * @default true */ enableDedupe?: boolean; /** * The Cloudflare SDK is not OpenTelemetry native, however, we set up some OpenTelemetry compatibility * via a custom trace provider. * This ensures that any spans emitted via `@opentelemetry/api` will be captured by Sentry. * HOWEVER, big caveat: This does not handle custom context handling, it will always work off the current scope. * This should be good enough for many, but not all integrations. * * If you want to opt-out of setting up the OpenTelemetry compatibility tracer, set this to `true`. * * @default false */ skipOpenTelemetrySetup?: boolean; /** * Enable instrumentation of prototype methods for DurableObjects. * * When `true`, the SDK will wrap all methods on the DurableObject prototype chain * to automatically create spans and capture errors for RPC method calls. * * When an array of strings is provided, only the specified method names will be instrumented. * * This feature adds runtime overhead as it wraps methods at the prototype level. * Only enable this if you need automatic instrumentation of prototype methods. * * @default false * @example * ```ts * // Instrument all prototype methods * instrumentPrototypeMethods: true * * // Instrument only specific methods * instrumentPrototypeMethods: ['myMethod', 'anotherMethod'] * ``` */ instrumentPrototypeMethods?: boolean | string[]; } /** * Configuration options for the Sentry Cloudflare SDK * * @see @sentry/core Options for more information. */ export interface CloudflareOptions extends Options, BaseCloudflareOptions { ctx?: ExecutionContext; } /** * Configuration options for the Sentry Cloudflare SDK Client class * * @see CloudflareClient for more information. */ export interface CloudflareClientOptions extends ClientOptions, BaseCloudflareOptions { flushLock?: ReturnType; } export {}; //# sourceMappingURL=client.d.ts.map