UNPKG

autotel

Version:
722 lines (713 loc) 28.9 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs'); const require_values = require('./values-tm4bi0FF.cjs'); const require_tracer_provider = require('./tracer-provider.cjs'); const require_structured_error = require('./structured-error-BAXhglRE.cjs'); const require_init = require('./init-BYXDCfRL.cjs'); const require_filtering_span_processor = require('./filtering-span-processor.cjs'); const require_span_name_normalizer = require('./span-name-normalizer.cjs'); const require_attribute_redacting_processor = require('./attribute-redacting-processor.cjs'); const require_canonical_log_line_processor = require('./canonical-log-line-processor-Bvgb1lE4.cjs'); const require_metric = require('./metric.cjs'); const require_functional = require('./functional-CJI0HCVJ.cjs'); const require_trace_helpers = require('./trace-helpers.cjs'); const require_stable_hash = require('./stable-hash-C9F6xjzx.cjs'); const require_correlated_events = require('./correlated-events-9RRdfyWR.cjs'); const require_parse_error = require('./parse-error.cjs'); const require_drain_pipeline = require('./drain-pipeline.cjs'); const require_metric_helpers = require('./metric-helpers.cjs'); const require_semantic_helpers = require('./semantic-helpers.cjs'); const require_registry = require('./registry-DIoklBz5.cjs'); const require_semantic_conventions = require('./semantic-conventions.cjs'); const require_attributes = require('./attributes-DkptT2Ck.cjs'); const require_messaging = require('./messaging.cjs'); const require_business_baggage = require('./business-baggage.cjs'); const require_workflow = require('./workflow.cjs'); let _opentelemetry_api = require("@opentelemetry/api"); let node_async_hooks = require("node:async_hooks"); node_async_hooks = require_rolldown_runtime.__toESM(node_async_hooks, 1); //#region src/force-keep.ts /** * Keep this trace whatever the sampler decides. * * Reach for it where a trace is worth more than the sampling budget: a * payment, an audit-relevant action, or a request you are debugging now. */ function forceKeep() { const ctx = require_functional.getActiveTraceContext(); if (!ctx) return; ctx.setAttribute(require_init.AUTOTEL_SAMPLING_TAIL_EVALUATED, true); ctx.setAttribute(require_init.AUTOTEL_SAMPLING_TAIL_KEEP, true); const span = require_trace_helpers.getActiveSpan(); if (span) require_init.markForceKept(span); } //#endregion //#region src/experiment.ts /** * Record which experiment a unit of work is part of. * * An experiment needs a guess and a way to check it. Instrumentation gives you * the check; this names the guess, so the two cohorts you want to compare are * selectable from the telemetry rather than reconstructed by hand afterwards. */ function experiment(options) { const ctx = require_functional.getActiveTraceContext(); if (!ctx) return; ctx.setAttribute("experiment.name", options.name); ctx.setAttribute("experiment.variant", options.variant); if (options.expect !== void 0) ctx.setAttribute("experiment.expectation", options.expect); ctx.setBaggage("experiment.name", options.name); ctx.setBaggage("experiment.variant", options.variant); } //#endregion //#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: _opentelemetry_api.trace.setGlobalTracerProvider.bind(_opentelemetry_api.trace), getTracerProvider: _opentelemetry_api.trace.getTracerProvider.bind(_opentelemetry_api.trace), getTracer: _opentelemetry_api.trace.getTracer.bind(_opentelemetry_api.trace), disable: _opentelemetry_api.trace.disable.bind(_opentelemetry_api.trace), wrapSpanContext: _opentelemetry_api.trace.wrapSpanContext, isSpanContextValid: _opentelemetry_api.trace.isSpanContextValid, deleteSpan: _opentelemetry_api.trace.deleteSpan, getSpan: _opentelemetry_api.trace.getSpan, getActiveSpan: _opentelemetry_api.trace.getActiveSpan, getSpanContext: _opentelemetry_api.trace.getSpanContext, setSpan: _opentelemetry_api.trace.setSpan, setSpanContext: _opentelemetry_api.trace.setSpanContext }; const trace = Object.assign(require_functional.trace, otelMethods); //#endregion //#region src/define-event.ts function defineEvent(name, schema, options = {}) { const jsonSchema = options.toJsonSchema?.(schema); const schemaMetadata = jsonSchema ? { source: "zod", jsonSchema, hash: require_stable_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.`); require_init.track(name, parsed.data, schemaMetadata ? { schema: schemaMetadata } : void 0); } }; } //#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]; const sourceRecord = require_values.asRecord(sourceVal); const targetRecord = require_values.asRecord(targetVal); if (sourceRecord && targetRecord) mergeInto$1(targetRecord, sourceRecord); else if (Array.isArray(targetVal) && Array.isArray(sourceVal)) target[key] = [...targetVal, ...sourceVal]; else target[key] = sourceVal; } } const requestContextStore = new node_async_hooks.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 = _opentelemetry_api.trace.getActiveSpan(); if (!span) throw new Error("[autotel] getRequestLogger() requires an active span or runWithRequestContext(). Wrap your handler with trace() or use runWithRequestContext()."); return require_init.createTraceContext(span); } function getRequestLogger(ctx, options) { const activeContext = resolveContext(ctx); const contextState = {}; let emitted = false; let lastSnapshot = null; let hasExplicitLevel = false; const addLogEvent = (level, message, fields) => { const attrs = fields ? require_structured_error.flattenToAttributes(fields) : void 0; require_correlated_events.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(require_structured_error.flattenToAttributes(fields)); }, setLevel(level) { sealCheck("log.setLevel()", ["autotel.log.level"]); if (emitted) return; hasExplicitLevel = true; activeContext.setAttribute("autotel.log.level", level); }, info(message, fields) { const keys = fields ? ["message", ...Object.keys(fields).filter((k) => k !== "requestLogs")] : ["message"]; sealCheck("log.info()", keys); if (emitted) return; addLogEvent("info", message, fields); if (fields) { mergeInto$1(contextState, fields); activeContext.setAttributes(require_structured_error.flattenToAttributes(fields)); } }, warn(message, fields) { const keys = fields ? ["message", ...Object.keys(fields).filter((k) => k !== "requestLogs")] : ["message"]; sealCheck("log.warn()", keys); if (emitted) return; addLogEvent("warn", message, fields); if (!hasExplicitLevel) activeContext.setAttribute("autotel.log.level", "warn"); if (fields) { mergeInto$1(contextState, fields); activeContext.setAttributes(require_structured_error.flattenToAttributes(fields)); } }, error(error, fields) { const keys = fields ? [...Object.keys(fields), "error"] : ["error"]; sealCheck("log.error()", keys); if (emitted) return; const err = require_values.toError(error); require_structured_error.recordStructuredError(activeContext, err); addLogEvent("error", err.message, fields); if (fields) { mergeInto$1(contextState, fields); activeContext.setAttributes(require_structured_error.flattenToAttributes(fields)); } if (!hasExplicitLevel) 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 = require_structured_error.flattenToAttributes(mergedContext); activeContext.setAttributes(flattened); const snapshot = { timestamp: (/* @__PURE__ */ new Date()).toISOString(), traceId: activeContext.traceId, spanId: activeContext.spanId, correlationId: activeContext.correlationId, context: mergedContext }; require_correlated_events.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 = require_values.nonEmptyString(activeContext.correlationId); if (parentRequestId === void 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 = _opentelemetry_api.trace.getTracer("autotel.request-logger"); const lifecycle = forkOptions?.lifecycle; tracer.startActiveSpan(`request.fork:${label}`, (childSpan) => { const childContext = { ...require_init.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_) => { childLog.error(require_values.toError(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 _opentelemetry_api.trace.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() {}, setLevel() {}, 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 (!require_values.asRecord(error)) return void 0; const stored = error[catalogCodeKey]; return require_values.asString(stored) ?? require_values.asNumber(stored); } /** 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 messageFor = require_values.asFunction(entry.message); const whyFor = require_values.asFunction(entry.why); const usesParams = Boolean(messageFor || whyFor); const builder = ((paramsOrOptions, maybeOptions) => { const params = usesParams ? paramsOrOptions : void 0; const options = usesParams ? maybeOptions : paramsOrOptions; const message = messageFor ? String(messageFor(params)) : require_values.asString(entry.message) ?? ""; const why = whyFor ? String(whyFor(params)) : require_values.asString(entry.why); const error = require_structured_error.createStructuredError({ message, name: entry.name ?? key, code, status: entry.status, why, fix: entry.fix, link: entry.link, cause: options?.cause, details: options?.details, 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 auditMessageFor = require_values.asFunction(entry.message); const descriptor = ((params) => { const message = auditMessageFor ? String(auditMessageFor(params)) : require_values.asString(entry.message); return Object.freeze({ action, severity, 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 mergeInto(target, source) { for (const key in source) { const sourceVal = source[key]; if (sourceVal === void 0) continue; const sourceRecord = require_values.asRecord(sourceVal); const targetRecord = require_values.asRecord(target[key]); if (sourceRecord && targetRecord) mergeInto(targetRecord, sourceRecord); 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; const event = ctx.event; const existing = require_values.asRecord(event[def.field]); if (options.overwrite || !existing) { event[def.field] = computed; return; } mergeInto(existing, computed); }; } //#endregion exports.AUTOTEL_DEBUG_BAGGAGE_KEY = require_init.AUTOTEL_DEBUG_BAGGAGE_KEY; exports.AUTOTEL_SAMPLING_TAIL_EVALUATED = require_init.AUTOTEL_SAMPLING_TAIL_EVALUATED; exports.AUTOTEL_SAMPLING_TAIL_KEEP = require_init.AUTOTEL_SAMPLING_TAIL_KEEP; exports.AdaptiveSampler = require_init.AdaptiveSampler; exports.AlwaysSampler = require_init.AlwaysSampler; exports.AttributeRedactingProcessor = require_attribute_redacting_processor.AttributeRedactingProcessor; exports.BaggageSpanProcessor = require_init.BaggageSpanProcessor; exports.BusinessBaggage = require_business_baggage.BusinessBaggage; exports.CORRELATION_ID_BAGGAGE_KEY = require_init.CORRELATION_ID_BAGGAGE_KEY; exports.Event = require_init.Event; exports.FilteringSpanProcessor = require_filtering_span_processor.FilteringSpanProcessor; exports.HTTPAttributes = require_registry.HTTPAttributes; exports.Metric = require_metric.Metric; exports.NORMALIZER_PATTERNS = require_span_name_normalizer.NORMALIZER_PATTERNS; exports.NORMALIZER_PRESETS = require_span_name_normalizer.NORMALIZER_PRESETS; exports.NeverSampler = require_init.NeverSampler; exports.REDACTOR_PATTERNS = require_attribute_redacting_processor.REDACTOR_PATTERNS; exports.REDACTOR_PRESETS = require_attribute_redacting_processor.REDACTOR_PRESETS; Object.defineProperty(exports, 'ROOT_CONTEXT', { enumerable: true, get: function () { return _opentelemetry_api.ROOT_CONTEXT; } }); exports.RandomSampler = require_init.RandomSampler; exports.ServiceAttributes = require_registry.ServiceAttributes; Object.defineProperty(exports, 'SpanKind', { enumerable: true, get: function () { return _opentelemetry_api.SpanKind; } }); exports.SpanNameNormalizingProcessor = require_span_name_normalizer.SpanNameNormalizingProcessor; Object.defineProperty(exports, 'SpanStatusCode', { enumerable: true, get: function () { return _opentelemetry_api.SpanStatusCode; } }); exports.URLAttributes = require_registry.URLAttributes; exports.UserIdSampler = require_init.UserIdSampler; exports.attrs = require_attributes.attrs; exports.autoRedactPII = require_attributes.autoRedactPII; exports.builtinPatterns = require_attribute_redacting_processor.builtinPatterns; Object.defineProperty(exports, 'context', { enumerable: true, get: function () { return _opentelemetry_api.context; } }); exports.createAttributeRedactor = require_attribute_redacting_processor.createAttributeRedactor; exports.createCounter = require_metric_helpers.createCounter; exports.createDeterministicTraceId = require_trace_helpers.createDeterministicTraceId; exports.createDrainPipeline = require_drain_pipeline.createDrainPipeline; exports.createHistogram = require_metric_helpers.createHistogram; exports.createLinkFromHeaders = require_init.createLinkFromHeaders; exports.createNoopRequestLogger = createNoopRequestLogger; exports.createObservableGauge = require_metric_helpers.createObservableGauge; exports.createRedactedSpan = require_attribute_redacting_processor.createRedactedSpan; exports.createSafeBaggageSchema = require_business_baggage.createSafeBaggageSchema; exports.createStringRedactor = require_init.createStringRedactor; exports.createStructuredError = require_structured_error.createStructuredError; exports.createUpDownCounter = require_metric_helpers.createUpDownCounter; exports.ctx = require_functional.ctx; exports.dbClient = require_attributes.dbClient; exports.defineAuditCatalog = defineAuditCatalog; exports.defineBaggageSchema = require_init.defineBaggageSchema; exports.defineDrain = defineDrain; exports.defineEnricher = defineEnricher; exports.defineErrorCatalog = defineErrorCatalog; exports.defineEvent = defineEvent; exports.defineHttpDrain = defineHttpDrain; exports.enrichWithTraceContext = require_trace_helpers.enrichWithTraceContext; exports.experiment = experiment; exports.extractLinksFromBatch = require_init.extractLinksFromBatch; exports.finalizeSpan = require_trace_helpers.finalizeSpan; exports.flattenMetadata = require_trace_helpers.flattenMetadata; exports.flattenToAttributes = require_structured_error.flattenToAttributes; exports.flush = require_init.flush; exports.forceKeep = forceKeep; exports.formatDuration = require_canonical_log_line_processor.formatDuration; exports.generateCorrelationId = require_init.generateCorrelationId; exports.getActiveContext = require_trace_helpers.getActiveContext; exports.getActiveSpan = require_trace_helpers.getActiveSpan; exports.getActiveTraceContext = require_functional.getActiveTraceContext; exports.getAutotelTracer = require_tracer_provider.getAutotelTracer; exports.getAutotelTracerProvider = require_tracer_provider.getAutotelTracerProvider; exports.getCatalogCode = getCatalogCode; exports.getCorrelationId = require_init.getCorrelationId; exports.getCurrentWorkflowContext = require_workflow.getCurrentWorkflowContext; exports.getEventQueue = require_init.getEventQueue; exports.getEvents = require_init.getEvents; exports.getMeter = require_metric_helpers.getMeter; exports.getMetrics = require_metric.getMetrics; exports.getOperationContext = require_init.getOperationContext; exports.getOrCreateCorrelationId = require_init.getOrCreateCorrelationId; exports.getRequestLogger = getRequestLogger; exports.getRequestLoggerSafe = getRequestLoggerSafe; exports.getStructuredErrorAttributes = require_structured_error.getStructuredErrorAttributes; exports.getTraceContext = require_trace_helpers.getTraceContext; exports.getTracer = require_trace_helpers.getTracer; exports.hasRequestContext = hasRequestContext; exports.httpClient = require_attributes.httpClient; exports.httpRequestHeaderAttribute = require_semantic_conventions.httpRequestHeaderAttribute; exports.httpResponseHeaderAttribute = require_semantic_conventions.httpResponseHeaderAttribute; exports.httpServer = require_attributes.httpServer; exports.identify = require_attributes.identify; exports.init = require_init.init; exports.instrument = require_functional.instrument; exports.isCatalogError = isCatalogError; exports.isInWorkflow = require_workflow.isInWorkflow; exports.isInitialized = require_init.isInitialized; exports.isLoggerLocked = require_init.isLoggerLocked; exports.isTracing = require_trace_helpers.isTracing; exports.lockLogger = require_init.lockLogger; exports.mergeAttrs = require_attributes.mergeAttrs; exports.mergeServiceResource = require_attributes.mergeServiceResource; exports.normalizeAttributeRedactorConfig = require_attribute_redacting_processor.normalizeAttributeRedactorConfig; Object.defineProperty(exports, 'otelTrace', { enumerable: true, get: function () { return _opentelemetry_api.trace; } }); exports.parseError = require_parse_error.parseError; Object.defineProperty(exports, 'propagation', { enumerable: true, get: function () { return _opentelemetry_api.propagation; } }); exports.recordStructuredError = require_structured_error.recordStructuredError; exports.request = require_attributes.request; exports.requestCtx = require_functional.requestCtx; exports.resetEvents = require_init.resetEvents; exports.resetMetrics = require_metric.resetMetrics; exports.resolveSamplingPreset = require_init.resolveSamplingPreset; exports.resolveTraceUrl = require_trace_helpers.resolveTraceUrl; exports.runInOperationContext = require_init.runInOperationContext; exports.runWithCorrelationId = require_init.runWithCorrelationId; exports.runWithRequestContext = runWithRequestContext; exports.runWithSpan = require_trace_helpers.runWithSpan; exports.safeSetAttributes = require_attributes.safeSetAttributes; exports.samplingPresets = require_init.samplingPresets; exports.setAutotelTracerProvider = require_tracer_provider.setAutotelTracerProvider; exports.setCorrelationId = require_init.setCorrelationId; exports.setCorrelationIdInBaggage = require_init.setCorrelationIdInBaggage; exports.setDevice = require_attributes.setDevice; exports.setError = require_attributes.setError; exports.setException = require_attributes.setException; exports.setSession = require_attributes.setSession; exports.setUser = require_attributes.setUser; exports.shutdown = require_init.shutdown; exports.span = require_functional.span; exports.structuredErrorToJSON = require_structured_error.structuredErrorToJSON; exports.toAttributeValue = require_structured_error.toAttributeValue; exports.trace = trace; exports.traceConsumer = require_messaging.traceConsumer; exports.traceDB = require_semantic_helpers.traceDB; exports.traceHTTP = require_semantic_helpers.traceHTTP; exports.traceMessaging = require_semantic_helpers.traceMessaging; exports.traceProducer = require_messaging.traceProducer; exports.traceStep = require_workflow.traceStep; exports.traceWorkflow = require_workflow.traceWorkflow; exports.track = require_init.track; exports.validateAttribute = require_attributes.validateAttribute; exports.withBaggage = require_functional.withBaggage; exports.withNewContext = require_functional.withNewContext; exports.withTracing = require_functional.withTracing;