UNPKG

autotel

Version:
646 lines (638 loc) 26.1 kB
import { getAutotelTracer, getAutotelTracerProvider, setAutotelTracerProvider } from "./tracer-provider.js"; import { AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, NeverSampler, RandomSampler, UserIdSampler, createLinkFromHeaders, extractLinksFromBatch, resolveSamplingPreset, samplingPresets } from "./sampling.js"; import { a as getSdk, c as isInitialized, f as createStringRedactor, i as getLogger, l as isLoggerLocked, p as BaggageSpanProcessor, s as init, t as _closeEmbeddedDevtools, u as lockLogger } from "./init-BS2JVkrL.js"; import { FilteringSpanProcessor } from "./filtering-span-processor.js"; import { NORMALIZER_PATTERNS, NORMALIZER_PRESETS, SpanNameNormalizingProcessor } from "./span-name-normalizer.js"; import { AttributeRedactingProcessor, REDACTOR_PATTERNS, REDACTOR_PRESETS, builtinPatterns, createAttributeRedactor, createRedactedSpan, normalizeAttributeRedactorConfig } from "./attribute-redacting-processor.js"; import { n as formatDuration } from "./canonical-log-line-processor-DbBQT5vY.js"; import { a as CORRELATION_ID_BAGGAGE_KEY, d as setCorrelationId, f as setCorrelationIdInBaggage, l as getOrCreateCorrelationId, m as defineBaggageSchema, n as resetEventQueue, o as generateCorrelationId, p as createTraceContext, r as track, s as getCorrelationId, t as getEventQueue, u as runWithCorrelationId } from "./track-COUuU48p.js"; import { a as flattenToAttributes, i as structuredErrorToJSON, n as getStructuredErrorAttributes, o as toAttributeValue, r as recordStructuredError, t as createStructuredError } from "./structured-error-9--cxBay.js"; import { createDeterministicTraceId, enrichWithTraceContext, finalizeSpan, flattenMetadata, getActiveContext, getActiveSpan, getTraceContext, getTracer, isTracing, resolveTraceUrl, runWithSpan } from "./trace-helpers.js"; import { n as runInOperationContext, t as getOperationContext } from "./operation-context-CKBoA4Qy.js"; import { a as trace$2, c as withTracing, i as span, n as instrument, o as withBaggage, r as markAsImmediate, s as withNewContext, t as ctx } from "./functional-r-AUIRy_.js"; import { t as hashJson } from "./stable-hash-ChFBIhNt.js"; import { n as getEvents, r as resetEvents, t as Event } from "./event-531asIM6.js"; import { Metric, getMetrics, resetMetrics } from "./metric.js"; import { t as emitCorrelatedEvent } from "./correlated-events-Bzh5y-UB.js"; import { parseError } from "./parse-error.js"; import { createDrainPipeline } from "./drain-pipeline.js"; import { createCounter, createHistogram, createObservableGauge, createUpDownCounter, getMeter } from "./metric-helpers.js"; import { traceDB, traceHTTP, traceMessaging } from "./semantic-helpers.js"; import { C as URLAttributes, d as HTTPAttributes, y as ServiceAttributes } from "./registry-DVSmWg6Y.js"; import { httpRequestHeaderAttribute, httpResponseHeaderAttribute } from "./semantic-conventions.js"; import { a as identify, c as setDevice, d as setSession, f as setUser, h as autoRedactPII, i as httpServer, l as setError, m as safeSetAttributes, n as dbClient, o as mergeServiceResource, p as mergeAttrs, r as httpClient, s as request, u as setException, v as validateAttribute, y as attrs } from "./attributes-CmYpdqCN.js"; import { traceConsumer, traceProducer } from "./messaging.js"; import { BusinessBaggage, createSafeBaggageSchema } from "./business-baggage.js"; import { getCurrentWorkflowContext, isInWorkflow, traceStep, traceWorkflow } from "./workflow.js"; import { ROOT_CONTEXT, SpanKind, SpanStatusCode, context, propagation, trace as otelTrace, trace as trace$1 } from "@opentelemetry/api"; import * as nodeAsyncHooks from "node:async_hooks"; //#region src/trace-hybrid.ts /** * Hybrid `trace` export: callable like autotel's `trace(fn)`, AND exposes the * full `@opentelemetry/api` `TraceAPI` surface (`trace.getActiveSpan()`, * `trace.getTracer()`, …) so existing OTel code "just works" when imported * from `autotel`. * * Implementation: `Object.assign` mutates the autotel `trace` function to * attach the OTel TraceAPI methods. Because every reference to `trace` across * autotel resolves to the same function instance, this is a one-time, global * augmentation. */ const otelMethods = { setGlobalTracerProvider: trace$1.setGlobalTracerProvider.bind(trace$1), getTracerProvider: trace$1.getTracerProvider.bind(trace$1), getTracer: trace$1.getTracer.bind(trace$1), disable: trace$1.disable.bind(trace$1), wrapSpanContext: trace$1.wrapSpanContext, isSpanContextValid: trace$1.isSpanContextValid, deleteSpan: trace$1.deleteSpan, getSpan: trace$1.getSpan, getActiveSpan: trace$1.getActiveSpan, getSpanContext: trace$1.getSpanContext, setSpan: trace$1.setSpan, setSpanContext: trace$1.setSpanContext }; const trace = Object.assign(trace$2, otelMethods); //#endregion //#region src/define-event.ts function defineEvent(name, schema, options = {}) { const jsonSchema = options.toJsonSchema?.(schema); const schemaMetadata = jsonSchema ? { source: "zod", jsonSchema, hash: hashJson(jsonSchema) } : void 0; return { name, schemaMetadata, track(payload) { const parsed = schema.safeParse(payload); if (!parsed.success) throw new Error(`Invalid payload for event "${name}". Schema validation failed.`); track(name, parsed.data, schemaMetadata ? { schema: schemaMetadata } : void 0); } }; } //#endregion //#region src/shutdown.ts /** * Graceful shutdown with flush and cleanup */ /** * Flush all pending telemetry * * Flushes both events events and OpenTelemetry spans to their destinations. * Includes timeout protection to prevent hanging in serverless environments. * * Safe to call multiple times. * * @param options - Optional configuration * @param options.timeout - Timeout in milliseconds (default: 2000ms) * @param options.forShutdown - If true, permanently disables the events queue after flush (used internally by shutdown()) * * @example Manual flush in serverless * ```typescript * import { flush } from 'autotel'; * * export const handler = async (event) => { * // ... process event * await flush(); // Flush before function returns * return result; * }; * ``` * * @example With custom timeout * ```typescript * await flush({ timeout: 5000 }); // 5 second timeout * ``` */ async function flush(options) { const timeout = options?.timeout ?? 2e3; const forShutdown = options?.forShutdown ?? false; const doFlush = async () => { const eventsQueue = getEventQueue(); if (eventsQueue) if (forShutdown) await eventsQueue.shutdown(); else await eventsQueue.flush(); const sdk = getSdk(); if (sdk) try { const sdkAny = sdk; if (typeof sdkAny.getTracerProvider === "function") { const tracerProvider = sdkAny.getTracerProvider(); if (tracerProvider && typeof tracerProvider.forceFlush === "function") await tracerProvider.forceFlush(); } } catch {} }; let timeoutHandle; try { await Promise.race([doFlush().finally(() => { if (timeoutHandle) clearTimeout(timeoutHandle); }), new Promise((_, reject) => { timeoutHandle = setTimeout(() => reject(/* @__PURE__ */ new Error("Flush timeout")), timeout); timeoutHandle.unref(); })]); } catch (error) { if (timeoutHandle) clearTimeout(timeoutHandle); getLogger().error({ err: error instanceof Error ? error : new Error(String(error)) }, "[autotel] Flush error"); throw error; } } /** * Shutdown telemetry and cleanup resources * * - Flushes all pending data * - Shuts down OpenTelemetry SDK * - Cleans up resources * * Call this before process exit. * * Always performs cleanup even if flush fails, preventing resource leaks * in serverless handlers or tests. * * @example Express server * ```typescript * const server = app.listen(3000) * * process.on('SIGTERM', async () => { * await server.close() * await shutdown() * process.exit(0) * }) * ``` */ async function shutdown() { const logger = getLogger(); let shutdownError = null; try { await flush({ forShutdown: true }); } catch (error) { const err = error instanceof Error ? error : new Error(String(error)); shutdownError = err; logger.error({ err }, "[autotel] Flush failed during shutdown, continuing cleanup"); } try { const sdk = getSdk(); if (sdk) await sdk.shutdown(); } catch (error) { const err = error instanceof Error ? error : new Error(String(error)); if (!(typeof error === "object" && error !== null && "code" in error && error.code === "ECONNREFUSED")) { if (!shutdownError) shutdownError = err; logger.error({ err }, "[autotel] SDK shutdown failed"); } } finally { await _closeEmbeddedDevtools(); const eventsQueue = getEventQueue(); if (eventsQueue && typeof eventsQueue.cleanup === "function") eventsQueue.cleanup(); resetEvents(); resetMetrics(); resetEventQueue(); } if (shutdownError) throw shutdownError; } /** * Register automatic shutdown hooks for common signals * * Handles: * - SIGTERM (Docker/K8s graceful shutdown) * - SIGINT (Ctrl+C) * * @internal Called automatically on module load */ function registerShutdownHooks() { if (typeof process === "undefined") return; const signals = ["SIGTERM", "SIGINT"]; let shuttingDown = false; for (const signal of signals) process.on(signal, async () => { if (shuttingDown) return; shuttingDown = true; if (process.env.NODE_ENV !== "test") getLogger().info({}, `[autotel] Received ${signal}, flushing telemetry...`); try { await shutdown(); } catch (error) { getLogger().error({ err: error instanceof Error ? error : void 0 }, "[autotel] Error during shutdown"); } finally { process.exit(0); } }); } registerShutdownHooks(); //#endregion //#region src/request-logger.ts const POST_EMIT_FORK_HINT = "For intentional background work tied to this request, use log.fork('label', fn) when available."; function warnPostEmit(method, detail) { console.warn(`[autotel] ${method} called after the wide event was emitted — ${detail} This data will not appear in observability. ${POST_EMIT_FORK_HINT}`); } function mergeInto$1(target, source) { for (const key in source) { const sourceVal = source[key]; if (sourceVal === void 0) continue; const targetVal = target[key]; if (sourceVal !== null && typeof sourceVal === "object" && !Array.isArray(sourceVal) && targetVal !== null && typeof targetVal === "object" && !Array.isArray(targetVal)) mergeInto$1(targetVal, sourceVal); else if (Array.isArray(targetVal) && Array.isArray(sourceVal)) target[key] = [...targetVal, ...sourceVal]; else target[key] = sourceVal; } } const requestContextStore = new nodeAsyncHooks.AsyncLocalStorage(); function runWithRequestContext(ctx, fn) { return requestContextStore.run(ctx, fn); } function resolveContext(ctx) { if (ctx) return ctx; const stored = requestContextStore.getStore(); if (stored) return stored; const span = trace$1.getActiveSpan(); if (!span) throw new Error("[autotel] getRequestLogger() requires an active span or runWithRequestContext(). Wrap your handler with trace() or use runWithRequestContext()."); return createTraceContext(span); } function getRequestLogger(ctx, options) { const activeContext = resolveContext(ctx); const contextState = {}; let emitted = false; let lastSnapshot = null; const addLogEvent = (level, message, fields) => { const attrs = fields ? flattenToAttributes(fields) : void 0; emitCorrelatedEvent(activeContext, `log.${level}`, { message, ...attrs }); }; const sealCheck = (method, keys) => { if (emitted) warnPostEmit(method, `Keys dropped: ${keys.length > 0 ? keys.join(", ") : "(empty)"}.`); }; return { set(fields) { sealCheck("log.set()", Object.keys(fields)); if (emitted) return; mergeInto$1(contextState, fields); activeContext.setAttributes(flattenToAttributes(fields)); }, info(message, fields) { sealCheck("log.info()", fields ? ["message", ...Object.keys(fields).filter((k) => k !== "requestLogs")] : ["message"]); if (emitted) return; addLogEvent("info", message, fields); if (fields) { mergeInto$1(contextState, fields); activeContext.setAttributes(flattenToAttributes(fields)); } }, warn(message, fields) { sealCheck("log.warn()", fields ? ["message", ...Object.keys(fields).filter((k) => k !== "requestLogs")] : ["message"]); if (emitted) return; addLogEvent("warn", message, fields); activeContext.setAttribute("autotel.log.level", "warn"); if (fields) { mergeInto$1(contextState, fields); activeContext.setAttributes(flattenToAttributes(fields)); } }, error(error, fields) { sealCheck("log.error()", fields ? [...Object.keys(fields), "error"] : ["error"]); if (emitted) return; const err = typeof error === "string" ? new Error(error) : error; recordStructuredError(activeContext, err); addLogEvent("error", err.message, fields); if (fields) { mergeInto$1(contextState, fields); activeContext.setAttributes(flattenToAttributes(fields)); } activeContext.setAttribute("autotel.log.level", "error"); }, getContext() { return { ...contextState }; }, emitNow(overrides) { if (emitted) { warnPostEmit("log.emitNow()", "Ignoring duplicate emit."); return lastSnapshot; } const mergedContext = { ...contextState, ...overrides }; const flattened = flattenToAttributes(mergedContext); activeContext.setAttributes(flattened); const snapshot = { timestamp: (/* @__PURE__ */ new Date()).toISOString(), traceId: activeContext.traceId, spanId: activeContext.spanId, correlationId: activeContext.correlationId, context: mergedContext }; emitCorrelatedEvent(activeContext, "log.emit.manual", { ...flattened }); if (options?.onEmit) Promise.resolve(options.onEmit(snapshot)).catch((error) => { console.warn("[autotel] request logger onEmit failed:", error); }); emitted = true; lastSnapshot = snapshot; return snapshot; }, fork(label, fn, forkOptions) { const parentRequestId = activeContext.correlationId; if (typeof parentRequestId !== "string" || parentRequestId.length === 0) throw new Error("[autotel] log.fork() requires the parent logger to have a correlationId. Ensure the request was created by autotel middleware."); const tracer = trace$1.getTracer("autotel.request-logger"); const lifecycle = forkOptions?.lifecycle; tracer.startActiveSpan(`request.fork:${label}`, (childSpan) => { const childContext = { ...createTraceContext(childSpan), correlationId: crypto.randomUUID() }; requestContextStore.run(childContext, () => { const childLog = getRequestLogger(childContext); childLog.set({ operation: label, _parentCorrelationId: parentRequestId }); lifecycle?.onChildEnter?.(childLog); Promise.resolve().then(() => fn()).then(() => { childLog.emitNow(); }).catch((error_) => { const error = error_ instanceof Error ? error_ : new Error(String(error_)); childLog.error(error); childLog.emitNow(); }).finally(() => { try { lifecycle?.onChildExit?.(childLog); } catch (hookError) { console.warn("[autotel] fork onChildExit hook threw:", hookError); } childSpan.end(); }); }); }); } }; } /** * Returns `true` when a request-logger context can be resolved without throwing — * i.e. an explicit `ctx` was provided, a `runWithRequestContext()` scope is active, * or there is an active OpenTelemetry span. * * Use this to branch on observability availability instead of wrapping * {@link getRequestLogger} in try/catch. */ function hasRequestContext(ctx) { if (ctx) return true; if (requestContextStore.getStore()) return true; return trace$1.getActiveSpan() != null; } /** * Like {@link getRequestLogger}, but returns `null` instead of throwing when no * request context is available. Intended for best-effort instrumentation where a * missing telemetry context must never crash business logic. */ function getRequestLoggerSafe(ctx, options) { if (!hasRequestContext(ctx)) return null; return getRequestLogger(ctx, options); } /** * A no-op {@link RequestLogger} whose methods do nothing. Used as a fallback by * best-effort instrumentation so wrapped handlers can run un-instrumented without * branching on logger presence. */ function createNoopRequestLogger() { const snapshot = () => ({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), traceId: "", spanId: "", correlationId: "", context: {} }); return { set() {}, info() {}, warn() {}, error() {}, getContext() { return {}; }, emitNow() { return snapshot(); }, fork(_label, fn) { Promise.resolve().then(() => fn()); } }; } //#endregion //#region src/error-catalog.ts /** * Typed error and audit catalogs. * * Group related errors into one catalog and get a refactor-safe builder per * code, with autocomplete at every call site and typed message parameters. * * @example * ```typescript * import { defineErrorCatalog } from 'autotel'; * * export const billing = defineErrorCatalog('billing', { * PAYMENT_DECLINED: { * status: 402, * message: 'Card declined', * why: 'The issuer rejected the charge', * fix: 'Try a different payment method', * }, * INSUFFICIENT_FUNDS: { * status: 402, * message: ({ available, required }: { available: number; required: number }) => * `Insufficient funds: $${available} of $${required}`, * }, * }); * * throw billing.PAYMENT_DECLINED({ cause: stripeError }); * throw billing.INSUFFICIENT_FUNDS({ available: 5, required: 100 }); * * // In a catch block — refactor-safe, no magic strings: * if (billing.PAYMENT_DECLINED.match(err)) { ... } * ``` */ const catalogCodeKey = Symbol.for("autotel.catalog.code"); function readCatalogCode(error) { if (error === null || typeof error !== "object") return void 0; return error[catalogCodeKey]; } /** True when `error` was produced by any autotel error catalog. */ function isCatalogError(error) { return readCatalogCode(error) !== void 0; } /** Returns the catalog code of `error`, or `undefined` if it has none. */ function getCatalogCode(error) { return readCatalogCode(error); } /** * Define a typed error catalog. Returns an object whose keys are error * builders. Each builder produces a {@link StructuredError} carrying the * entry's message, status, code, why, fix, and link. */ function defineErrorCatalog(namespace, entries) { const catalog = {}; for (const [key, entry] of Object.entries(entries)) { const code = entry.code ?? `${namespace}.${key}`; const usesParams = typeof entry.message === "function" || typeof entry.why === "function"; const builder = ((paramsOrOptions, maybeOptions) => { const params = usesParams ? paramsOrOptions : void 0; const options = usesParams ? maybeOptions : paramsOrOptions; const message = typeof entry.message === "function" ? entry.message(params) : entry.message; const why = typeof entry.why === "function" ? entry.why(params) : entry.why; const error = createStructuredError({ message, name: entry.name ?? key, code, ...entry.status === void 0 ? {} : { status: entry.status }, ...why === void 0 ? {} : { why }, ...entry.fix === void 0 ? {} : { fix: entry.fix }, ...entry.link === void 0 ? {} : { link: entry.link }, ...options?.cause === void 0 ? {} : { cause: options.cause }, ...options?.details === void 0 ? {} : { details: options.details }, ...options?.internal === void 0 ? {} : { internal: options.internal } }); Object.defineProperty(error, catalogCodeKey, { value: code, enumerable: false, writable: false, configurable: true }); return error; }); Object.defineProperty(builder, "code", { value: code, enumerable: true }); Object.defineProperty(builder, "match", { value: (error) => readCatalogCode(error) === code, enumerable: false }); catalog[key] = builder; } return Object.freeze(catalog); } /** * Define a typed audit catalog. Returns typed action descriptors you can pass * to `track()` or audit helpers without scattering magic strings. */ function defineAuditCatalog(namespace, entries) { const catalog = {}; for (const [key, entry] of Object.entries(entries)) { const action = entry.action ?? `${namespace}.${key}`; const severity = entry.severity ?? "info"; const descriptor = ((params) => { const message = typeof entry.message === "function" ? entry.message(params) : entry.message; return Object.freeze({ action, severity, ...message === void 0 ? {} : { message } }); }); Object.defineProperty(descriptor, "action", { value: action, enumerable: true }); Object.defineProperty(descriptor, "severity", { value: severity, enumerable: true }); catalog[key] = descriptor; } return Object.freeze(catalog); } //#endregion //#region src/drain-toolkit.ts const DEFAULT_TIMEOUT_MS = 5e3; const DEFAULT_RETRIES = 2; function delay(ms) { return new Promise((resolve) => { setTimeout(resolve, ms).unref?.(); }); } async function postWithRetry(options) { const { name, request, timeoutMs, retries } = options; const attempts = Math.max(1, retries); let lastError; for (let attempt = 1; attempt <= attempts; attempt++) { const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), timeoutMs); timeout.unref?.(); try { const response = await fetch(request.url, { method: "POST", headers: request.headers, body: request.body, signal: controller.signal }); if (!response.ok) throw new Error(`[autotel/${name}] HTTP ${response.status} draining ${request.url}`); return; } catch (error) { lastError = error; if (attempt < attempts) await delay(100 * attempt); } finally { clearTimeout(timeout); } } throw lastError; } function defineDrain(options) { return async (ctx) => { const contexts = Array.isArray(ctx) ? ctx : [ctx]; if (contexts.length === 0) return; const config = await options.resolve(); if (!config) return; const payloads = options.transform ? options.transform(contexts) : contexts; if (payloads.length === 0) return; try { await options.send(payloads, config); } catch (error) { console.error(`[autotel/${options.name}] drain failed:`, error); } }; } function defineHttpDrain(options) { return defineDrain({ name: options.name, resolve: options.resolve, transform: options.transform, send: async (payloads, config) => { const request = options.encode(payloads, config); if (!request) return; const timeoutMs = options.resolveTimeoutMs?.(config) ?? options.timeoutMs ?? DEFAULT_TIMEOUT_MS; const retries = options.resolveRetries?.(config) ?? options.retries ?? DEFAULT_RETRIES; await postWithRetry({ name: options.name, request, timeoutMs, retries }); } }); } //#endregion //#region src/enricher-toolkit.ts function isPlainObject(value) { return value !== null && typeof value === "object" && !Array.isArray(value); } function mergeInto(target, source) { for (const key in source) { const sourceVal = source[key]; if (sourceVal === void 0) continue; const targetVal = target[key]; if (isPlainObject(sourceVal) && isPlainObject(targetVal)) mergeInto(targetVal, sourceVal); else target[key] = sourceVal; } } function defineEnricher(def, options = {}) { return (ctx) => { let computed; try { computed = def.compute(ctx); } catch (error) { console.error(`[autotel/${def.name}] enrich failed:`, error); return; } if (!computed) return; if (options.overwrite || !isPlainObject(ctx.event[def.field])) { ctx.event[def.field] = computed; return; } mergeInto(ctx.event[def.field], computed); }; } //#endregion export { AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, AttributeRedactingProcessor, BaggageSpanProcessor, BusinessBaggage, CORRELATION_ID_BAGGAGE_KEY, Event, FilteringSpanProcessor, HTTPAttributes, Metric, NORMALIZER_PATTERNS, NORMALIZER_PRESETS, NeverSampler, REDACTOR_PATTERNS, REDACTOR_PRESETS, ROOT_CONTEXT, RandomSampler, ServiceAttributes, SpanKind, SpanNameNormalizingProcessor, SpanStatusCode, URLAttributes, UserIdSampler, attrs, autoRedactPII, builtinPatterns, context, createAttributeRedactor, createCounter, createDeterministicTraceId, createDrainPipeline, createHistogram, createLinkFromHeaders, createNoopRequestLogger, createObservableGauge, createRedactedSpan, createSafeBaggageSchema, createStringRedactor, createStructuredError, createUpDownCounter, ctx, dbClient, defineAuditCatalog, defineBaggageSchema, defineDrain, defineEnricher, defineErrorCatalog, defineEvent, defineHttpDrain, enrichWithTraceContext, extractLinksFromBatch, finalizeSpan, flattenMetadata, flattenToAttributes, flush, formatDuration, generateCorrelationId, getActiveContext, getActiveSpan, getAutotelTracer, getAutotelTracerProvider, getCatalogCode, getCorrelationId, getCurrentWorkflowContext, getEventQueue, getEvents, getMeter, getMetrics, getOperationContext, getOrCreateCorrelationId, getRequestLogger, getRequestLoggerSafe, getStructuredErrorAttributes, getTraceContext, getTracer, hasRequestContext, httpClient, httpRequestHeaderAttribute, httpResponseHeaderAttribute, httpServer, identify, init, instrument, isCatalogError, isInWorkflow, isInitialized, isLoggerLocked, isTracing, lockLogger, markAsImmediate, mergeAttrs, mergeServiceResource, normalizeAttributeRedactorConfig, otelTrace, parseError, propagation, recordStructuredError, request, resetEvents, resetMetrics, resolveSamplingPreset, resolveTraceUrl, runInOperationContext, runWithCorrelationId, runWithRequestContext, runWithSpan, safeSetAttributes, samplingPresets, setAutotelTracerProvider, setCorrelationId, setCorrelationIdInBaggage, setDevice, setError, setException, setSession, setUser, shutdown, span, structuredErrorToJSON, toAttributeValue, trace, traceConsumer, traceDB, traceHTTP, traceMessaging, traceProducer, traceStep, traceWorkflow, track, validateAttribute, withBaggage, withNewContext, withTracing }; //# sourceMappingURL=index.js.map