autotel-cloudflare
Version:
The #1 OpenTelemetry package for Cloudflare Workers - complete bindings coverage, native CF OTel integration, advanced sampling
19 lines • 938 B
TypeScript
import { NativeTracer } from "autotel-edge";
//#region src/native/native-tracing.d.ts
/**
* Returns `true` when Cloudflare native custom-span tracing is available on the
* given ExecutionContext (i.e. tracing is enabled for this Worker).
*/
declare function isNativeTracingAvailable(ctx: unknown): boolean;
/**
* Wrap Cloudflare's `ctx.tracing` as an autotel {@link NativeTracer}, or return
* `null` when native tracing is unavailable on this context.
*
* @param correlationId Optional per-request id (e.g. the `cf-ray` header)
* surfaced as `ctx.correlationId` and a `correlation.id` span attribute, so
* logs, custom spans, and the Cloudflare dashboard share one queryable key
* today — before Cloudflare exposes in-code trace/span ids.
*/
declare function getNativeTracerFromCtx(ctx: unknown, correlationId?: string): NativeTracer | null;
//#endregion
export { isNativeTracingAvailable as n, getNativeTracerFromCtx as t };