autotel-edge 3.16.15 → 3.17.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 +17 -0
- package/dist/{config-0FktBGyj.js → config-CEF9DMGT.js} +4 -3
- package/dist/config-CEF9DMGT.js.map +1 -0
- package/dist/events.d.ts +1 -1
- package/dist/events.js +1 -1
- package/dist/{execution-logger-BWlya70r.d.ts → execution-logger-Cmjy8i-d.d.ts} +14 -2
- package/dist/{execution-logger-BWlya70r.d.ts.map → execution-logger-Cmjy8i-d.d.ts.map} +1 -1
- package/dist/index.d.ts +80 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +254 -11
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +5 -0
- package/dist/logger.js.map +1 -1
- package/dist/sampling.d.ts +1 -1
- package/dist/{types-HCbsjZzp.d.ts → types-CCbv6225.d.ts} +21 -2
- package/dist/{types-HCbsjZzp.d.ts.map → types-CCbv6225.d.ts.map} +1 -1
- package/package.json +1 -1
- package/src/api/logger.test.ts +9 -0
- package/src/api/logger.ts +9 -0
- package/src/core/config.ts +1 -0
- package/src/core/context.ts +22 -1
- package/src/core/native-bridge.test.ts +176 -0
- package/src/core/native-bridge.ts +278 -0
- package/src/core/provider.context.test.ts +1 -1
- package/src/core/provider.ts +9 -25
- package/src/functional.ts +139 -1
- package/src/index.ts +14 -1
- package/src/native-routing.test.ts +98 -0
- package/src/types.ts +20 -0
- package/dist/config-0FktBGyj.js.map +0 -1
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ Use this package directly if you're:
|
|
|
32
32
|
- ✅ **Tree-shakeable** - Import only what you need
|
|
33
33
|
- ✅ **Bundle size optimized** - ~20KB minified (~8KB gzipped)
|
|
34
34
|
- ✅ **OpenTelemetry compliant** - Works with any OTLP backend
|
|
35
|
+
- ✅ **Native-tracing bridge** - `trace()`/`span()` can route to a platform-native tracer (e.g. Cloudflare's `tracing.enterSpan()`) instead of OTLP, automatically
|
|
35
36
|
- ✅ **TypeScript native** - Full type safety
|
|
36
37
|
|
|
37
38
|
## Installation
|
|
@@ -331,6 +332,22 @@ init({
|
|
|
331
332
|
})
|
|
332
333
|
```
|
|
333
334
|
|
|
335
|
+
## Native tracing bridge
|
|
336
|
+
|
|
337
|
+
`trace()` / `span()` / `enterSpan()` can transparently emit *platform-native*
|
|
338
|
+
spans instead of going through autotel's OTLP exporter. A runtime adapter (e.g.
|
|
339
|
+
[autotel-cloudflare](../autotel-cloudflare), wrapping Cloudflare's
|
|
340
|
+
`tracing.enterSpan()`) installs a `NativeTracer` into the active context with
|
|
341
|
+
`withNativeTracer()`; the functional API reads it via `getActiveNativeTracer()`
|
|
342
|
+
and routes to it when present. autotel-edge never imports any runtime module —
|
|
343
|
+
the seam (`NativeTracer` / `NativeSpanHandle`, degradation adapters) only depends
|
|
344
|
+
on `@opentelemetry/api` and is tree-shaken away when unused.
|
|
345
|
+
|
|
346
|
+
This is what lets the *same* instrumented code light up Cloudflare's native
|
|
347
|
+
trace waterfall in production and export over OTLP locally. Config:
|
|
348
|
+
`nativeTracing: 'auto' | 'on' | 'off'` (default `'auto'`). See
|
|
349
|
+
[docs/CLOUDFLARE-NATIVE-TRACING.md](../../docs/CLOUDFLARE-NATIVE-TRACING.md).
|
|
350
|
+
|
|
334
351
|
## Bundle Size
|
|
335
352
|
|
|
336
353
|
- **Core:** ~20KB minified (~8KB gzipped)
|
|
@@ -8,7 +8,7 @@ import { JsonTraceSerializer } from "@opentelemetry/otlp-transformer";
|
|
|
8
8
|
const defaultHeaders = {
|
|
9
9
|
accept: "application/json",
|
|
10
10
|
"content-type": "application/json",
|
|
11
|
-
"user-agent": `autotel-edge v3.
|
|
11
|
+
"user-agent": `autotel-edge v3.17.0`
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* Minimal OTLP exporter using fetch()
|
|
@@ -254,7 +254,8 @@ function parseConfig(config) {
|
|
|
254
254
|
disabled: config.instrumentation?.disabled ?? false
|
|
255
255
|
},
|
|
256
256
|
subscribers: config.subscribers ?? [],
|
|
257
|
-
dataSafety: config.dataSafety
|
|
257
|
+
dataSafety: config.dataSafety,
|
|
258
|
+
nativeTracing: config.nativeTracing ?? "auto"
|
|
258
259
|
};
|
|
259
260
|
}
|
|
260
261
|
/**
|
|
@@ -287,4 +288,4 @@ function createInitialiser(config) {
|
|
|
287
288
|
|
|
288
289
|
//#endregion
|
|
289
290
|
export { OTLPExporter as a, setConfig as i, getActiveConfig as n, parseConfig as r, createInitialiser as t };
|
|
290
|
-
//# sourceMappingURL=config-
|
|
291
|
+
//# sourceMappingURL=config-CEF9DMGT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-CEF9DMGT.js","names":["api_context"],"sources":["../src/core/exporter.ts","../src/types.ts","../src/core/spanprocessor.ts","../src/core/config.ts"],"sourcesContent":["/**\n * Lightweight OTLP exporter for edge environments\n * Ported and adapted from @microlabs/\n *\n * This exporter is much smaller than the standard @opentelemetry/exporter-trace-otlp-http\n * because it uses fetch() directly instead of Node.js http/https modules.\n */\n\nimport type { ExportResult } from '@opentelemetry/core';\nimport { ExportResultCode } from '@opentelemetry/core';\nimport { OTLPExporterError } from '@opentelemetry/otlp-exporter-base';\nimport { JsonTraceSerializer } from '@opentelemetry/otlp-transformer';\nimport type { SpanExporter } from '@opentelemetry/sdk-trace-base';\nimport type { OTLPExporterConfig } from '../types';\n\n// Version is injected at build time via tsup define\n// This avoids runtime filesystem access which isn't available in edge environments\nconst PACKAGE_VERSION = process.env.AUTOTEL_EDGE_VERSION || '0.1.1';\n\nconst defaultHeaders: Record<string, string> = {\n accept: 'application/json',\n 'content-type': 'application/json',\n 'user-agent': `autotel-edge v${PACKAGE_VERSION}`,\n};\n\n/**\n * Minimal OTLP exporter using fetch()\n */\nexport class OTLPExporter implements SpanExporter {\n private headers: Record<string, string>;\n private url: string;\n\n constructor(config: OTLPExporterConfig) {\n this.url = config.url;\n this.headers = Object.assign({}, defaultHeaders, config.headers);\n }\n\n export(items: any[], resultCallback: (result: ExportResult) => void): void {\n this._export(items)\n .then(() => {\n resultCallback({ code: ExportResultCode.SUCCESS });\n })\n .catch((error) => {\n resultCallback({ code: ExportResultCode.FAILED, error });\n });\n }\n\n private _export(items: any[]): Promise<unknown> {\n return new Promise<void>((resolve, reject) => {\n try {\n this.send(items, resolve, reject);\n } catch (error) {\n reject(error);\n }\n });\n }\n\n send(\n items: any[],\n onSuccess: () => void,\n onError: (error: OTLPExporterError) => void,\n ): void {\n const decoder = new TextDecoder();\n const exportMessage = JsonTraceSerializer.serializeRequest(items);\n\n const body = decoder.decode(exportMessage);\n const params: RequestInit = {\n method: 'POST',\n headers: this.headers,\n body,\n };\n\n fetch(this.url, params)\n .then((response) => {\n if (response.ok) {\n onSuccess();\n } else {\n onError(\n new OTLPExporterError(\n `Exporter received a statusCode: ${response.status}`,\n ),\n );\n }\n })\n .catch((error) => {\n onError(\n new OTLPExporterError(\n `Exception during export: ${error.toString()}`,\n error.code,\n error.stack,\n ),\n );\n });\n }\n\n async shutdown(): Promise<void> {\n // No-op for edge environments\n }\n}\n","/**\n * Shared types for autotel-edge\n */\n\nimport type {\n Attributes,\n Context,\n Span,\n SpanOptions,\n TextMapPropagator,\n} from '@opentelemetry/api';\nimport type {\n ReadableSpan,\n Sampler,\n SpanExporter,\n SpanProcessor,\n} from '@opentelemetry/sdk-trace-base';\n\n// Re-export commonly used types\n\n\n/**\n * Extended SpanOptions with per-span sampler support\n */\nexport interface ExtendedSpanOptions extends SpanOptions {\n sampler?: Sampler;\n}\n\n/**\n * Trigger types for edge handlers\n * Can be a Request or any vendor-specific trigger type\n */\nexport type Trigger =\n | Request\n | DOConstructorTrigger\n | WorkflowTrigger\n | 'do-alarm'\n | unknown;\n\nexport interface DOConstructorTrigger {\n id: string;\n name?: string;\n}\n\nexport interface WorkflowTrigger {\n type: 'workflow';\n name: string;\n}\n\n/**\n * Config types\n */\nexport interface OTLPExporterConfig {\n url: string;\n headers?: Record<string, string>;\n}\n\nexport type ExporterConfig = OTLPExporterConfig | SpanExporter;\n\nexport interface ServiceConfig {\n name: string;\n namespace?: string;\n version?: string;\n}\n\nexport interface ParentRatioSamplingConfig {\n acceptRemote?: boolean;\n ratio: number;\n}\n\ntype HeadSamplerConf = Sampler | ParentRatioSamplingConfig;\n\nexport interface SamplingConfig<HS extends HeadSamplerConf = HeadSamplerConf> {\n headSampler?: HS;\n tailSampler?: TailSampleFn;\n}\n\nexport interface InstrumentationOptions {\n instrumentGlobalFetch?: boolean;\n instrumentGlobalCache?: boolean;\n /**\n * Disable instrumentation entirely (useful for local development)\n * When enabled, the handler is returned as-is without any instrumentation\n * @default false\n */\n disabled?: boolean;\n}\n\n/**\n * Utility types\n */\nexport type OrPromise<T> = T | Promise<T>;\n\n/**\n * Adapter event types\n */\nexport type FunnelStepStatus =\n | 'started'\n | 'completed'\n | 'abandoned'\n | 'failed'\n | (string & {});\n\nexport type OutcomeStatus =\n | 'success'\n | 'failure'\n | 'partial'\n | (string & {});\n\nexport interface EdgeEventBase {\n [key: string]: unknown;\n service: string;\n timestamp: number;\n attributes: Record<string, unknown>;\n traceId?: string;\n spanId?: string;\n correlationId?: string;\n name: string; // Normalized event name for easy access\n}\n\nexport interface EdgeTrackEvent extends EdgeEventBase {\n type: 'event';\n event: string;\n}\n\nexport interface EdgeFunnelStepEvent extends EdgeEventBase {\n type: 'funnel-step';\n funnel: string;\n status: FunnelStepStatus;\n}\n\nexport interface EdgeOutcomeEvent extends EdgeEventBase {\n type: 'outcome';\n operation: string;\n outcome: OutcomeStatus;\n}\n\nexport interface EdgeValueEvent extends EdgeEventBase {\n type: 'value';\n metric: string;\n value: number;\n}\n\nexport type EdgeEvent =\n | EdgeTrackEvent\n | EdgeFunnelStepEvent\n | EdgeOutcomeEvent\n | EdgeValueEvent;\n\nexport type EdgeSubscriber = (event: EdgeEvent) => OrPromise<void>;\n\nexport interface FetcherConfig {\n includeTraceContext?: boolean | ((request: Request) => boolean);\n}\n\nexport interface RouteServiceConfig {\n service: string;\n}\n\nexport interface PostProcessParams {\n /**\n * The request object that was passed to the fetch handler.\n */\n request: Request;\n /**\n * The generated response object.\n */\n response: Response;\n /**\n * A readable version of the span object that can be used to access the span's attributes and events.\n */\n readable: ReadableSpan;\n}\n\nexport interface FetchHandlerConfig {\n /**\n * Whether to enable context propagation for incoming requests to `fetch`.\n * This enables or disables distributed tracing from W3C Trace Context headers.\n * @default true\n */\n acceptTraceContext?: boolean | ((request: Request) => boolean);\n /**\n * Allows further customization of the generated span, based on the request/response data.\n */\n postProcess?: (span: Span, ctx: PostProcessParams) => void;\n /**\n * Route patterns to include for fetch handler instrumentation.\n * Supports glob patterns like '/api/**'.\n * If not set, all routes are included.\n */\n include?: string[];\n /**\n * Route patterns to exclude from fetch handler instrumentation.\n * Supports glob patterns like '/health' and '/_internal/**'.\n * Exclusions take precedence over inclusions.\n */\n exclude?: string[];\n /**\n * Route-specific service mapping.\n * The first matching pattern wins based on object iteration order.\n */\n routes?: Record<string, RouteServiceConfig>;\n}\n\nexport interface HandlerConfig {\n fetch?: FetchHandlerConfig;\n}\n\nexport interface DataSafetyConfig {\n /** Redact query parameters from URL attributes (default: false) */\n redactQueryParams?: boolean;\n /** Control D1 SQL statement capture: 'full' (default), 'obfuscated', or 'off' */\n captureDbStatement?: 'off' | 'obfuscated' | 'full';\n /** Only capture these email headers (lowercase). When set, other headers are excluded. */\n emailHeaderAllowlist?: string[];\n}\n\n/**\n * Controls whether `span()` / `trace()` route to a platform-native tracer\n * (e.g. Cloudflare's `tracing.enterSpan()`) instead of autotel's own OTLP\n * pipeline.\n *\n * - `'auto'` (default): use the native tracer when one is detected at runtime,\n * otherwise fall back to autotel's OTLP exporter.\n * - `'on'`: always prefer the native tracer (the adapter warns once if none is\n * available and falls back).\n * - `'off'`: never use a native tracer — always use autotel's OTLP pipeline.\n * Useful for local `wrangler dev` streaming to autotel-devtools.\n */\nexport type NativeTracingMode = 'auto' | 'on' | 'off';\n\ninterface EdgeConfigBase {\n service: ServiceConfig;\n handlers?: HandlerConfig;\n fetch?: FetcherConfig;\n postProcessor?: PostProcessorFn;\n sampling?: SamplingConfig;\n propagator?: TextMapPropagator;\n instrumentation?: InstrumentationOptions;\n subscribers?: EdgeSubscriber[];\n /** Opt-in data safety controls for sensitive attribute capture */\n dataSafety?: DataSafetyConfig;\n /**\n * Native platform tracing mode. Defaults to `'auto'`.\n * @see NativeTracingMode\n */\n nativeTracing?: NativeTracingMode;\n}\n\ninterface EdgeConfigExporter extends EdgeConfigBase {\n exporter: ExporterConfig;\n}\n\ninterface EdgeConfigSpanProcessors extends EdgeConfigBase {\n spanProcessors: SpanProcessor | SpanProcessor[];\n}\n\nexport type EdgeConfig = EdgeConfigExporter | EdgeConfigSpanProcessors;\n\nexport function isSpanProcessorConfig(\n config: EdgeConfig,\n): config is EdgeConfigSpanProcessors {\n return !!(config as EdgeConfigSpanProcessors).spanProcessors;\n}\n\nexport interface ResolvedEdgeConfig extends EdgeConfigBase {\n handlers: Required<HandlerConfig>;\n fetch: Required<FetcherConfig>;\n postProcessor: PostProcessorFn;\n sampling: Required<SamplingConfig<Sampler>>;\n spanProcessors: SpanProcessor[];\n propagator: TextMapPropagator;\n instrumentation: InstrumentationOptions;\n subscribers: EdgeSubscriber[];\n nativeTracing: NativeTracingMode;\n}\n\n/**\n * Function types\n */\nexport type ResolveConfigFn<Env = any> = (\n env: Env,\n trigger: Trigger,\n) => EdgeConfig;\nexport type ConfigurationOption = EdgeConfig | ResolveConfigFn;\n\nexport type PostProcessorFn = (spans: ReadableSpan[]) => ReadableSpan[];\nexport type TailSampleFn = (traceInfo: LocalTrace) => boolean;\n\nexport interface LocalTrace {\n traceId: string;\n spans: ReadableSpan[];\n localRootSpan: ReadableSpan;\n}\n\n/**\n * Span processor with flush support\n */\nexport type TraceFlushableSpanProcessor = SpanProcessor & {\n forceFlush: (traceId?: string) => Promise<void>;\n};\n\n/**\n * Handler instrumentation\n */\nexport interface InitialSpanInfo {\n name: string;\n options: SpanOptions;\n context?: Context;\n}\n\nexport interface HandlerInstrumentation<T extends Trigger, R extends any> {\n getInitialSpanInfo: (trigger: T) => InitialSpanInfo;\n getAttributesFromResult?: (result: Awaited<R>) => Attributes;\n instrumentTrigger?: (trigger: T) => T;\n executionSucces?: (span: Span, trigger: T, result: Awaited<R>) => void;\n executionFailed?: (span: Span, trigger: T, error?: any) => void;\n}\n\n/**\n * Utility types\n */\n\nexport {type Attributes, type Context, type Span, type SpanOptions} from '@opentelemetry/api';\nexport {type ReadableSpan} from '@opentelemetry/sdk-trace-base';\n","/**\n * Span processor with flush and tail sampling support\n */\n\nimport type { Context } from '@opentelemetry/api';\nimport type {\n ReadableSpan,\n Span,\n SpanExporter,\n SpanProcessor,\n} from '@opentelemetry/sdk-trace-base';\nimport type { PostProcessorFn, TailSampleFn, LocalTrace } from '../types';\n\n/**\n * Span processor that supports flush by trace ID and tail sampling\n */\nexport class SpanProcessorWithFlush implements SpanProcessor {\n private exporter: SpanExporter;\n private postProcessor?: PostProcessorFn;\n private spans: Map<string, ReadableSpan[]> = new Map();\n\n constructor(exporter: SpanExporter, postProcessor?: PostProcessorFn) {\n this.exporter = exporter;\n this.postProcessor = postProcessor;\n }\n\n onStart(_span: Span, _parentContext: Context): void {\n // No-op for now\n }\n\n onEnd(span: ReadableSpan): void {\n const traceId = span.spanContext().traceId;\n\n if (!this.spans.has(traceId)) {\n this.spans.set(traceId, []);\n }\n\n this.spans.get(traceId)!.push(span);\n }\n\n /**\n * Force flush spans for a specific trace\n */\n async forceFlush(traceId?: string): Promise<void> {\n if (traceId) {\n const spans = this.spans.get(traceId);\n if (spans && spans.length > 0) {\n await this.exportSpans(spans);\n this.spans.delete(traceId);\n }\n } else {\n // Flush all traces\n const promises: Promise<void>[] = [];\n for (const [id, spans] of this.spans.entries()) {\n promises.push(this.exportSpans(spans));\n this.spans.delete(id);\n }\n await Promise.all(promises);\n }\n }\n\n async shutdown(): Promise<void> {\n await this.forceFlush();\n if (this.exporter) {\n await this.exporter.shutdown();\n }\n }\n\n /**\n * Export spans with post-processing\n * Errors are caught and logged but don't throw to prevent worker instability\n */\n private async exportSpans(spans: ReadableSpan[]): Promise<void> {\n if (spans.length === 0) return;\n if (!this.exporter) return; // No exporter configured (e.g., in tests)\n\n let processedSpans = spans;\n\n if (this.postProcessor) {\n try {\n processedSpans = this.postProcessor(spans);\n } catch (error) {\n // Post-processor errors should not prevent export\n console.error('[autotel-edge] Post-processor error:', error);\n // Continue with original spans\n processedSpans = spans;\n }\n }\n\n return new Promise((resolve) => {\n this.exporter.export(processedSpans, (result) => {\n if (result.code === 0) {\n // SUCCESS\n resolve();\n } else {\n // Log but don't reject - exporter failures shouldn't crash the worker\n console.error(\n '[autotel-edge] Exporter error:',\n result.error?.message || 'Unknown error',\n );\n resolve(); // Resolve instead of reject to prevent unhandled promise rejection\n }\n });\n });\n }\n}\n\n/**\n * Span processor that supports tail sampling decisions\n */\nexport class TailSamplingSpanProcessor implements SpanProcessor {\n private wrapped: SpanProcessorWithFlush;\n private tailSampler?: TailSampleFn;\n private traces: Map<string, LocalTrace> = new Map();\n\n constructor(\n exporter: SpanExporter,\n postProcessor?: PostProcessorFn,\n tailSampler?: TailSampleFn,\n ) {\n this.wrapped = new SpanProcessorWithFlush(exporter, postProcessor);\n this.tailSampler = tailSampler;\n }\n\n onStart(span: Span, parentContext: Context): void {\n this.wrapped.onStart(span, parentContext);\n }\n\n onEnd(span: ReadableSpan): void {\n const traceId = span.spanContext().traceId;\n const spanId = span.spanContext().spanId;\n const parentSpanId = 'parentSpanId' in span ? span.parentSpanId : undefined;\n\n // Initialize trace if not exists\n if (!this.traces.has(traceId)) {\n this.traces.set(traceId, {\n traceId,\n spans: [],\n localRootSpan: undefined as any, // Will be set when we identify the local root\n });\n }\n\n const trace = this.traces.get(traceId)!;\n\n // Determine if this span is a local root by checking if its parent is in buffered spans\n // A span is a local root if:\n // 1. It has no parentSpanId (definitive root)\n // 2. Its parentSpanId doesn't match any already-buffered span (remote parent = distributed trace entry)\n const hasLocalParent = parentSpanId &&\n trace.spans.some(s => s.spanContext().spanId === parentSpanId);\n\n // Set localRootSpan if this is the local root (no local parent found in buffer)\n if (!hasLocalParent) {\n trace.localRootSpan = span;\n }\n\n trace.spans.push(span); // Buffer the span AFTER checking parent relationships\n\n // Auto-flush decision: only auto-flush for normal traces (no parentSpanId at all)\n // For distributed traces (parentSpanId present), we rely on explicit forceFlush() from instrument.ts\n // This ensures we don't trigger before all spans have been buffered\n const isDefinitiveRoot = !parentSpanId;\n const shouldAutoFlush = isDefinitiveRoot && trace.localRootSpan &&\n trace.localRootSpan.spanContext().spanId === spanId;\n\n if (shouldAutoFlush) {\n if (this.tailSampler) {\n const shouldKeep = this.tailSampler(trace);\n\n if (shouldKeep) {\n // Export ALL buffered spans in the trace\n for (const bufferedSpan of trace.spans) {\n this.wrapped.onEnd(bufferedSpan);\n }\n // Force flush to actually export the spans\n void this.wrapped.forceFlush(traceId);\n }\n // If not keeping, just drop all spans (don't export)\n } else {\n // No tail sampler, export all buffered spans\n for (const bufferedSpan of trace.spans) {\n this.wrapped.onEnd(bufferedSpan);\n }\n // Force flush to actually export the spans\n void this.wrapped.forceFlush(traceId);\n }\n\n // Clean up trace after decision\n this.traces.delete(traceId);\n }\n // If not local root span, just buffer it - don't export yet\n }\n\n async forceFlush(traceId?: string): Promise<void> {\n if (traceId) {\n // Make tail sampling decision for this specific trace before flushing\n const trace = this.traces.get(traceId);\n if (trace) {\n // Ensure localRootSpan is set (fallback to first span if not)\n // This handles distributed traces where no span has undefined parentSpanId\n if (!trace.localRootSpan && trace.spans.length > 0) {\n trace.localRootSpan = trace.spans[0];\n }\n\n if (this.tailSampler) {\n const shouldKeep = this.tailSampler(trace);\n\n if (shouldKeep) {\n // Export ALL buffered spans in the trace\n for (const bufferedSpan of trace.spans) {\n this.wrapped.onEnd(bufferedSpan);\n }\n }\n } else {\n // No tail sampler, export all buffered spans\n for (const bufferedSpan of trace.spans) {\n this.wrapped.onEnd(bufferedSpan);\n }\n }\n\n // Clean up trace after decision\n this.traces.delete(traceId);\n }\n }\n return this.wrapped.forceFlush(traceId);\n }\n\n async shutdown(): Promise<void> {\n this.traces.clear();\n return this.wrapped.shutdown();\n }\n}\n","/**\n * Configuration system for autotel-edge\n */\n\nimport { W3CTraceContextPropagator } from '@opentelemetry/core';\nimport { ParentBasedSampler, AlwaysOnSampler } from '@opentelemetry/sdk-trace-base';\nimport { context as api_context, createContextKey, type Context } from '@opentelemetry/api';\nimport type {\n EdgeConfig,\n ResolvedEdgeConfig,\n ConfigurationOption,\n Trigger,\n ParentRatioSamplingConfig,\n} from '../types';\nimport { isSpanProcessorConfig } from '../types';\nimport { OTLPExporter } from './exporter';\nimport { TailSamplingSpanProcessor } from './spanprocessor';\n\n/**\n * Type for config initialization function\n */\nexport type Initialiser = (env: any, trigger: Trigger) => ResolvedEdgeConfig;\n\n/**\n * Context key for storing config (isolates config per-request)\n */\nconst CONFIG_KEY = createContextKey('autotel-edge-config');\n\n/**\n * Get the currently active config from context\n *\n * This reads the config from the active context, ensuring each request\n * has its own isolated config even when multiple requests are in-flight.\n */\nexport function getActiveConfig(): ResolvedEdgeConfig | null {\n const value = api_context.active().getValue(CONFIG_KEY) as\n | ResolvedEdgeConfig\n | null\n | undefined;\n return value ?? null;\n}\n\n/**\n * Set the active config in context\n *\n * Returns a new context with the config stored. This context should be\n * used with api_context.with() to ensure the config is isolated per-request.\n *\n * @example\n * ```typescript\n * const config = parseConfig({ service: { name: 'my-service' } });\n * const context = setConfig(config);\n *\n * api_context.with(context, () => {\n * // Config is available here via getActiveConfig()\n * });\n * ```\n */\nexport function setConfig(config: ResolvedEdgeConfig): Context {\n return api_context.active().setValue(CONFIG_KEY, config);\n}\n\n/**\n * Parse and validate configuration\n */\nexport function parseConfig(config: EdgeConfig): ResolvedEdgeConfig {\n // Parse head sampler\n const headSampler =\n config.sampling?.headSampler ??\n new ParentBasedSampler({\n root: new AlwaysOnSampler(),\n });\n\n const parsedHeadSampler =\n typeof headSampler === 'object' && 'ratio' in headSampler\n ? createParentRatioSampler(headSampler)\n : headSampler;\n\n // Parse tail sampler (default: keep sampled or error traces)\n const tailSampler =\n config.sampling?.tailSampler ??\n ((traceInfo) => {\n const localRootSpan = traceInfo.localRootSpan;\n const ctx = localRootSpan.spanContext();\n // Keep if sampled or if root span has error\n return (ctx.traceFlags & 1) === 1 || localRootSpan.status.code === 2; // SAMPLED flag | ERROR status\n });\n\n // Parse exporter - use TailSamplingSpanProcessor when tail sampler is present\n const spanProcessors = isSpanProcessorConfig(config)\n ? Array.isArray(config.spanProcessors)\n ? config.spanProcessors\n : [config.spanProcessors]\n : [\n // Use TailSamplingSpanProcessor to enable tail sampling\n new TailSamplingSpanProcessor(\n typeof config.exporter === 'object' && 'url' in config.exporter\n ? new OTLPExporter(config.exporter)\n : config.exporter,\n config.postProcessor,\n tailSampler, // Wire up the tail sampler!\n ),\n ];\n\n // Build resolved config\n const resolved: ResolvedEdgeConfig = {\n service: config.service,\n handlers: {\n fetch: config.handlers?.fetch ?? {},\n },\n fetch: {\n includeTraceContext: config.fetch?.includeTraceContext ?? true,\n },\n postProcessor: config.postProcessor ?? ((spans) => spans),\n sampling: {\n headSampler: parsedHeadSampler,\n tailSampler,\n },\n spanProcessors,\n propagator: config.propagator ?? new W3CTraceContextPropagator(),\n instrumentation: {\n instrumentGlobalFetch: config.instrumentation?.instrumentGlobalFetch ?? true,\n instrumentGlobalCache: config.instrumentation?.instrumentGlobalCache ?? false,\n disabled: config.instrumentation?.disabled ?? false,\n },\n subscribers: config.subscribers ?? [],\n dataSafety: config.dataSafety,\n nativeTracing: config.nativeTracing ?? 'auto',\n };\n\n return resolved;\n}\n\n/**\n * Create a parent-based ratio sampler\n */\nfunction createParentRatioSampler(config: ParentRatioSamplingConfig) {\n const { ratio, acceptRemote = true } = config;\n\n // Simple ratio sampler\n const ratioSampler = {\n shouldSample: () => ({\n decision: Math.random() < ratio ? 1 : 0, // RECORD_AND_SAMPLED : NOT_RECORD\n attributes: {},\n }),\n toString: () => `ParentRatioSampler{ratio=${ratio}}`,\n };\n\n if (acceptRemote) {\n return new ParentBasedSampler({ root: ratioSampler as any });\n }\n\n return ratioSampler;\n}\n\n/**\n * Create a config initializer function\n */\nexport function createInitialiser(config: ConfigurationOption): Initialiser {\n if (typeof config === 'function') {\n return (env, trigger) => {\n const conf = parseConfig(config(env, trigger));\n return conf;\n };\n } else {\n const parsed = parseConfig(config);\n return () => parsed;\n }\n}\n"],"mappings":";;;;;;;AAmBA,MAAM,iBAAyC;CAC7C,QAAQ;CACR,gBAAgB;CAChB,cAAc;AAChB;;;;AAKA,IAAa,eAAb,MAAkD;CAChD,AAAQ;CACR,AAAQ;CAER,YAAY,QAA4B;EACtC,KAAK,MAAM,OAAO;EAClB,KAAK,UAAU,OAAO,OAAO,CAAC,GAAG,gBAAgB,OAAO,OAAO;CACjE;CAEA,OAAO,OAAc,gBAAsD;EACzE,KAAK,QAAQ,KAAK,CAAC,CAChB,WAAW;GACV,eAAe,EAAE,MAAM,iBAAiB,QAAQ,CAAC;EACnD,CAAC,CAAC,CACD,OAAO,UAAU;GAChB,eAAe;IAAE,MAAM,iBAAiB;IAAQ;GAAM,CAAC;EACzD,CAAC;CACL;CAEA,AAAQ,QAAQ,OAAgC;EAC9C,OAAO,IAAI,SAAe,SAAS,WAAW;GAC5C,IAAI;IACF,KAAK,KAAK,OAAO,SAAS,MAAM;GAClC,SAAS,OAAO;IACd,OAAO,KAAK;GACd;EACF,CAAC;CACH;CAEA,KACE,OACA,WACA,SACM;EACN,MAAM,UAAU,IAAI,YAAY;EAChC,MAAM,gBAAgB,oBAAoB,iBAAiB,KAAK;EAEhE,MAAM,OAAO,QAAQ,OAAO,aAAa;EACzC,MAAM,SAAsB;GAC1B,QAAQ;GACR,SAAS,KAAK;GACd;EACF;EAEA,MAAM,KAAK,KAAK,MAAM,CAAC,CACpB,M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AAKA,SAAgB,kBAAkB,QAA0C;CAC1E,IAAI,OAAO,WAAW,YACpB,QAAQ,KAAK,YAAY;EAEvB,OADa,YAAY,OAAO,KAAK,OAAO,CAClC;CACZ;MACK;EACL,MAAM,SAAS,YAAY,MAAM;EACjC,aAAa;CACf;AACF"}
|
package/dist/events.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as EdgeEvent, f as FunnelStepStatus, l as EdgeTrackEvent, o as EdgeFunnelStepEvent, s as EdgeOutcomeEvent, u as EdgeValueEvent,
|
|
1
|
+
import { a as EdgeEvent, b as OutcomeStatus, f as FunnelStepStatus, l as EdgeTrackEvent, o as EdgeFunnelStepEvent, s as EdgeOutcomeEvent, u as EdgeValueEvent, y as OrPromise } from "./types-CCbv6225.js";
|
|
2
2
|
|
|
3
3
|
//#region src/events/index.d.ts
|
|
4
4
|
type SubscriberDeliveryMode = 'fire-and-forget' | 'await';
|
package/dist/events.js
CHANGED
|
@@ -97,6 +97,18 @@ declare function span<T = unknown>(name: string, fn: (span: Span) => T): T;
|
|
|
97
97
|
declare function span<T = unknown>(name: string, fn: (span: Span) => Promise<T>): Promise<T>;
|
|
98
98
|
declare function span<T = unknown>(options: SpanOptions$1, fn: (span: Span) => T): T;
|
|
99
99
|
declare function span<T = unknown>(options: SpanOptions$1, fn: (span: Span) => Promise<T>): Promise<T>;
|
|
100
|
+
/**
|
|
101
|
+
* `enterSpan(name, callback)` — a Cloudflare-familiar alias for {@link span}.
|
|
102
|
+
*
|
|
103
|
+
* Mirrors the shape of Cloudflare's `tracing.enterSpan()` so CF users can keep
|
|
104
|
+
* the API they know, but with autotel superpowers: it works on every runtime
|
|
105
|
+
* (not just Workers), supports `span.setAttributes()` bulk-set, and falls back
|
|
106
|
+
* to autotel's OTLP pipeline when no native tracer is active. When a native
|
|
107
|
+
* tracer *is* active (e.g. on a Worker with tracing enabled), the span nests
|
|
108
|
+
* inside Cloudflare's native waterfall.
|
|
109
|
+
*/
|
|
110
|
+
declare function enterSpan<T = unknown>(name: string, fn: (span: Span) => T): T;
|
|
111
|
+
declare function enterSpan<T = unknown>(name: string, fn: (span: Span) => Promise<T>): Promise<T>;
|
|
100
112
|
//#endregion
|
|
101
113
|
//#region src/execution-logger.d.ts
|
|
102
114
|
/**
|
|
@@ -133,5 +145,5 @@ interface ExecutionLoggerOptions {
|
|
|
133
145
|
}
|
|
134
146
|
declare function getExecutionLogger(ctx?: TraceContext, options?: ExecutionLoggerOptions): ExecutionLogger;
|
|
135
147
|
//#endregion
|
|
136
|
-
export { ForkOptions as a,
|
|
137
|
-
//# sourceMappingURL=execution-logger-
|
|
148
|
+
export { ForkOptions as a, enterSpan as c, trace$1 as d, traceOptions as f, ForkLifecycle as i, instrument as l, TraceContext as m, ExecutionLogger as n, getExecutionLogger as o, withTracing as p, ExecutionLoggerOptions as r, InstrumentOptions as s, ExecutionLogSnapshot as t, span as u };
|
|
149
|
+
//# sourceMappingURL=execution-logger-Cmjy8i-d.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-logger-
|
|
1
|
+
{"version":3,"file":"execution-logger-Cmjy8i-d.d.ts","names":[],"sources":["../src/core/trace-context.ts","../src/functional.ts","../src/execution-logger.ts"],"mappings":";;;;AAqBA;;;AAAA,UAAiB,gBAAA;EACf,OAAA;EACA,MAAA;EACA,aAAA;EACA,eAAA;AAAA;AAAe;AAMjB;;AANiB,UAMA,WAAA;EAEkB;EAAjC,YAAA,CAAa,GAAA,UAAa,KAAA,EAAO,cAAA;EAEZ;EAArB,aAAA,CAAc,KAAA,EAAO,MAAA,SAAe,cAAA;EAIT;EAF3B,SAAA,CAAU,MAAA;IAAU,IAAA,EAAM,cAAA;IAAgB,OAAA;EAAA;EAO5B;EALd,eAAA,CAAgB,SAAA,EAAW,KAAA,EAAO,IAAA,GAAO,SAAA;EAUzB;EARhB,QAAA,CACE,IAAA,UACA,qBAAA,GAAwB,MAAA,SAAe,cAAA,IAAkB,SAAA,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,GAAY,aAAa;AAAA;AAAA,UAGV,eAAA;EACf,GAAA,CAAI,MAAA,EAAQ,MAAA;EACZ,IAAA,CAAK,OAAA,UAAiB,MAAA,GAAS,MAAA;EAC/B,IAAA,CAAK,OAAA,UAAiB,MAAA,GAAS,MAAA;EAC/B,KAAA,CAAM,KAAA,EAAO,KAAA,WAAgB,MAAA,GAAS,MAAA;EACtC,UAAA,IAAc,MAAA;EACd,OAAA,CAAQ,SAAA,GAAY,MAAA,oBAA0B,oBAAA;EAC9C,IAAA,CACE,KAAA,UACA,EAAA,eAAiB,OAAA,QACjB,OAAA,GAAU,WAAA;AAAA;AAAA,UAIG,oBAAA;EACf,SAAA;EACA,OAAA;EACA,MAAA;EACA,aAAA;EACA,OAAA,EAAS,MAAM;AAAA;AAAA,UAGA,sBAAA;EACf,MAAA,IAAU,QAAA,EAAU,oBAAA,YAAgC,OAAO;AAAA;AAAA,iBAuI7C,kBAAA,CACd,GAAA,GAAM,YAAA,EACN,OAAA,GAAU,sBAAA,GACT,eAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { a as ForkOptions, c as
|
|
1
|
+
import { A as Trigger, C as ResolveConfigFn, D as ServiceConfig, E as SamplingConfig, O as TailSampleFn, S as ReadableSpan, T as RouteServiceConfig, _ as NativeTracingMode, c as EdgeSubscriber, d as ExporterConfig, g as LocalTrace, h as InstrumentationOptions, i as EdgeConfig, j as WorkflowTrigger, k as TraceFlushableSpanProcessor, m as InitialSpanInfo, n as DOConstructorTrigger, p as HandlerInstrumentation, r as DataSafetyConfig, t as ConfigurationOption, v as OTLPExporterConfig, w as ResolvedEdgeConfig, x as PostProcessorFn } from "./types-CCbv6225.js";
|
|
2
|
+
import { a as ForkOptions, c as enterSpan, d as trace, f as traceOptions, i as ForkLifecycle, l as instrument, m as TraceContext, n as ExecutionLogger, o as getExecutionLogger, p as withTracing, r as ExecutionLoggerOptions, s as InstrumentOptions, t as ExecutionLogSnapshot, u as span } from "./execution-logger-Cmjy8i-d.js";
|
|
3
3
|
import { ParsedError, parseError } from "./parse-error.js";
|
|
4
4
|
import { ExportResult, InstrumentationScope } from "@opentelemetry/core";
|
|
5
5
|
import { AttributeValue, Attributes, Context, Context as Context$1, ContextManager, Exception, HrTime, Link, Span, Span as Span$1, SpanContext, SpanContext as SpanContext$1, SpanKind, SpanOptions, SpanStatus, TimeInput, Tracer, Tracer as Tracer$1, context, propagation } from "@opentelemetry/api";
|
|
@@ -150,6 +150,11 @@ declare class AsyncLocalStorageContextManager extends AbstractAsyncHooksContextM
|
|
|
150
150
|
enable(): this;
|
|
151
151
|
disable(): this;
|
|
152
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Ensure a global AsyncLocalStorage context manager is registered, returning it.
|
|
155
|
+
* Idempotent.
|
|
156
|
+
*/
|
|
157
|
+
declare function ensureGlobalContextManager(): AsyncLocalStorageContextManager;
|
|
153
158
|
//#endregion
|
|
154
159
|
//#region src/core/provider.d.ts
|
|
155
160
|
/**
|
|
@@ -157,14 +162,18 @@ declare class AsyncLocalStorageContextManager extends AbstractAsyncHooksContextM
|
|
|
157
162
|
*/
|
|
158
163
|
declare class WorkerTracerProvider {
|
|
159
164
|
private tracer;
|
|
160
|
-
private contextManager;
|
|
161
165
|
constructor(spanProcessors: SpanProcessor[], resource: Resource);
|
|
162
166
|
/**
|
|
163
167
|
* Get the tracer instance
|
|
164
168
|
*/
|
|
165
169
|
getTracer(_name: string, _version?: string, _config?: TracerConfig): WorkerTracer;
|
|
166
170
|
/**
|
|
167
|
-
* Register this provider as the global tracer
|
|
171
|
+
* Register this provider as the global tracer.
|
|
172
|
+
*
|
|
173
|
+
* Registers the global context manager so context — and the active span —
|
|
174
|
+
* propagates across `await` boundaries (without it the API uses a no-op
|
|
175
|
+
* manager and `trace.getActiveSpan()` returns undefined after the first
|
|
176
|
+
* await), then installs the tracer provider.
|
|
168
177
|
*/
|
|
169
178
|
register(): void;
|
|
170
179
|
}
|
|
@@ -207,6 +216,72 @@ declare function parseConfig(config: EdgeConfig): ResolvedEdgeConfig;
|
|
|
207
216
|
*/
|
|
208
217
|
declare function createInitialiser(config: ConfigurationOption): Initialiser;
|
|
209
218
|
//#endregion
|
|
219
|
+
//#region src/core/native-bridge.d.ts
|
|
220
|
+
/**
|
|
221
|
+
* The minimal span surface every native runtime is expected to provide.
|
|
222
|
+
* Modelled on Cloudflare Workers' custom-span `Span`.
|
|
223
|
+
*/
|
|
224
|
+
interface NativeSpanHandle {
|
|
225
|
+
/** Whether this invocation is actually being recorded (head sampling). */
|
|
226
|
+
readonly isTraced: boolean;
|
|
227
|
+
/** Set a single primitive attribute. `undefined` is a no-op. */
|
|
228
|
+
setAttribute(key: string, value: string | number | boolean | undefined): void;
|
|
229
|
+
/**
|
|
230
|
+
* Optional — not provided by Cloudflare today, but reserved so autotel
|
|
231
|
+
* auto-upgrades to real trace/span ids the moment the platform exposes them,
|
|
232
|
+
* with no API change. When present and valid, its ids take precedence over
|
|
233
|
+
* the fallback correlation id.
|
|
234
|
+
*/
|
|
235
|
+
spanContext?(): SpanContext$1;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* A native tracer creates spans scoped to a callback, auto-nesting by async
|
|
239
|
+
* context. Modelled on Cloudflare's `tracing.enterSpan(name, callback)`.
|
|
240
|
+
*/
|
|
241
|
+
interface NativeTracer {
|
|
242
|
+
enterSpan<T>(name: string, callback: (span: NativeSpanHandle) => T): T;
|
|
243
|
+
/**
|
|
244
|
+
* Optional per-request correlation id surfaced as `ctx.correlationId` (and a
|
|
245
|
+
* `correlation.id` span attribute) when the platform does not yet expose
|
|
246
|
+
* span ids. On Cloudflare this is the `cf-ray` id, so logs, custom spans, and
|
|
247
|
+
* the dashboard all share one queryable key today.
|
|
248
|
+
*/
|
|
249
|
+
readonly correlationId?: string;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Return a context with the given native tracer installed. Runtime adapters
|
|
253
|
+
* call this once per request and run the handler inside it so that nested
|
|
254
|
+
* `span()` / `trace()` calls route to the native tracer.
|
|
255
|
+
*/
|
|
256
|
+
declare function withNativeTracer(tracer: NativeTracer, context?: Context$1): Context$1;
|
|
257
|
+
/**
|
|
258
|
+
* Read the native tracer from the active context, if one was installed.
|
|
259
|
+
* Returns `null` when running without a native tracer (other edge runtimes,
|
|
260
|
+
* native tracing disabled, local dev) — callers then fall back to the OTel path.
|
|
261
|
+
*/
|
|
262
|
+
declare function getActiveNativeTracer(): NativeTracer | null;
|
|
263
|
+
/**
|
|
264
|
+
* Build an autotel {@link TraceContext} backed by a native span.
|
|
265
|
+
*
|
|
266
|
+
* Degradation (native surface is thinner than OTel):
|
|
267
|
+
* - `traceId`/`spanId` → real ids when the platform exposes `spanContext()`
|
|
268
|
+
* (auto-upgrades in future), otherwise `''`.
|
|
269
|
+
* - `correlationId` → real-id-derived when available, else the supplied
|
|
270
|
+
* `correlationId` (e.g. Cloudflare `cf-ray`). Also written as a
|
|
271
|
+
* `correlation.id` span attribute so it is queryable in the backend.
|
|
272
|
+
* - `setStatus(ERROR)` → records `otel.status_code` + `error` attributes.
|
|
273
|
+
* - `recordException` → attributes + `console.error` (attributed to the span).
|
|
274
|
+
* - `addEvent` → `console.log(name, attrs)` (attributed to the span).
|
|
275
|
+
* - `addLink`/`addLinks`/`updateName` → no-ops.
|
|
276
|
+
*/
|
|
277
|
+
declare function createNativeTraceContext(span: NativeSpanHandle, name: string, correlationId?: string): TraceContext;
|
|
278
|
+
/**
|
|
279
|
+
* Build a minimal OpenTelemetry {@link Span} backed by a native span, for the
|
|
280
|
+
* `span(name, (span) => ...)` callback whose argument is typed as an OTel Span.
|
|
281
|
+
* Unsupported operations degrade exactly as in {@link createNativeTraceContext}.
|
|
282
|
+
*/
|
|
283
|
+
declare function createNativeSpanShim(span: NativeSpanHandle, correlationId?: string): Span$1;
|
|
284
|
+
//#endregion
|
|
210
285
|
//#region src/composition.d.ts
|
|
211
286
|
/**
|
|
212
287
|
* Identity helper for authoring an autotel configuration once with full
|
|
@@ -317,5 +392,5 @@ interface MiddlewarePipelineOptions<TEvent, TRequest = unknown> {
|
|
|
317
392
|
}
|
|
318
393
|
declare function runMiddlewareFinishPipeline<TEvent, TRequest = unknown>(ctx: MiddlewareFinishContext<TEvent, TRequest>, options?: MiddlewarePipelineOptions<TEvent, TRequest>): Promise<void>;
|
|
319
394
|
//#endregion
|
|
320
|
-
export { AsyncLocalStorageContextManager, Buffer, type ConfigurationOption, type Context, type DOConstructorTrigger, type DataSafetyConfig, type DefaultPluginContexts, type EdgeConfig, type EdgePlugin, type EdgeSubscriber, type ExecutionLogSnapshot, type ExecutionLogger, type ExecutionLoggerOptions, type ExporterConfig, type ForkLifecycle, type ForkOptions, type HandlerInstrumentation, type InitialSpanInfo, type Initialiser, type InstrumentOptions, type InstrumentationOptions, type LocalTrace, type MiddlewareFinishContext, type MiddlewarePipelineOptions, OTLPExporter, type OTLPExporterConfig, type ParsedError, type PluginHookContexts, type PluginRunner, type PluginRunnerOptions, type PostProcessorFn, type ReadableSpan, type ResolveConfigFn, type ResolvedEdgeConfig, type RouteFilterOptions, type RouteServiceConfig, type SamplingConfig, type ServiceConfig, type Span, type SpanContext, SpanImpl, type TailSampleFn, type TraceContext, type TraceFlushableSpanProcessor, type Tracer, type Trigger, WorkerTracer, WorkerTracerProvider, type WorkflowTrigger, composePostProcessors, composeSpanProcessors, composeSubscribers, context, createInitialiser, createPluginRunner, defineConfig, definePlugin, getActiveConfig, getEmptyPluginRunner, getExecutionLogger, getServiceForPath, instrument as instrumentFunctions, matchesRoutePattern, parseConfig, parseError, propagation, runMiddlewareFinishPipeline, setConfig, shouldInstrumentPath, span, trace, type traceOptions, withNextSpan, withTracing };
|
|
395
|
+
export { AsyncLocalStorageContextManager, Buffer, type ConfigurationOption, type Context, type DOConstructorTrigger, type DataSafetyConfig, type DefaultPluginContexts, type EdgeConfig, type EdgePlugin, type EdgeSubscriber, type ExecutionLogSnapshot, type ExecutionLogger, type ExecutionLoggerOptions, type ExporterConfig, type ForkLifecycle, type ForkOptions, type HandlerInstrumentation, type InitialSpanInfo, type Initialiser, type InstrumentOptions, type InstrumentationOptions, type LocalTrace, type MiddlewareFinishContext, type MiddlewarePipelineOptions, type NativeSpanHandle, type NativeTracer, type NativeTracingMode, OTLPExporter, type OTLPExporterConfig, type ParsedError, type PluginHookContexts, type PluginRunner, type PluginRunnerOptions, type PostProcessorFn, type ReadableSpan, type ResolveConfigFn, type ResolvedEdgeConfig, type RouteFilterOptions, type RouteServiceConfig, type SamplingConfig, type ServiceConfig, type Span, type SpanContext, SpanImpl, type TailSampleFn, type TraceContext, type TraceFlushableSpanProcessor, type Tracer, type Trigger, WorkerTracer, WorkerTracerProvider, type WorkflowTrigger, composePostProcessors, composeSpanProcessors, composeSubscribers, context, createInitialiser, createNativeSpanShim, createNativeTraceContext, createPluginRunner, defineConfig, definePlugin, ensureGlobalContextManager, enterSpan, getActiveConfig, getActiveNativeTracer, getEmptyPluginRunner, getExecutionLogger, getServiceForPath, instrument as instrumentFunctions, matchesRoutePattern, parseConfig, parseError, propagation, runMiddlewareFinishPipeline, setConfig, shouldInstrumentPath, span, trace, type traceOptions, withNativeTracer, withNextSpan, withTracing };
|
|
321
396
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/core/span.ts","../src/core/tracer.ts","../src/core/exporter.ts","../src/core/context.ts","../src/core/provider.ts","../src/core/config.ts","../src/composition.ts","../src/plugin-runner.ts","../src/middleware-toolkit.ts"],"mappings":";;;;;;;;;;;KA4BK,SAAA,IAAa,IAAU,EAAJ,MAAI;AAAA,UAElB,QAAA;EACR,UAAA;EACA,IAAA;EACA,KAAA,EAAO,SAAA;EACP,QAAA,EAAU,QAAA;EACV,WAAA,EAAa,aAAA;EACb,iBAAA,GAAoB,aAAA;EACpB,KAAA,GAAQ,IA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BAAA,CAAkB,CAAA,MACzB,IAAA,EAAM,CAAA,GACR,UAAA,CAAW,CAAA;EAAA,SAEL,MAAA;EAAA,SAEA,OAAA;EHlBG;;;EGuBZ,IAAA,IAAQ,OAAA,EAAS,SAAA,EAAS,MAAA,EAAQ,CAAA,GAAI,CAAA;EAAA,QAW9B,aAAA;EHhCQ;;;;EAAA,QGkDR,iBAAA;EAAA,QAgCA,oBAAA;EAAA,QAYA,wBAAA;EAAA,QAeA,iBAAA;EAAA,QAqCA,eAAA;EAAA,QAMA,YAAA;EAAA,iBAIS,aAAA;EAAA,QACT,QAAA;AAAA;;;;cAMG,+BAAA,SAAwC,gCAAA;EAAA,QAC3C,kBAAA;;EAOR,MAAA,IAAU,SAAA;EAIV,IAAA,oCAAwC,IAAA,EAAM,CAAA,KAAM,UAAA,CAAW,CAAA,GAC7D,OAAA,EAAS,SAAA,EACT,EAAA,EAAI,CAAA,EACJ,OAAA,GAAU,iBAAA,CAAkB,CAAA,MACzB,IAAA,EAAM,CAAA,GACR,UAAA,CAAW,CAAA;EAKd,MAAA;EAIA,OAAA;AAAA;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/core/span.ts","../src/core/tracer.ts","../src/core/exporter.ts","../src/core/context.ts","../src/core/provider.ts","../src/core/config.ts","../src/core/native-bridge.ts","../src/composition.ts","../src/plugin-runner.ts","../src/middleware-toolkit.ts"],"mappings":";;;;;;;;;;;KA4BK,SAAA,IAAa,IAAU,EAAJ,MAAI;AAAA,UAElB,QAAA;EACR,UAAA;EACA,IAAA;EACA,KAAA,EAAO,SAAA;EACP,QAAA,EAAU,QAAA;EACV,WAAA,EAAa,aAAA;EACb,iBAAA,GAAoB,aAAA;EACpB,KAAA,GAAQ,IAAA;EACR,YAAA;EACA,QAAA,GAAW,QAAA;EACX,SAAA,GAAY,SAAA;AAAA;;;;cAmDD,QAAA,YAAoB,MAAA,EAAM,cAAA;EACrC,IAAA;EAAA,iBACiB,YAAA;EAAA,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