UNPKG

autotel-cloudflare

Version:

The #1 OpenTelemetry package for Cloudflare Workers - complete bindings coverage, native CF OTel integration, advanced sampling

133 lines 4.49 kB
import { t as UnknownRecord } from "./values-CRvW9g6_.js"; //#region src/bindings/bindings.d.ts /** * Instrument KV namespace */ declare function instrumentKV<K extends KVNamespace>(kv: K, namespaceName?: string): K; /** * Instrument R2 bucket */ declare function instrumentR2<R extends R2Bucket>(r2: R, bucketName?: string): R; /** * Instrument D1 database */ declare function instrumentD1<D extends D1Database>(d1: D, databaseName?: string): D; /** * Instrument service binding (Fetcher) * * Unlike other bindings, Fetcher objects are native Cloudflare C++ bindings * whose methods throw "Illegal invocation" when called through a Proxy with * a different `this` reference. We work around this by calling `target.fetch()` * directly on the original binding instead of using `fn.apply` on a * detached function reference. */ declare function instrumentServiceBinding<F extends Fetcher>(fetcher: F, serviceName?: string): F; /** A Worker's environment: bindings by the names wrangler.toml gave them. */ type WorkerEnv = UnknownRecord; declare function instrumentBindings(env: WorkerEnv): WorkerEnv; //#endregion //#region src/bindings/ai.d.ts /** * Workers AI binding instrumentation */ /** * Instrument Workers AI binding */ declare function instrumentAI<T extends Ai>(ai: T, bindingName?: string): T; //#endregion //#region src/bindings/vectorize.d.ts /** * Vectorize binding instrumentation */ /** * Instrument Vectorize index binding */ declare function instrumentVectorize<T extends VectorizeIndex>(vectorize: T, indexName?: string): T; //#endregion //#region src/bindings/hyperdrive.d.ts /** * Hyperdrive binding instrumentation */ /** * Instrument Hyperdrive binding */ declare function instrumentHyperdrive<T extends Hyperdrive>(hyperdrive: T, bindingName?: string): T; //#endregion //#region src/bindings/queue-producer.d.ts /** * Queue producer binding instrumentation */ /** * Instrument Queue producer binding */ declare function instrumentQueueProducer<T extends Queue>(queue: T, queueName?: string): T; //#endregion //#region src/bindings/analytics-engine.d.ts /** * Analytics Engine binding instrumentation */ /** * Instrument Analytics Engine binding */ declare function instrumentAnalyticsEngine<T extends AnalyticsEngineDataset>(ae: T, datasetName?: string): T; //#endregion //#region src/bindings/images.d.ts /** * Images binding instrumentation * * The Images binding uses a fluent chain: input() -> transform() -> draw() -> output() * We only create a span at the terminal output() call to avoid intermediate noise. * info() is a standalone operation and gets its own span. */ interface ImagesLike { info(blob: ReadableStream | ArrayBuffer | Blob): Promise<{ width: number; height: number; format: string; }>; input(blob: ReadableStream | ArrayBuffer | Blob): ImageTransformerLike; } interface ImageTransformerLike { transform(options: unknown): ImageTransformerLike; draw(image: unknown, options?: unknown): ImageTransformerLike; output(options?: unknown): Promise<ImageOutputLike>; } interface ImageOutputLike { response(): Response; blob(): Promise<Blob>; arrayBuffer(): Promise<ArrayBuffer>; } /** * Instrument Images binding */ declare function instrumentImages<T extends ImagesLike>(images: T, bindingName?: string): T; //#endregion //#region src/bindings/rate-limiter.d.ts /** * Rate Limiter binding instrumentation */ interface RateLimiterLike { limit(options: { key: string; }): Promise<{ success: boolean; }>; } /** * Instrument Rate Limiter binding (manual only — not auto-detected) */ declare function instrumentRateLimiter<T extends RateLimiterLike>(limiter: T, bindingName?: string): T; //#endregion //#region src/bindings/browser-rendering.d.ts /** * Browser Rendering binding instrumentation */ interface BrowserRenderingLike { fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>; } /** * Instrument Browser Rendering binding (manual only — not auto-detected) */ declare function instrumentBrowserRendering<T extends BrowserRenderingLike>(browser: T, bindingName?: string): T; //#endregion export { instrumentQueueProducer as a, instrumentAI as c, instrumentKV as d, instrumentR2 as f, instrumentAnalyticsEngine as i, instrumentBindings as l, instrumentRateLimiter as n, instrumentHyperdrive as o, instrumentServiceBinding as p, instrumentImages as r, instrumentVectorize as s, instrumentBrowserRendering as t, instrumentD1 as u };