@atrim/instrument-node 0.5.0 → 0.5.1
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 +66 -0
- package/package.json +8 -8
- package/target/dist/index.cjs +14 -1
- package/target/dist/index.cjs.map +1 -1
- package/target/dist/index.js +14 -1
- package/target/dist/index.js.map +1 -1
- package/target/dist/integrations/effect/index.cjs +159 -14
- package/target/dist/integrations/effect/index.cjs.map +1 -1
- package/target/dist/integrations/effect/index.d.cts +187 -12
- package/target/dist/integrations/effect/index.d.ts +187 -12
- package/target/dist/integrations/effect/index.js +158 -16
- package/target/dist/integrations/effect/index.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../core/src/instrumentation-schema.ts","../../../../../core/src/errors.ts","../../../../../core/src/services/config-loader.ts","../../../../../core/src/pattern-matcher.ts","../../../../../core/src/logger.ts","../../../../src/core/config-loader.ts","../../../../src/integrations/effect/effect-tracer.ts","../../../../src/integrations/effect/effect-helpers.ts","../../../../src/integrations/effect/fiberset.ts"],"names":["z","Data","Context","Effect","parseYAML","HttpClientRequest","FileSystem","HttpClient","Layer","NodeContext","FetchHttpClient","loader","Otlp","TraceFlags","trace","context","effect","EffectFiberSet","Tracer","isolated"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,IAAM,mBAAA,GAAsBA,MAAE,MAAA,CAAO;AAC1C,EAAA,OAAA,EAASA,MAAE,MAAA,EAAA;EACX,OAAA,EAASA,KAAA,CAAE,OAAA,EAAA,CAAU,QAAA,EAAA;EACrB,WAAA,EAAaA,KAAA,CAAE,MAAA,EAAA,CAAS,QAAA;AAC1B,CAAC,CAAA;AAQM,IAAM,yBAAA,GAA4BA,MAAE,MAAA,CAAO;;AAEhD,EAAA,OAAA,EAASA,KAAA,CAAE,OAAA,EAAA,CAAU,OAAA,CAAQ,KAAK,CAAA;;AAGlC,EAAA,SAAA,EAAWA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AAA,CAAe,IAAA;AAAA,EACrB,SAASA,eAAA,CAAe,OAAA;AAAA,EACxB,gBAAgBA,eAAA,CAAe,cAAA;AAAA,EAC/B,aAAaA,eAAA,CAAe,WAAA;AAAA,EAC5B,oBAAoBA,eAAA,CAAe,kBAAA;AAAA,EACnC,YAAYA,eAAA,CAAe,UAAA;AAAA;AAAA,EAG3B,WAAA;AAAA,EACA;AACF","file":"index.cjs","sourcesContent":["/**\n * Configuration schema using Zod\n */\nimport { z } from 'zod'\n\nexport const PatternConfigSchema = z.object({\n pattern: z.string(),\n enabled: z.boolean().optional(),\n description: z.string().optional()\n})\n\n/**\n * Configuration for automatic span isolation in Effect operations\n *\n * This prevents context leakage when using FiberSet.run, Effect.fork, etc.\n * while maintaining logical parent relationships via span links.\n */\nexport const AutoIsolationConfigSchema = z.object({\n // Global enable/disable for auto-isolation\n enabled: z.boolean().default(false),\n\n // Which operators to auto-isolate\n operators: z\n .object({\n fiberset_run: z.boolean().default(true),\n effect_fork: z.boolean().default(true),\n effect_fork_daemon: z.boolean().default(true),\n effect_fork_in: z.boolean().default(false)\n })\n .default({}),\n\n // Virtual parent tracking configuration\n tracking: z\n .object({\n use_span_links: z.boolean().default(true),\n use_attributes: z.boolean().default(true),\n capture_logical_parent: z.boolean().default(true)\n })\n .default({}),\n\n // Span categorization\n attributes: z\n .object({\n category: z.string().default('background_task'),\n add_metadata: z.boolean().default(true)\n })\n .default({})\n})\n\n/**\n * HTTP instrumentation filtering configuration\n *\n * Allows filtering of HTTP requests to prevent noisy traces\n * (e.g., health checks, OTLP exports, internal endpoints)\n */\nexport const HttpFilteringConfigSchema = z.object({\n // Patterns to ignore for outgoing HTTP requests (string patterns only in YAML)\n ignore_outgoing_urls: z.array(z.string()).optional(),\n\n // Patterns to ignore for incoming HTTP requests (string patterns only in YAML)\n ignore_incoming_paths: z.array(z.string()).optional(),\n\n // Require parent span for outgoing requests (prevents root spans for HTTP calls)\n require_parent_for_outgoing_spans: z.boolean().optional()\n})\n\nexport const InstrumentationConfigSchema = z.object({\n version: z.string(),\n instrumentation: z.object({\n enabled: z.boolean(),\n description: z.string().optional(),\n logging: z.enum(['on', 'off', 'minimal']).optional().default('on'),\n instrument_patterns: z.array(PatternConfigSchema),\n ignore_patterns: z.array(PatternConfigSchema)\n }),\n effect: z\n .object({\n auto_extract_metadata: z.boolean(),\n auto_isolation: AutoIsolationConfigSchema.optional()\n })\n .optional(),\n http: HttpFilteringConfigSchema.optional()\n})\n\nexport type InstrumentationConfig = z.infer<typeof InstrumentationConfigSchema>\nexport type PatternConfig = z.infer<typeof PatternConfigSchema>\nexport type AutoIsolationConfig = z.infer<typeof AutoIsolationConfigSchema>\nexport type HttpFilteringConfig = z.infer<typeof HttpFilteringConfigSchema>\n","/**\n * Typed error hierarchy for @atrim/instrumentation\n *\n * These errors use Effect's Data.TaggedError for typed error handling\n * with proper discriminated unions.\n */\n\nimport { Data } from 'effect'\n\n/**\n * Base error for configuration-related failures\n */\nexport class ConfigError extends Data.TaggedError('ConfigError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n\n/**\n * Error when fetching configuration from a URL fails\n */\nexport class ConfigUrlError extends Data.TaggedError('ConfigUrlError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n\n/**\n * Error when configuration validation fails (invalid YAML, schema mismatch)\n */\nexport class ConfigValidationError extends Data.TaggedError('ConfigValidationError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n\n/**\n * Error when reading configuration from a file fails\n */\nexport class ConfigFileError extends Data.TaggedError('ConfigFileError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n\n/**\n * Error when service detection fails (package.json not found, invalid format)\n */\nexport class ServiceDetectionError extends Data.TaggedError('ServiceDetectionError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n\n/**\n * Error when OpenTelemetry SDK initialization fails\n */\nexport class InitializationError extends Data.TaggedError('InitializationError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n\n/**\n * Error when span export fails (e.g., ECONNREFUSED to collector)\n */\nexport class ExportError extends Data.TaggedError('ExportError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n\n/**\n * Error when shutting down the SDK fails\n */\nexport class ShutdownError extends Data.TaggedError('ShutdownError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n","/**\n * ConfigLoader service using Effect Platform\n *\n * Provides URI-based configuration loading with pluggable platform services:\n * - FileSystem for file:// URIs (Node.js/Bun/Deno)\n * - HttpClient for http:// and https:// URIs (universal)\n *\n * This service has NO Node.js-specific dependencies - it depends only on\n * abstract Effect Platform services that are provided by environment-specific layers.\n */\n\nimport { Effect, Context, Layer } from 'effect'\nimport { FileSystem } from '@effect/platform/FileSystem'\nimport * as HttpClient from '@effect/platform/HttpClient'\nimport * as HttpClientRequest from '@effect/platform/HttpClientRequest'\nimport { parse as parseYAML } from 'yaml'\nimport {\n InstrumentationConfigSchema,\n type InstrumentationConfig\n} from '../instrumentation-schema.js'\nimport { ConfigError, ConfigFileError, ConfigUrlError, ConfigValidationError } from '../errors.js'\n\n// Security constraints\nconst SECURITY_DEFAULTS = {\n maxConfigSize: 1_000_000, // 1MB\n requestTimeout: 5_000 // 5 seconds\n} as const\n\n/**\n * ConfigLoader service interface\n */\nexport interface ConfigLoaderService {\n /**\n * Load configuration from a URI\n *\n * Supports:\n * - file:// URIs (uses FileSystem if available)\n * - http:// and https:// URIs (uses HttpClient)\n * - Relative paths (treated as file:// in Node, http:// in browser)\n *\n * @param uri - Configuration URI\n * @returns Effect that resolves to validated configuration (NO requirements)\n */\n readonly loadFromUri: (\n uri: string\n ) => Effect.Effect<\n InstrumentationConfig,\n ConfigError | ConfigFileError | ConfigUrlError | ConfigValidationError\n >\n\n /**\n * Load configuration from inline content (YAML, JSON, or object)\n *\n * @param content - YAML string, JSON string, or plain object\n * @returns Effect that resolves to validated configuration\n */\n readonly loadFromInline: (\n content: string | unknown\n ) => Effect.Effect<InstrumentationConfig, ConfigError | ConfigValidationError>\n}\n\n/**\n * ConfigLoader service tag\n */\nexport class ConfigLoader extends Context.Tag('ConfigLoader')<\n ConfigLoader,\n ConfigLoaderService\n>() {}\n\n/**\n * Parse and validate YAML content\n */\nconst parseYamlContent = (\n content: string,\n uri?: string\n): Effect.Effect<InstrumentationConfig, ConfigValidationError> =>\n Effect.gen(function* () {\n // Parse YAML\n const parsed = yield* Effect.try({\n try: () => parseYAML(content),\n catch: (error) =>\n new ConfigValidationError({\n reason: uri ? `Failed to parse YAML from ${uri}` : 'Failed to parse YAML',\n cause: error\n })\n })\n\n // Validate schema\n return yield* Effect.try({\n try: () => InstrumentationConfigSchema.parse(parsed),\n catch: (error) =>\n new ConfigValidationError({\n reason: uri ? `Invalid configuration schema from ${uri}` : 'Invalid configuration schema',\n cause: error\n })\n })\n })\n\n/**\n * Load configuration from file using captured FileSystem service\n */\nconst loadFromFileWithFs = (\n fs: FileSystem,\n path: string,\n uri: string\n): Effect.Effect<InstrumentationConfig, ConfigFileError | ConfigValidationError> =>\n Effect.gen(function* () {\n // Read file\n const content = yield* fs.readFileString(path).pipe(\n Effect.mapError(\n (error) =>\n new ConfigFileError({\n reason: `Failed to read config file at ${uri}`,\n cause: error\n })\n )\n )\n\n // Security: Check file size\n if (content.length > SECURITY_DEFAULTS.maxConfigSize) {\n return yield* Effect.fail(\n new ConfigFileError({\n reason: `Config file exceeds maximum size of ${SECURITY_DEFAULTS.maxConfigSize} bytes`\n })\n )\n }\n\n // Parse and validate\n return yield* parseYamlContent(content, uri)\n })\n\n/**\n * Load configuration from http using captured HttpClient service\n */\nconst loadFromHttpWithClient = (\n client: HttpClient.HttpClient,\n url: string\n): Effect.Effect<InstrumentationConfig, ConfigUrlError | ConfigValidationError> =>\n Effect.scoped(\n Effect.gen(function* () {\n // Security: Reject non-HTTPS URLs\n if (url.startsWith('http://')) {\n return yield* Effect.fail(\n new ConfigUrlError({\n reason: 'Insecure protocol: only HTTPS URLs are allowed'\n })\n )\n }\n\n // Create request\n const request = HttpClientRequest.get(url).pipe(\n HttpClientRequest.setHeaders({\n Accept: 'application/yaml, text/yaml, application/x-yaml'\n })\n )\n\n // Execute request with timeout\n const response = yield* client.execute(request).pipe(\n Effect.timeout(`${SECURITY_DEFAULTS.requestTimeout} millis`),\n Effect.mapError((error) => {\n if (error._tag === 'TimeoutException') {\n return new ConfigUrlError({\n reason: `Config fetch timeout after ${SECURITY_DEFAULTS.requestTimeout}ms from ${url}`\n })\n }\n return new ConfigUrlError({\n reason: `Failed to load config from URL: ${url}`,\n cause: error\n })\n })\n )\n\n // Check HTTP status\n if (response.status >= 400) {\n return yield* Effect.fail(\n new ConfigUrlError({\n reason: `HTTP ${response.status} from ${url}`\n })\n )\n }\n\n // Get response text\n const text = yield* response.text.pipe(\n Effect.mapError(\n (error) =>\n new ConfigUrlError({\n reason: `Failed to read response body from ${url}`,\n cause: error\n })\n )\n )\n\n // Security: Check size\n if (text.length > SECURITY_DEFAULTS.maxConfigSize) {\n return yield* Effect.fail(\n new ConfigUrlError({\n reason: `Config exceeds maximum size of ${SECURITY_DEFAULTS.maxConfigSize} bytes`\n })\n )\n }\n\n // Parse and validate\n return yield* parseYamlContent(text, url)\n })\n )\n\n/**\n * ConfigLoader service implementation\n *\n * Captures FileSystem and HttpClient dependencies at construction time\n */\nconst makeConfigLoader = Effect.gen(function* () {\n // Capture dependencies at construction time\n const fs = yield* Effect.serviceOption(FileSystem)\n const http = yield* HttpClient.HttpClient\n\n // Create the loadFromUri function\n const loadFromUriUncached = (uri: string) =>\n Effect.gen(function* () {\n // file:// protocol\n if (uri.startsWith('file://')) {\n const path = uri.slice(7) // Remove \"file://\"\n\n if (fs._tag === 'None') {\n return yield* Effect.fail(\n new ConfigFileError({\n reason: 'FileSystem not available (browser environment?)',\n cause: { uri }\n })\n )\n }\n\n return yield* loadFromFileWithFs(fs.value, path, uri)\n }\n\n // http:// or https:// protocol\n if (uri.startsWith('http://') || uri.startsWith('https://')) {\n return yield* loadFromHttpWithClient(http, uri)\n }\n\n // Relative path - try FileSystem first, fallback to HTTP\n if (fs._tag === 'Some') {\n // FileSystem available (Node.js environment)\n return yield* loadFromFileWithFs(fs.value, uri, uri)\n } else {\n // No FileSystem (browser environment) - treat as HTTP\n // Relative URLs will be resolved by browser fetch to current origin\n return yield* loadFromHttpWithClient(http, uri)\n }\n })\n\n // Cache the loadFromUri function with 5 minute TTL (default cache timeout)\n const loadFromUriCached = yield* Effect.cachedFunction(loadFromUriUncached)\n\n return ConfigLoader.of({\n loadFromUri: loadFromUriCached,\n\n loadFromInline: (content: string | unknown) =>\n Effect.gen(function* () {\n // If string, parse as YAML\n if (typeof content === 'string') {\n return yield* parseYamlContent(content)\n }\n\n // Already an object - just validate schema\n return yield* Effect.try({\n try: () => InstrumentationConfigSchema.parse(content),\n catch: (error) =>\n new ConfigValidationError({\n reason: 'Invalid configuration schema',\n cause: error\n })\n })\n })\n })\n})\n\n/**\n * ConfigLoader Live layer\n *\n * Provides ConfigLoader service implementation.\n * Requires HttpClient to be provided by platform-specific layers.\n * FileSystem is optional (for browser compatibility).\n */\nexport const ConfigLoaderLive = Layer.effect(ConfigLoader, makeConfigLoader)\n","/**\n * Pattern matching utilities\n *\n * Implements efficient pattern-based span filtering with caching.\n *\n * Matching rules:\n * 1. Check ignore patterns first (takes precedence)\n * 2. Check instrument patterns second\n * 3. Default behavior: If no patterns match, span is created (fail-open)\n */\n\nimport type { InstrumentationConfig, PatternConfig } from './instrumentation-schema.js'\n\n/**\n * Compiled pattern with metadata\n */\ninterface CompiledPattern {\n regex: RegExp\n enabled: boolean\n description?: string\n}\n\n/**\n * Pattern matcher with compiled regex cache\n */\nexport class PatternMatcher {\n private ignorePatterns: CompiledPattern[] = []\n private instrumentPatterns: CompiledPattern[] = []\n private enabled: boolean = true\n\n constructor(config: InstrumentationConfig) {\n this.enabled = config.instrumentation.enabled\n\n // Compile ignore patterns (highest priority)\n this.ignorePatterns = config.instrumentation.ignore_patterns.map((p) => this.compilePattern(p))\n\n // Compile instrument patterns\n this.instrumentPatterns = config.instrumentation.instrument_patterns\n .filter((p) => p.enabled !== false) // Filter out disabled patterns\n .map((p) => this.compilePattern(p))\n }\n\n /**\n * Compile a pattern configuration into a RegExp\n */\n private compilePattern(pattern: PatternConfig): CompiledPattern {\n try {\n const compiled: CompiledPattern = {\n regex: new RegExp(pattern.pattern),\n enabled: pattern.enabled !== false\n }\n if (pattern.description !== undefined) {\n compiled.description = pattern.description\n }\n return compiled\n } catch (error) {\n throw new Error(\n `Failed to compile pattern \"${pattern.pattern}\": ${error instanceof Error ? error.message : String(error)}`\n )\n }\n }\n\n /**\n * Check if a span should be instrumented\n *\n * Returns true if the span should be created, false otherwise.\n *\n * Logic:\n * 1. If instrumentation disabled globally, return false\n * 2. Check ignore patterns - if any match, return false\n * 3. Check instrument patterns - if any match, return true\n * 4. Default: return true (fail-open - create span if no patterns match)\n */\n shouldInstrument(spanName: string): boolean {\n // Global disable\n if (!this.enabled) {\n return false\n }\n\n // Check ignore patterns first (highest priority)\n for (const pattern of this.ignorePatterns) {\n if (pattern.regex.test(spanName)) {\n return false\n }\n }\n\n // Check instrument patterns\n for (const pattern of this.instrumentPatterns) {\n if (pattern.enabled && pattern.regex.test(spanName)) {\n return true\n }\n }\n\n // Default: fail-open (create span if no patterns match)\n // This ensures backward compatibility and doesn't break existing instrumentation\n return true\n }\n\n /**\n * Get statistics about pattern matching (for debugging/monitoring)\n */\n getStats(): {\n enabled: boolean\n ignorePatternCount: number\n instrumentPatternCount: number\n } {\n return {\n enabled: this.enabled,\n ignorePatternCount: this.ignorePatterns.length,\n instrumentPatternCount: this.instrumentPatterns.filter((p) => p.enabled).length\n }\n }\n}\n\n// Global pattern matcher instance\nlet globalMatcher: PatternMatcher | null = null\n\n/**\n * Initialize the global pattern matcher\n */\nexport function initializePatternMatcher(config: InstrumentationConfig): void {\n globalMatcher = new PatternMatcher(config)\n}\n\n/**\n * Check if a span should be instrumented (uses global matcher)\n *\n * This is a convenience function for use without direct access to the matcher instance.\n * If no matcher is initialized, defaults to true (fail-open).\n */\nexport function shouldInstrumentSpan(spanName: string): boolean {\n if (!globalMatcher) {\n // No matcher initialized - fail open\n return true\n }\n return globalMatcher.shouldInstrument(spanName)\n}\n\n/**\n * Get the global pattern matcher (for advanced use cases)\n */\nexport function getPatternMatcher(): PatternMatcher | null {\n return globalMatcher\n}\n\n/**\n * Clear the global pattern matcher (useful for testing)\n */\nexport function clearPatternMatcher(): void {\n globalMatcher = null\n}\n","/**\n * Centralized logging utility for @atrim/instrumentation\n *\n * Supports three levels:\n * - 'on' (default): All logging enabled\n * - 'minimal': Only a single initialization message + errors/warnings\n * - 'off': No logging at all\n */\n\nexport type LogLevel = 'on' | 'off' | 'minimal'\n\nclass Logger {\n private level: LogLevel = 'on'\n private hasLoggedMinimal = false\n\n /**\n * Set the logging level\n */\n setLevel(level: LogLevel): void {\n this.level = level\n this.hasLoggedMinimal = false\n }\n\n /**\n * Get the current logging level\n */\n getLevel(): LogLevel {\n return this.level\n }\n\n /**\n * Log a minimal initialization message (only shown once in minimal mode)\n */\n minimal(message: string): void {\n if (this.level === 'off') {\n return\n }\n\n if (this.level === 'minimal' && !this.hasLoggedMinimal) {\n console.log(message)\n this.hasLoggedMinimal = true\n return\n }\n\n if (this.level === 'on') {\n console.log(message)\n }\n }\n\n /**\n * Log an informational message\n */\n log(...args: unknown[]): void {\n if (this.level === 'on') {\n console.log(...args)\n }\n }\n\n /**\n * Log a warning message (shown in minimal mode)\n */\n warn(...args: unknown[]): void {\n if (this.level !== 'off') {\n console.warn(...args)\n }\n }\n\n /**\n * Log an error message (shown in minimal mode)\n */\n error(...args: unknown[]): void {\n if (this.level !== 'off') {\n console.error(...args)\n }\n }\n\n /**\n * Check if full logging is enabled\n */\n isEnabled(): boolean {\n return this.level === 'on'\n }\n\n /**\n * Check if minimal logging is enabled\n */\n isMinimal(): boolean {\n return this.level === 'minimal'\n }\n\n /**\n * Check if logging is completely disabled\n */\n isDisabled(): boolean {\n return this.level === 'off'\n }\n}\n\n// Singleton instance\nexport const logger = new Logger()\n","/**\n * Node.js configuration loader using Effect Platform\n *\n * Provides FileSystem and HttpClient layers for the core ConfigLoader service\n */\n\nimport { Effect, Layer } from 'effect'\nimport { NodeContext } from '@effect/platform-node'\nimport { FetchHttpClient } from '@effect/platform'\nimport {\n ConfigLoader,\n ConfigLoaderLive,\n type InstrumentationConfig,\n type ConfigLoaderService\n} from '@atrim/instrument-core'\n\n/**\n * Complete ConfigLoader layer with all Node.js platform dependencies\n *\n * Provides:\n * - ConfigLoader service\n * - FileSystem (from NodeContext)\n * - HttpClient (from FetchHttpClient)\n */\nexport const NodeConfigLoaderLive = ConfigLoaderLive.pipe(\n Layer.provide(Layer.mergeAll(NodeContext.layer, FetchHttpClient.layer))\n)\n\n/**\n * Singleton cached config loader for sharing cache across calls\n */\nlet cachedLoaderPromise: Promise<ConfigLoaderService> | null = null\n\nfunction getCachedLoader(): Promise<ConfigLoaderService> {\n if (!cachedLoaderPromise) {\n cachedLoaderPromise = Effect.runPromise(\n Effect.gen(function* () {\n return yield* ConfigLoader\n }).pipe(Effect.provide(NodeConfigLoaderLive))\n )\n }\n return cachedLoaderPromise\n}\n\n/**\n * Reset the cached loader (for testing purposes)\n * @internal\n */\nexport function _resetConfigLoaderCache(): void {\n cachedLoaderPromise = null\n}\n\n/**\n * Load configuration from URI (Promise-based convenience API)\n *\n * Automatically provides Node.js platform layers (FileSystem + HttpClient)\n *\n * @param uri - Configuration URI (file://, http://, https://, or relative path)\n * @param options - Optional loading options (e.g., to disable caching)\n * @returns Promise that resolves to validated configuration\n */\nexport async function loadConfig(\n uri: string,\n options?: { cacheTimeout?: number }\n): Promise<InstrumentationConfig> {\n // If cacheTimeout is 0, bypass cache\n if (options?.cacheTimeout === 0) {\n const program = Effect.gen(function* () {\n const loader = yield* ConfigLoader\n return yield* loader.loadFromUri(uri)\n })\n return Effect.runPromise(program.pipe(Effect.provide(NodeConfigLoaderLive)))\n }\n\n const loader = await getCachedLoader()\n return Effect.runPromise(loader.loadFromUri(uri))\n}\n\n/**\n * Load configuration from inline content (Promise-based convenience API)\n *\n * @param content - YAML string, JSON string, or plain object\n * @returns Promise that resolves to validated configuration\n */\nexport async function loadConfigFromInline(\n content: string | unknown\n): Promise<InstrumentationConfig> {\n const loader = await getCachedLoader()\n return Effect.runPromise(loader.loadFromInline(content))\n}\n\n/**\n * Legacy options interface for backward compatibility\n */\nexport interface ConfigLoaderOptions {\n configPath?: string\n configUrl?: string\n config?: InstrumentationConfig\n cacheTimeout?: number\n}\n\n/**\n * Get default configuration\n */\nfunction getDefaultConfig(): InstrumentationConfig {\n return {\n version: '1.0',\n instrumentation: {\n enabled: true,\n logging: 'on',\n description: 'Default instrumentation configuration',\n instrument_patterns: [\n { pattern: '^app\\\\.', enabled: true, description: 'Application operations' },\n { pattern: '^http\\\\.server\\\\.', enabled: true, description: 'HTTP server operations' },\n { pattern: '^http\\\\.client\\\\.', enabled: true, description: 'HTTP client operations' }\n ],\n ignore_patterns: [\n { pattern: '^test\\\\.', description: 'Test utilities' },\n { pattern: '^internal\\\\.', description: 'Internal operations' },\n { pattern: '^health\\\\.', description: 'Health checks' }\n ]\n },\n effect: {\n auto_extract_metadata: true\n }\n }\n}\n\n/**\n * Load configuration with priority order (backward compatible API)\n *\n * Priority order (highest to lowest):\n * 1. Explicit config object (options.config)\n * 2. Environment variable (ATRIM_INSTRUMENTATION_CONFIG)\n * 3. Explicit path/URL (options.configPath or options.configUrl)\n * 4. Project root file (./instrumentation.yaml)\n * 5. Default config (built-in defaults)\n *\n * @param options - Configuration options\n * @returns Promise that resolves to validated configuration\n */\nexport async function loadConfigWithOptions(\n options: ConfigLoaderOptions = {}\n): Promise<InstrumentationConfig> {\n // Extract cacheTimeout option\n const loadOptions =\n options.cacheTimeout !== undefined ? { cacheTimeout: options.cacheTimeout } : undefined\n\n // Priority 1: Explicit config object\n if (options.config) {\n return loadConfigFromInline(options.config)\n }\n\n // Priority 2: Environment variable\n const envConfigPath = process.env.ATRIM_INSTRUMENTATION_CONFIG\n if (envConfigPath) {\n return loadConfig(envConfigPath, loadOptions)\n }\n\n // Priority 3: Explicit options\n if (options.configUrl) {\n return loadConfig(options.configUrl, loadOptions)\n }\n if (options.configPath) {\n return loadConfig(options.configPath, loadOptions)\n }\n\n // Priority 4: Project root file\n const { existsSync } = await import('fs')\n const { join } = await import('path')\n\n const defaultPath = join(process.cwd(), 'instrumentation.yaml')\n if (existsSync(defaultPath)) {\n return loadConfig(defaultPath, loadOptions)\n }\n\n // Priority 5: Default config\n return getDefaultConfig()\n}\n","/**\n * Effect-TS Tracer integration with context propagation\n *\n * This module provides Effect-TS tracing that seamlessly integrates with\n * OpenTelemetry NodeSDK auto-instrumentation. Effect spans will automatically\n * continue existing traces created by NodeSDK (e.g., HTTP requests).\n *\n * Context Propagation:\n * - NodeSDK auto-instrumentation creates root spans (e.g., HTTP requests)\n * - Effect operations automatically become child spans of the active trace\n * - Uses OpenTelemetry Context API (equivalent to Java thread-local)\n * - No configuration needed - works out of the box\n *\n * Architecture:\n * 1. @effect/opentelemetry uses the global OpenTelemetry tracer provider\n * 2. When an Effect operation starts, it checks context.active() for existing spans\n * 3. If found, creates child spans. If not, creates new root span.\n * 4. This happens automatically via OpenTelemetry Context propagation\n */\n\nimport { Effect, Layer, Tracer } from 'effect'\nimport type { Tracer as EffectTracer } from 'effect'\nimport * as Otlp from '@effect/opentelemetry/Otlp'\nimport { FetchHttpClient } from '@effect/platform'\nimport { context, trace, type SpanContext, TraceFlags } from '@opentelemetry/api'\nimport { initializePatternMatcher, logger } from '@atrim/instrument-core'\nimport { loadConfigWithOptions, type ConfigLoaderOptions } from '../../core/config-loader.js'\n\n/**\n * Configuration options for Effect instrumentation\n */\nexport interface EffectInstrumentationOptions extends ConfigLoaderOptions {\n /**\n * OTLP endpoint URL\n * @default process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318'\n */\n otlpEndpoint?: string\n\n /**\n * Service name\n * @default process.env.OTEL_SERVICE_NAME || 'effect-service'\n */\n serviceName?: string\n\n /**\n * Service version\n * @default process.env.npm_package_version || '1.0.0'\n */\n serviceVersion?: string\n\n /**\n * Whether to automatically extract Effect fiber metadata\n * @default true\n */\n autoExtractMetadata?: boolean\n\n /**\n * Whether to continue existing traces from NodeSDK auto-instrumentation\n *\n * When true (default):\n * - Effect spans become children of existing NodeSDK spans\n * - Example: HTTP request span → Effect business logic span\n * - Uses OpenTelemetry Context API for propagation\n *\n * When false:\n * - Effect operations always create new root spans\n * - Not recommended unless you have specific requirements\n *\n * @default true\n */\n continueExistingTraces?: boolean\n}\n\n/**\n * Create Effect instrumentation layer with custom options\n *\n * This function creates an Effect Layer that provides OpenTelemetry tracing\n * with automatic context propagation from NodeSDK auto-instrumentation.\n *\n * @example\n * ```typescript\n * // With NodeSDK auto-instrumentation\n * import { NodeSDK } from '@opentelemetry/sdk-node'\n * import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'\n *\n * // 1. Start NodeSDK (creates HTTP spans automatically)\n * const sdk = new NodeSDK({\n * instrumentations: [getNodeAutoInstrumentations()]\n * })\n * sdk.start()\n *\n * // 2. Create Effect instrumentation (will continue NodeSDK traces)\n * const EffectLayer = createEffectInstrumentation()\n *\n * // 3. Use in Effect operations\n * const program = Effect.gen(function* () {\n * // This span will be a child of the HTTP request span (if any)\n * yield* Effect.log(\"Business logic\")\n * }).pipe(\n * Effect.withSpan(\"app.business.logic\"),\n * Effect.provide(EffectLayer)\n * )\n * ```\n */\nexport function createEffectInstrumentation(options: EffectInstrumentationOptions = {}) {\n return Layer.unwrapEffect(\n Effect.gen(function* () {\n // 1. Load configuration\n const config = yield* Effect.tryPromise({\n try: () => loadConfigWithOptions(options),\n catch: (error) => ({\n _tag: 'ConfigError' as const,\n message: error instanceof Error ? error.message : String(error)\n })\n })\n\n // 2. Configure logger based on config\n yield* Effect.sync(() => {\n const loggingLevel = config.instrumentation.logging || 'on'\n logger.setLevel(loggingLevel)\n })\n\n // 3. Initialize pattern matcher\n yield* Effect.sync(() => initializePatternMatcher(config))\n\n // 4. Extract options with defaults\n const otlpEndpoint =\n options.otlpEndpoint || process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318'\n\n const serviceName = options.serviceName || process.env.OTEL_SERVICE_NAME || 'effect-service'\n\n const serviceVersion = options.serviceVersion || process.env.npm_package_version || '1.0.0'\n\n const autoExtractMetadata =\n options.autoExtractMetadata ?? config.effect?.auto_extract_metadata ?? true\n\n const continueExistingTraces = options.continueExistingTraces ?? true\n\n logger.log('🔍 Effect OpenTelemetry instrumentation')\n logger.log(` 📡 Endpoint: ${otlpEndpoint}`)\n logger.log(` 🏷️ Service: ${serviceName}`)\n logger.log(` ✅ Auto metadata extraction: ${autoExtractMetadata}`)\n logger.log(` ✅ Continue existing traces: ${continueExistingTraces}`)\n\n // 5. Create Otlp layer for Effect operations\n // CRITICAL: Uses tracerContext callback to bridge Effect spans to OpenTelemetry context\n // This allows bidirectional context propagation:\n // - NodeSDK spans → Effect spans (child relationship)\n // - Effect spans → NodeSDK spans (subsequent auto-instrumented calls)\n const otlpLayer = Otlp.layer({\n baseUrl: otlpEndpoint,\n resource: {\n serviceName,\n serviceVersion,\n attributes: {\n 'platform.component': 'effect',\n 'effect.auto_metadata': autoExtractMetadata,\n 'effect.context_propagation': continueExistingTraces\n }\n },\n // Bridge Effect context to OpenTelemetry global context\n // This is essential for context propagation to work properly\n tracerContext: <X>(f: () => X, span: Tracer.AnySpan): X => {\n // Only bridge actual Effect spans (not ExternalSpan)\n if (span._tag !== 'Span') {\n return f()\n }\n\n // Create OpenTelemetry SpanContext from Effect span metadata\n const spanContext: SpanContext = {\n traceId: span.traceId,\n spanId: span.spanId,\n traceFlags: span.sampled ? TraceFlags.SAMPLED : TraceFlags.NONE\n }\n\n // Create a non-recording span to represent the Effect span in OTel context\n const otelSpan = trace.wrapSpanContext(spanContext)\n\n // Set as active span in OpenTelemetry global context\n return context.with(trace.setSpan(context.active(), otelSpan), f)\n }\n }).pipe(Layer.provide(FetchHttpClient.layer))\n\n // 6. If auto-metadata extraction is enabled, add a layer that extracts\n // Effect fiber metadata for each span\n if (autoExtractMetadata) {\n // TODO: Implement metadata extraction layer\n // For now, just return the base Otlp layer\n return otlpLayer\n }\n\n return otlpLayer\n })\n ).pipe(Layer.orDie)\n}\n\n/**\n * Zero-config Effect instrumentation layer\n *\n * Uses the global OpenTelemetry tracer provider that was set up by\n * initializeInstrumentation(). This ensures all traces (Express, Effect, etc.)\n * go to the same OTLP endpoint.\n *\n * Context Propagation:\n * - Automatically continues traces from NodeSDK auto-instrumentation\n * - Effect spans become children of HTTP request spans\n * - No configuration needed\n *\n * @example\n * ```typescript\n * import { EffectInstrumentationLive } from '@atrim/instrumentation/effect'\n *\n * const program = Effect.gen(function* () {\n * // This span continues any existing trace from NodeSDK\n * yield* Effect.log(\"Processing\")\n * }).pipe(\n * Effect.withSpan(\"app.process\"),\n * Effect.provide(EffectInstrumentationLive)\n * )\n * ```\n */\nexport const EffectInstrumentationLive = Effect.sync(() => {\n const endpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318'\n const serviceName = process.env.OTEL_SERVICE_NAME || 'effect-service'\n const serviceVersion = process.env.npm_package_version || '1.0.0'\n\n logger.minimal(`@atrim/instrumentation/effect: Effect tracing enabled (${serviceName})`)\n logger.log('🔍 Effect OpenTelemetry tracer')\n logger.log(` 📡 Endpoint: ${endpoint}`)\n logger.log(` 🏷️ Service: ${serviceName}`)\n\n // Use Otlp.layer() like atrim platform\n // This creates Effect-specific spans that get exported via OTLP\n return Otlp.layer({\n baseUrl: endpoint,\n resource: {\n serviceName,\n serviceVersion,\n attributes: {\n 'platform.component': 'effect'\n }\n },\n // CRITICAL: Bridge Effect context to OpenTelemetry global context\n // This allows NodeSDK auto-instrumentation to see Effect spans as parent spans\n tracerContext: <X>(f: () => X, span: EffectTracer.AnySpan): X => {\n // Only bridge actual Effect spans (not ExternalSpan)\n if (span._tag !== 'Span') {\n return f()\n }\n\n // Create OpenTelemetry SpanContext from Effect span metadata\n const spanContext: SpanContext = {\n traceId: span.traceId,\n spanId: span.spanId,\n traceFlags: span.sampled ? TraceFlags.SAMPLED : TraceFlags.NONE\n }\n\n // Create a non-recording span to represent the Effect span in OTel context\n const otelSpan = trace.wrapSpanContext(spanContext)\n\n // Set as active span in OpenTelemetry global context\n return context.with(trace.setSpan(context.active(), otelSpan), f)\n }\n }).pipe(Layer.provide(FetchHttpClient.layer))\n}).pipe(Layer.unwrapEffect)\n","/**\n * Effect-specific span annotation helpers\n */\n\nexport function annotateUser(_userId: string, _email?: string): void {\n // TODO: Implement\n}\n\nexport function annotateDataSize(_bytes: number, _count: number): void {\n // TODO: Implement\n}\n\nexport function annotateBatch(_size: number, _batchSize: number): void {\n // TODO: Implement\n}\n\nexport function annotateLLM(\n _model: string,\n _operation: string,\n _inputTokens: number,\n _outputTokens: number\n): void {\n // TODO: Implement\n}\n\nexport function annotateQuery(_query: string, _database: string): void {\n // TODO: Implement\n}\n\nexport function annotateHttpRequest(_method: string, _url: string, _statusCode: number): void {\n // TODO: Implement\n}\n\nexport function annotateError(\n _error: Error,\n _context?: Record<string, string | number | boolean>\n): void {\n // TODO: Implement\n}\n\nexport function annotatePriority(_priority: string): void {\n // TODO: Implement\n}\n\nexport function annotateCache(_operation: string, _hit: boolean): void {\n // TODO: Implement\n}\n","/**\n * FiberSet helpers with automatic span isolation and virtual parent tracking\n *\n * Provides wrappers around Effect's FiberSet.run that automatically:\n * 1. Isolate span context (prevent leakage via { root: true })\n * 2. Track logical parent via OpenTelemetry span links\n * 3. Add custom attributes as universal fallback\n *\n * @module\n */\n\nimport { Effect, FiberSet as EffectFiberSet, Tracer } from 'effect'\nimport type { RuntimeFiber } from 'effect/Fiber'\n\n/**\n * Options for span isolation when running effects in FiberSet\n */\nexport interface IsolationOptions {\n /**\n * Whether to create a root span (breaks parent chain)\n * @default true (from config or this default)\n */\n readonly createRoot?: boolean\n\n /**\n * Capture logical parent relationship via span links and attributes\n * @default true\n */\n readonly captureLogicalParent?: boolean\n\n /**\n * Use OpenTelemetry span links to track logical parent\n * Works in: Honeycomb, Datadog, Lightstep, SigNoz, Splunk\n * @default true\n */\n readonly useSpanLinks?: boolean\n\n /**\n * Add custom attributes for logical parent tracking\n * Works in: ALL observability tools (universal fallback)\n * @default true\n */\n readonly useAttributes?: boolean\n\n /**\n * Propagate interruption from parent\n * @default undefined (FiberSet.run default behavior)\n */\n readonly propagateInterruption?: boolean\n\n /**\n * Custom span attributes to add\n */\n readonly attributes?: Record<string, unknown>\n\n /**\n * Span category for Atrim grouping\n * @default \"background_task\"\n */\n readonly category?: string\n}\n\n/**\n * Create a span link to the logical parent span\n *\n * This maintains observability while using root spans to prevent context leakage.\n */\nconst createLogicalParentLink = (\n parentSpan: Tracer.AnySpan,\n useSpanLinks: boolean\n): Tracer.SpanLink[] => {\n if (!useSpanLinks) {\n return []\n }\n\n return [\n {\n _tag: 'SpanLink' as const,\n span: parentSpan,\n attributes: {\n 'link.type': 'logical_parent',\n 'atrim.relationship': 'spawned_by',\n description: 'Logical parent (isolated to prevent context leakage)'\n }\n }\n ]\n}\n\n/**\n * Create attributes for logical parent tracking\n *\n * These serve as universal fallback for tools that don't support span links well.\n */\nconst createLogicalParentAttributes = (\n parentSpan: Tracer.AnySpan,\n useAttributes: boolean,\n category: string,\n useSpanLinks: boolean,\n customAttributes: Record<string, unknown>\n): Record<string, unknown> => {\n if (!useAttributes) {\n return customAttributes\n }\n\n return {\n // Logical parent tracking (works in ALL tools)\n 'atrim.logical_parent.span_id': parentSpan.spanId,\n 'atrim.logical_parent.trace_id': parentSpan.traceId,\n 'atrim.logical_parent.name': parentSpan._tag === 'Span' ? parentSpan.name : 'external',\n\n // Categorization and metadata\n 'atrim.fiberset.isolated': true,\n 'atrim.span.category': category,\n 'atrim.has_logical_parent': true,\n 'atrim.isolation.method': useSpanLinks ? 'hybrid' : 'attributes_only',\n\n // User-provided attributes\n ...customAttributes\n }\n}\n\n/**\n * Run an effect in a FiberSet with automatic span isolation and virtual parent tracking.\n *\n * This function prevents span context leakage (fibers inheriting parent spans incorrectly)\n * while maintaining logical parent relationships for observability.\n *\n * **Technical:** Uses `{ root: true }` to create independent root span\n * **Observability:** Uses span links + attributes to track logical parent\n *\n * @example\n * ```typescript\n * import { runIsolated } from \"@atrim/instrumentation/effect/fiberset\"\n *\n * const program = Effect.scoped(\n * Effect.gen(function* () {\n * const set = yield* FiberSet.make()\n *\n * yield* Effect.gen(function* () {\n * // Spawn background tasks with automatic isolation\n * yield* runIsolated(set, backgroundTask1(), \"background-task-1\")\n * yield* runIsolated(set, backgroundTask2(), \"background-task-2\")\n * }).pipe(\n * Effect.withSpan(\"parent-operation\")\n * )\n *\n * yield* Effect.sleep(\"100 millis\")\n * })\n * )\n *\n * // In Honeycomb/Datadog/SigNoz:\n * // - background tasks are ROOT spans (no context leakage)\n * // - span links show they were spawned by parent-operation\n * // - can reconstruct virtual hierarchy\n * ```\n *\n * @param set - The FiberSet to run the effect in\n * @param effect - The effect to run (will be isolated)\n * @param name - Span name for the isolated effect\n * @param options - Configuration options\n * @returns Effect that returns the forked fiber\n *\n * @see https://github.com/atrim-ai/instrumentation/issues/5\n */\nexport const runIsolated = <A, E, R>(\n set: EffectFiberSet.FiberSet<A, E>,\n effect: Effect.Effect<A, E, R>,\n name: string,\n options?: IsolationOptions\n): Effect.Effect<RuntimeFiber<A, E>, never, R> => {\n const {\n createRoot = true,\n captureLogicalParent = true,\n useSpanLinks = true,\n useAttributes = true,\n propagateInterruption,\n attributes = {},\n category = 'background_task'\n } = options ?? {}\n\n // If not creating root and not capturing parent, just use standard FiberSet.run\n if (!createRoot && !captureLogicalParent) {\n return EffectFiberSet.run(set, effect, { propagateInterruption })\n }\n\n return Effect.gen(function* () {\n // Get current parent span (if any)\n const maybeParent = yield* Effect.serviceOption(Tracer.ParentSpan)\n\n // If no parent, just create root span\n if (maybeParent._tag === 'None' || !captureLogicalParent) {\n const isolated = effect.pipe(\n Effect.withSpan(name, {\n root: createRoot,\n attributes: {\n 'atrim.fiberset.isolated': createRoot,\n 'atrim.span.category': category,\n 'atrim.has_logical_parent': false,\n ...attributes\n }\n })\n )\n\n return yield* EffectFiberSet.run(set, isolated, { propagateInterruption })\n }\n\n const parent = maybeParent.value\n\n // Create span links for logical parent tracking\n const links = createLogicalParentLink(parent, useSpanLinks)\n\n // Create attributes for universal fallback\n const spanAttributes = createLogicalParentAttributes(\n parent,\n useAttributes,\n category,\n useSpanLinks,\n attributes\n )\n\n // Create isolated effect with root span + logical parent tracking\n const isolated = effect.pipe(\n Effect.withSpan(name, {\n root: createRoot,\n links: links.length > 0 ? links : undefined,\n attributes: spanAttributes\n })\n )\n\n return yield* EffectFiberSet.run(set, isolated, { propagateInterruption })\n })\n}\n\n/**\n * Convenience function to run an effect in a FiberSet with automatic span isolation.\n *\n * This is a simpler version of `runIsolated` with sensible defaults.\n *\n * @example\n * ```typescript\n * yield* runWithSpan(set, \"background-task\", backgroundTask(), {\n * attributes: { \"task.priority\": \"high\" }\n * })\n * ```\n */\nexport const runWithSpan = <A, E, R>(\n set: EffectFiberSet.FiberSet<A, E>,\n name: string,\n effect: Effect.Effect<A, E, R>,\n options?: {\n readonly propagateInterruption?: boolean\n readonly attributes?: Record<string, unknown>\n readonly category?: string\n }\n): Effect.Effect<RuntimeFiber<A, E>, never, R> => {\n return runIsolated(set, effect, name, {\n createRoot: true,\n captureLogicalParent: true,\n useSpanLinks: true,\n useAttributes: true,\n ...options\n })\n}\n\n/**\n * Annotate the current span with metadata about spawned FiberSet tasks.\n *\n * Call this in the parent operation before spawning tasks to add metadata\n * that helps reconstruct the virtual hierarchy.\n *\n * @example\n * ```typescript\n * yield* Effect.gen(function* () {\n * yield* annotateSpawnedTasks([\n * { name: \"background-task-1\" },\n * { name: \"background-task-2\" },\n * { name: \"background-task-3\" }\n * ])\n *\n * yield* runIsolated(set, task1(), \"background-task-1\")\n * yield* runIsolated(set, task2(), \"background-task-2\")\n * yield* runIsolated(set, task3(), \"background-task-3\")\n * }).pipe(\n * Effect.withSpan(\"parent-operation\")\n * )\n * ```\n */\nexport const annotateSpawnedTasks = (\n tasks: Array<{ name: string; spanId?: string; category?: string }>\n): Effect.Effect<void> => {\n return Effect.annotateCurrentSpan({\n 'atrim.fiberset.spawned_count': tasks.length,\n 'atrim.fiberset.task_names': tasks.map((t) => t.name).join(','),\n 'atrim.has_background_tasks': true,\n 'atrim.spawned_tasks': JSON.stringify(\n tasks.map((t) => ({\n name: t.name,\n ...(t.spanId && { span_id: t.spanId }),\n ...(t.category && { category: t.category })\n }))\n )\n })\n}\n\n/**\n * Re-export FiberSet namespace with isolation helpers\n *\n * This provides a convenient way to import all FiberSet functions:\n * ```typescript\n * import { FiberSet } from \"@atrim/instrumentation/effect/fiberset\"\n * ```\n */\nexport const FiberSet = {\n // Re-export all original FiberSet functions\n make: EffectFiberSet.make,\n add: EffectFiberSet.add,\n unsafeAdd: EffectFiberSet.unsafeAdd,\n run: EffectFiberSet.run,\n clear: EffectFiberSet.clear,\n join: EffectFiberSet.join,\n awaitEmpty: EffectFiberSet.awaitEmpty,\n size: EffectFiberSet.size,\n runtime: EffectFiberSet.runtime,\n runtimePromise: EffectFiberSet.runtimePromise,\n makeRuntime: EffectFiberSet.makeRuntime,\n makeRuntimePromise: EffectFiberSet.makeRuntimePromise,\n isFiberSet: EffectFiberSet.isFiberSet,\n\n // Add our isolation helpers\n runIsolated,\n runWithSpan\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.38.0/node_modules/@opentelemetry/semantic-conventions/src/stable_attributes.ts","../../../../../core/src/instrumentation-schema.ts","../../../../../core/src/errors.ts","../../../../../core/src/services/config-loader.ts","../../../../../core/src/pattern-matcher.ts","../../../../../core/src/logger.ts","../../../../src/core/config-loader.ts","../../../../src/integrations/effect/effect-tracer.ts","../../../../src/integrations/effect/effect-helpers.ts","../../../../src/integrations/effect/metadata-extractor.ts","../../../../src/integrations/effect/auto-enrichment.ts","../../../../src/integrations/effect/fiberset.ts"],"names":["z","Data","Context","Effect","parseYAML","HttpClientRequest","FileSystem","HttpClient","Layer","NodeContext","FetchHttpClient","loader","Otlp","TraceFlags","trace","context","Fiber","Option","FiberId","effect","EffectFiberSet","Tracer","isolated"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4hCO,IAAM,2BAAA,GAA8B,wBAAA;AA8BpC,IAAM,mCAAA,GAAsC,QAAA;AA4C5C,IAAM,uBAAA,GAA0B,oBAAA;;;;ACjmChC,IAAM,mBAAA,GAAsBA,MAAE,MAAA,CAAO;AAC1C,EAAA,OAAA,EAASA,MAAE,MAAA,EAAA;EACX,OAAA,EAASA,KAAA,CAAE,OAAA,EAAA,CAAU,QAAA,EAAA;EACrB,WAAA,EAAaA,KAAA,CAAE,MAAA,EAAA,CAAS,QAAA;AAC1B,CAAC,CAAA;AAQM,IAAM,yBAAA,GAA4BA,MAAE,MAAA,CAAO;;AAEhD,EAAA,OAAA,EAASA,KAAA,CAAE,OAAA,EAAA,CAAU,OAAA,CAAQ,KAAK,CAAA;;AAGlC,EAAA,SAAA,EAAWA,MACR,MAAA,CAAO;AACN,IAAA,YAAA,EAAcA,KAAA,CAAE,OAAA,EAAA,CAAU,OAAA,CAAQ,IAAI,CAAA;AACtC,IAAA,WAAA,EAAaA,KAAA,CAAE,OAAA,EAAA,CAAU,OAAA,CAAQ,IAAI,CAAA;AACrC,IAAA,kBAAA,EAAoBA,KAAA,CAAE,OAAA,EAAA,CAAU,OAAA,CAAQ,IAAI,CAAA;AAC5C,IAAA,cAAA,EAAgBA,KAAA,CAAE,OAAA,EAAA,CAAU,OAAA,CAAQ,KAAK;GAC1C,CAAA,CACA,OAAA,CAAQ,EAA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,MAAMiB,eAAA,CAAe,IAAA;AAAA,EACrB,KAAKA,eAAA,CAAe,GAAA;AAAA,EACpB,WAAWA,eAAA,CAAe,SAAA;AAAA,EAC1B,KAAKA,eAAA,CAAe,GAAA;AAAA,EACpB,OAAOA,eAAA,CAAe,KAAA;AAAA,EACtB,MAAMA,eAAA,CAAe,IAAA;AAAA,EACrB,YAAYA,eAAA,CAAe,UAAA;AAAA,EAC3B,MAAMA,eAAA,CAAe,IAAA;AAAA,EACrB,SAASA,eAAA,CAAe,OAAA;AAAA,EACxB,gBAAgBA,eAAA,CAAe,cAAA;AAAA,EAC/B,aAAaA,eAAA,CAAe,WAAA;AAAA,EAC5B,oBAAoBA,eAAA,CAAe,kBAAA;AAAA,EACnC,YAAYA,eAAA,CAAe,UAAA;AAAA;AAAA,EAG3B,WAAA;AAAA,EACA;AACF","file":"index.cjs","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//----------------------------------------------------------------------------------------------------------\n// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates/registry/stable/attributes.ts.j2\n//----------------------------------------------------------------------------------------------------------\n\n/**\n * ASP.NET Core exception middleware handling result.\n *\n * @example handled\n * @example unhandled\n */\nexport const ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT = 'aspnetcore.diagnostics.exception.result' as const;\n\n/**\n * Enum value \"aborted\" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}.\n *\n * Exception handling didn't run because the request was aborted.\n */\nexport const ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED = \"aborted\" as const;\n\n/**\n * Enum value \"handled\" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}.\n *\n * Exception was handled by the exception handling middleware.\n */\nexport const ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED = \"handled\" as const;\n\n/**\n * Enum value \"skipped\" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}.\n *\n * Exception handling was skipped because the response had started.\n */\nexport const ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED = \"skipped\" as const;\n\n/**\n * Enum value \"unhandled\" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}.\n *\n * Exception was not handled by the exception handling middleware.\n */\nexport const ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED = \"unhandled\" as const;\n\n/**\n * Full type name of the [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) implementation that handled the exception.\n *\n * @example Contoso.MyHandler\n */\nexport const ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE = 'aspnetcore.diagnostics.handler.type' as const;\n\n/**\n * Rate limiting policy name.\n *\n * @example fixed\n * @example sliding\n * @example token\n */\nexport const ATTR_ASPNETCORE_RATE_LIMITING_POLICY = 'aspnetcore.rate_limiting.policy' as const;\n\n/**\n * Rate-limiting result, shows whether the lease was acquired or contains a rejection reason\n *\n * @example acquired\n * @example request_canceled\n */\nexport const ATTR_ASPNETCORE_RATE_LIMITING_RESULT = 'aspnetcore.rate_limiting.result' as const;\n\n/**\n * Enum value \"acquired\" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}.\n *\n * Lease was acquired\n */\nexport const ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED = \"acquired\" as const;\n\n/**\n * Enum value \"endpoint_limiter\" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}.\n *\n * Lease request was rejected by the endpoint limiter\n */\nexport const ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER = \"endpoint_limiter\" as const;\n\n/**\n * Enum value \"global_limiter\" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}.\n *\n * Lease request was rejected by the global limiter\n */\nexport const ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER = \"global_limiter\" as const;\n\n/**\n * Enum value \"request_canceled\" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}.\n *\n * Lease request was canceled\n */\nexport const ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED = \"request_canceled\" as const;\n\n/**\n * Flag indicating if request was handled by the application pipeline.\n *\n * @example true\n */\nexport const ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED = 'aspnetcore.request.is_unhandled' as const;\n\n/**\n * A value that indicates whether the matched route is a fallback route.\n *\n * @example true\n */\nexport const ATTR_ASPNETCORE_ROUTING_IS_FALLBACK = 'aspnetcore.routing.is_fallback' as const;\n\n/**\n * Match result - success or failure\n *\n * @example success\n * @example failure\n */\nexport const ATTR_ASPNETCORE_ROUTING_MATCH_STATUS = 'aspnetcore.routing.match_status' as const;\n\n/**\n * Enum value \"failure\" for attribute {@link ATTR_ASPNETCORE_ROUTING_MATCH_STATUS}.\n *\n * Match failed\n */\nexport const ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE = \"failure\" as const;\n\n/**\n * Enum value \"success\" for attribute {@link ATTR_ASPNETCORE_ROUTING_MATCH_STATUS}.\n *\n * Match succeeded\n */\nexport const ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS = \"success\" as const;\n\n/**\n * A value that indicates whether the user is authenticated.\n *\n * @example true\n */\nexport const ATTR_ASPNETCORE_USER_IS_AUTHENTICATED = 'aspnetcore.user.is_authenticated' as const;\n\n/**\n * Client address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.\n *\n * @example client.example.com\n * @example 10.1.2.80\n * @example /tmp/my.sock\n *\n * @note When observed from the server side, and when communicating through an intermediary, `client.address` **SHOULD** represent the client address behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_CLIENT_ADDRESS = 'client.address' as const;\n\n/**\n * Client port number.\n *\n * @example 65123\n *\n * @note When observed from the server side, and when communicating through an intermediary, `client.port` **SHOULD** represent the client port behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_CLIENT_PORT = 'client.port' as const;\n\n/**\n * The column number in `code.file.path` best representing the operation. It **SHOULD** point within the code unit named in `code.function.name`. This attribute **MUST NOT** be used on the Profile signal since the data is already captured in 'message Line'. This constraint is imposed to prevent redundancy and maintain data integrity.\n *\n * @example 16\n */\nexport const ATTR_CODE_COLUMN_NUMBER = 'code.column.number' as const;\n\n/**\n * The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). This attribute **MUST NOT** be used on the Profile signal since the data is already captured in 'message Function'. This constraint is imposed to prevent redundancy and maintain data integrity.\n *\n * @example \"/usr/local/MyApplication/content_root/app/index.php\"\n */\nexport const ATTR_CODE_FILE_PATH = 'code.file.path' as const;\n\n/**\n * The method or function fully-qualified name without arguments. The value should fit the natural representation of the language runtime, which is also likely the same used within `code.stacktrace` attribute value. This attribute **MUST NOT** be used on the Profile signal since the data is already captured in 'message Function'. This constraint is imposed to prevent redundancy and maintain data integrity.\n *\n * @example com.example.MyHttpService.serveRequest\n * @example GuzzleHttp\\\\Client::transfer\n * @example fopen\n *\n * @note Values and format depends on each language runtime, thus it is impossible to provide an exhaustive list of examples.\n * The values are usually the same (or prefixes of) the ones found in native stack trace representation stored in\n * `code.stacktrace` without information on arguments.\n *\n * Examples:\n *\n * - Java method: `com.example.MyHttpService.serveRequest`\n * - Java anonymous class method: `com.mycompany.Main$1.myMethod`\n * - Java lambda method: `com.mycompany.Main$$Lambda/0x0000748ae4149c00.myMethod`\n * - PHP function: `GuzzleHttp\\Client::transfer`\n * - Go function: `github.com/my/repo/pkg.foo.func5`\n * - Elixir: `OpenTelemetry.Ctx.new`\n * - Erlang: `opentelemetry_ctx:new`\n * - Rust: `playground::my_module::my_cool_func`\n * - C function: `fopen`\n */\nexport const ATTR_CODE_FUNCTION_NAME = 'code.function.name' as const;\n\n/**\n * The line number in `code.file.path` best representing the operation. It **SHOULD** point within the code unit named in `code.function.name`. This attribute **MUST NOT** be used on the Profile signal since the data is already captured in 'message Line'. This constraint is imposed to prevent redundancy and maintain data integrity.\n *\n * @example 42\n */\nexport const ATTR_CODE_LINE_NUMBER = 'code.line.number' as const;\n\n/**\n * A stacktrace as a string in the natural representation for the language runtime. The representation is identical to [`exception.stacktrace`](/docs/exceptions/exceptions-spans.md#stacktrace-representation). This attribute **MUST NOT** be used on the Profile signal since the data is already captured in 'message Location'. This constraint is imposed to prevent redundancy and maintain data integrity.\n *\n * @example \"at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\\\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\\\n at com.example.GenerateTrace.main(GenerateTrace.java:5)\\\\n\"\n */\nexport const ATTR_CODE_STACKTRACE = 'code.stacktrace' as const;\n\n/**\n * The name of a collection (table, container) within the database.\n *\n * @example public.users\n * @example customers\n *\n * @note It is **RECOMMENDED** to capture the value as provided by the application\n * without attempting to do any case normalization.\n *\n * The collection name **SHOULD NOT** be extracted from `db.query.text`,\n * when the database system supports query text with multiple collections\n * in non-batch operations.\n *\n * For batch operations, if the individual operations are known to have the same\n * collection name then that collection name **SHOULD** be used.\n */\nexport const ATTR_DB_COLLECTION_NAME = 'db.collection.name' as const;\n\n/**\n * The name of the database, fully qualified within the server address and port.\n *\n * @example customers\n * @example test.users\n *\n * @note If a database system has multiple namespace components, they **SHOULD** be concatenated from the most general to the most specific namespace component, using `|` as a separator between the components. Any missing components (and their associated separators) **SHOULD** be omitted.\n * Semantic conventions for individual database systems **SHOULD** document what `db.namespace` means in the context of that system.\n * It is **RECOMMENDED** to capture the value as provided by the application without attempting to do any case normalization.\n */\nexport const ATTR_DB_NAMESPACE = 'db.namespace' as const;\n\n/**\n * The number of queries included in a batch operation.\n *\n * @example 2\n * @example 3\n * @example 4\n *\n * @note Operations are only considered batches when they contain two or more operations, and so `db.operation.batch.size` **SHOULD** never be `1`.\n */\nexport const ATTR_DB_OPERATION_BATCH_SIZE = 'db.operation.batch.size' as const;\n\n/**\n * The name of the operation or command being executed.\n *\n * @example findAndModify\n * @example HMSET\n * @example SELECT\n *\n * @note It is **RECOMMENDED** to capture the value as provided by the application\n * without attempting to do any case normalization.\n *\n * The operation name **SHOULD NOT** be extracted from `db.query.text`,\n * when the database system supports query text with multiple operations\n * in non-batch operations.\n *\n * If spaces can occur in the operation name, multiple consecutive spaces\n * **SHOULD** be normalized to a single space.\n *\n * For batch operations, if the individual operations are known to have the same operation name\n * then that operation name **SHOULD** be used prepended by `BATCH `,\n * otherwise `db.operation.name` **SHOULD** be `BATCH` or some other database\n * system specific term if more applicable.\n */\nexport const ATTR_DB_OPERATION_NAME = 'db.operation.name' as const;\n\n/**\n * Low cardinality summary of a database query.\n *\n * @example SELECT wuser_table\n * @example INSERT shipping_details SELECT orders\n * @example get user by id\n *\n * @note The query summary describes a class of database queries and is useful\n * as a grouping key, especially when analyzing telemetry for database\n * calls involving complex queries.\n *\n * Summary may be available to the instrumentation through\n * instrumentation hooks or other means. If it is not available, instrumentations\n * that support query parsing **SHOULD** generate a summary following\n * [Generating query summary](/docs/database/database-spans.md#generating-a-summary-of-the-query)\n * section.\n */\nexport const ATTR_DB_QUERY_SUMMARY = 'db.query.summary' as const;\n\n/**\n * The database query being executed.\n *\n * @example SELECT * FROM wuser_table where username = ?\n * @example SET mykey ?\n *\n * @note For sanitization see [Sanitization of `db.query.text`](/docs/database/database-spans.md#sanitization-of-dbquerytext).\n * For batch operations, if the individual operations are known to have the same query text then that query text **SHOULD** be used, otherwise all of the individual query texts **SHOULD** be concatenated with separator `; ` or some other database system specific separator if more applicable.\n * Parameterized query text **SHOULD NOT** be sanitized. Even though parameterized query text can potentially have sensitive data, by using a parameterized query the user is giving a strong signal that any sensitive data will be passed as parameter values, and the benefit to observability of capturing the static part of the query text by default outweighs the risk.\n */\nexport const ATTR_DB_QUERY_TEXT = 'db.query.text' as const;\n\n/**\n * Database response status code.\n *\n * @example 102\n * @example ORA-17002\n * @example 08P01\n * @example 404\n *\n * @note The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes.\n * Semantic conventions for individual database systems **SHOULD** document what `db.response.status_code` means in the context of that system.\n */\nexport const ATTR_DB_RESPONSE_STATUS_CODE = 'db.response.status_code' as const;\n\n/**\n * The name of a stored procedure within the database.\n *\n * @example GetCustomer\n *\n * @note It is **RECOMMENDED** to capture the value as provided by the application\n * without attempting to do any case normalization.\n *\n * For batch operations, if the individual operations are known to have the same\n * stored procedure name then that stored procedure name **SHOULD** be used.\n */\nexport const ATTR_DB_STORED_PROCEDURE_NAME = 'db.stored_procedure.name' as const;\n\n/**\n * The database management system (DBMS) product as identified by the client instrumentation.\n *\n * @note The actual DBMS may differ from the one identified by the client. For example, when using PostgreSQL client libraries to connect to a CockroachDB, the `db.system.name` is set to `postgresql` based on the instrumentation's best knowledge.\n */\nexport const ATTR_DB_SYSTEM_NAME = 'db.system.name' as const;\n\n/**\n * Enum value \"mariadb\" for attribute {@link ATTR_DB_SYSTEM_NAME}.\n *\n * [MariaDB](https://mariadb.org/)\n */\nexport const DB_SYSTEM_NAME_VALUE_MARIADB = \"mariadb\" as const;\n\n/**\n * Enum value \"microsoft.sql_server\" for attribute {@link ATTR_DB_SYSTEM_NAME}.\n *\n * [Microsoft SQL Server](https://www.microsoft.com/sql-server)\n */\nexport const DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER = \"microsoft.sql_server\" as const;\n\n/**\n * Enum value \"mysql\" for attribute {@link ATTR_DB_SYSTEM_NAME}.\n *\n * [MySQL](https://www.mysql.com/)\n */\nexport const DB_SYSTEM_NAME_VALUE_MYSQL = \"mysql\" as const;\n\n/**\n * Enum value \"postgresql\" for attribute {@link ATTR_DB_SYSTEM_NAME}.\n *\n * [PostgreSQL](https://www.postgresql.org/)\n */\nexport const DB_SYSTEM_NAME_VALUE_POSTGRESQL = \"postgresql\" as const;\n\n/**\n * Name of the garbage collector managed heap generation.\n *\n * @example gen0\n * @example gen1\n * @example gen2\n */\nexport const ATTR_DOTNET_GC_HEAP_GENERATION = 'dotnet.gc.heap.generation' as const;\n\n/**\n * Enum value \"gen0\" for attribute {@link ATTR_DOTNET_GC_HEAP_GENERATION}.\n *\n * Generation 0\n */\nexport const DOTNET_GC_HEAP_GENERATION_VALUE_GEN0 = \"gen0\" as const;\n\n/**\n * Enum value \"gen1\" for attribute {@link ATTR_DOTNET_GC_HEAP_GENERATION}.\n *\n * Generation 1\n */\nexport const DOTNET_GC_HEAP_GENERATION_VALUE_GEN1 = \"gen1\" as const;\n\n/**\n * Enum value \"gen2\" for attribute {@link ATTR_DOTNET_GC_HEAP_GENERATION}.\n *\n * Generation 2\n */\nexport const DOTNET_GC_HEAP_GENERATION_VALUE_GEN2 = \"gen2\" as const;\n\n/**\n * Enum value \"loh\" for attribute {@link ATTR_DOTNET_GC_HEAP_GENERATION}.\n *\n * Large Object Heap\n */\nexport const DOTNET_GC_HEAP_GENERATION_VALUE_LOH = \"loh\" as const;\n\n/**\n * Enum value \"poh\" for attribute {@link ATTR_DOTNET_GC_HEAP_GENERATION}.\n *\n * Pinned Object Heap\n */\nexport const DOTNET_GC_HEAP_GENERATION_VALUE_POH = \"poh\" as const;\n\n/**\n * Describes a class of error the operation ended with.\n *\n * @example timeout\n * @example java.net.UnknownHostException\n * @example server_certificate_invalid\n * @example 500\n *\n * @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.\n *\n * When `error.type` is set to a type (e.g., an exception type), its\n * canonical class name identifying the type within the artifact **SHOULD** be used.\n *\n * Instrumentations **SHOULD** document the list of errors they report.\n *\n * The cardinality of `error.type` within one instrumentation library **SHOULD** be low.\n * Telemetry consumers that aggregate data from multiple instrumentation libraries and applications\n * should be prepared for `error.type` to have high cardinality at query time when no\n * additional filters are applied.\n *\n * If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.\n *\n * If a specific domain defines its own set of error identifiers (such as HTTP or gRPC status codes),\n * it's **RECOMMENDED** to:\n *\n * - Use a domain-specific attribute\n * - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.\n */\nexport const ATTR_ERROR_TYPE = 'error.type' as const;\n\n/**\n * Enum value \"_OTHER\" for attribute {@link ATTR_ERROR_TYPE}.\n *\n * A fallback error value to be used when the instrumentation doesn't define a custom value.\n */\nexport const ERROR_TYPE_VALUE_OTHER = \"_OTHER\" as const;\n\n/**\n * Indicates that the exception is escaping the scope of the span.\n *\n * @deprecated It's no longer recommended to record exceptions that are handled and do not escape the scope of a span.\n */\nexport const ATTR_EXCEPTION_ESCAPED = 'exception.escaped' as const;\n\n/**\n * The exception message.\n *\n * @example Division by zero\n * @example Can't convert 'int' object to str implicitly\n */\nexport const ATTR_EXCEPTION_MESSAGE = 'exception.message' as const;\n\n/**\n * A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG.\n *\n * @example \"Exception in thread \"main\" java.lang.RuntimeException: Test exception\\\\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\\\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\\\n at com.example.GenerateTrace.main(GenerateTrace.java:5)\\\\n\"\n */\nexport const ATTR_EXCEPTION_STACKTRACE = 'exception.stacktrace' as const;\n\n/**\n * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it.\n *\n * @example java.net.ConnectException\n * @example OSError\n */\nexport const ATTR_EXCEPTION_TYPE = 'exception.type' as const;\n\n/**\n * HTTP request headers, `<key>` being the normalized HTTP Header name (lowercase), the value being the header values.\n *\n * @example [\"application/json\"]\n * @example [\"1.2.3.4\", \"1.2.3.5\"]\n *\n * @note Instrumentations **SHOULD** require an explicit configuration of which headers are to be captured.\n * Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\n *\n * The `User-Agent` header is already captured in the `user_agent.original` attribute.\n * Users **MAY** explicitly configure instrumentations to capture them even though it is not recommended.\n *\n * The attribute value **MUST** consist of either multiple header values as an array of strings\n * or a single-item array containing a possibly comma-concatenated string, depending on the way\n * the HTTP library provides access to headers.\n *\n * Examples:\n *\n * - A header `Content-Type: application/json` **SHOULD** be recorded as the `http.request.header.content-type`\n * attribute with value `[\"application/json\"]`.\n * - A header `X-Forwarded-For: 1.2.3.4, 1.2.3.5` **SHOULD** be recorded as the `http.request.header.x-forwarded-for`\n * attribute with value `[\"1.2.3.4\", \"1.2.3.5\"]` or `[\"1.2.3.4, 1.2.3.5\"]` depending on the HTTP library.\n */\nexport const ATTR_HTTP_REQUEST_HEADER = (key: string) => `http.request.header.${key}`;\n\n/**\n * HTTP request method.\n *\n * @example GET\n * @example POST\n * @example HEAD\n *\n * @note HTTP request method value **SHOULD** be \"known\" to the instrumentation.\n * By default, this convention defines \"known\" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods),\n * the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html)\n * and the QUERY method defined in [httpbis-safe-method-w-body](https://datatracker.ietf.org/doc/draft-ietf-httpbis-safe-method-w-body/?include_text=1).\n *\n * If the HTTP request method is not known to instrumentation, it **MUST** set the `http.request.method` attribute to `_OTHER`.\n *\n * If the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it **MUST** provide a way to override\n * the list of known HTTP methods. If this override is done via environment variable, then the environment variable **MUST** be named\n * OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods\n * (this list **MUST** be a full override of the default known method, it is not a list of known methods in addition to the defaults).\n *\n * HTTP method names are case-sensitive and `http.request.method` attribute value **MUST** match a known HTTP method name exactly.\n * Instrumentations for specific web frameworks that consider HTTP methods to be case insensitive, **SHOULD** populate a canonical equivalent.\n * Tracing instrumentations that do so, **MUST** also set `http.request.method_original` to the original value.\n */\nexport const ATTR_HTTP_REQUEST_METHOD = 'http.request.method' as const;\n\n/**\n * Enum value \"_OTHER\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * Any HTTP method that the instrumentation has no prior knowledge of.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_OTHER = \"_OTHER\" as const;\n\n/**\n * Enum value \"CONNECT\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * CONNECT method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_CONNECT = \"CONNECT\" as const;\n\n/**\n * Enum value \"DELETE\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * DELETE method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_DELETE = \"DELETE\" as const;\n\n/**\n * Enum value \"GET\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * GET method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_GET = \"GET\" as const;\n\n/**\n * Enum value \"HEAD\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * HEAD method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_HEAD = \"HEAD\" as const;\n\n/**\n * Enum value \"OPTIONS\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * OPTIONS method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_OPTIONS = \"OPTIONS\" as const;\n\n/**\n * Enum value \"PATCH\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * PATCH method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_PATCH = \"PATCH\" as const;\n\n/**\n * Enum value \"POST\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * POST method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_POST = \"POST\" as const;\n\n/**\n * Enum value \"PUT\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * PUT method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_PUT = \"PUT\" as const;\n\n/**\n * Enum value \"TRACE\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * TRACE method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_TRACE = \"TRACE\" as const;\n\n/**\n * Original HTTP method sent by the client in the request line.\n *\n * @example GeT\n * @example ACL\n * @example foo\n */\nexport const ATTR_HTTP_REQUEST_METHOD_ORIGINAL = 'http.request.method_original' as const;\n\n/**\n * The ordinal number of request resending attempt (for any reason, including redirects).\n *\n * @example 3\n *\n * @note The resend count **SHOULD** be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other).\n */\nexport const ATTR_HTTP_REQUEST_RESEND_COUNT = 'http.request.resend_count' as const;\n\n/**\n * HTTP response headers, `<key>` being the normalized HTTP Header name (lowercase), the value being the header values.\n *\n * @example [\"application/json\"]\n * @example [\"abc\", \"def\"]\n *\n * @note Instrumentations **SHOULD** require an explicit configuration of which headers are to be captured.\n * Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\n *\n * Users **MAY** explicitly configure instrumentations to capture them even though it is not recommended.\n *\n * The attribute value **MUST** consist of either multiple header values as an array of strings\n * or a single-item array containing a possibly comma-concatenated string, depending on the way\n * the HTTP library provides access to headers.\n *\n * Examples:\n *\n * - A header `Content-Type: application/json` header **SHOULD** be recorded as the `http.request.response.content-type`\n * attribute with value `[\"application/json\"]`.\n * - A header `My-custom-header: abc, def` header **SHOULD** be recorded as the `http.response.header.my-custom-header`\n * attribute with value `[\"abc\", \"def\"]` or `[\"abc, def\"]` depending on the HTTP library.\n */\nexport const ATTR_HTTP_RESPONSE_HEADER = (key: string) => `http.response.header.${key}`;\n\n/**\n * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).\n *\n * @example 200\n */\nexport const ATTR_HTTP_RESPONSE_STATUS_CODE = 'http.response.status_code' as const;\n\n/**\n * The matched route template for the request. This **MUST** be low-cardinality and include all static path segments, with dynamic path segments represented with placeholders.\n *\n * @example /users/:userID?\n * @example my-controller/my-action/{id?}\n *\n * @note **MUST NOT** be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it.\n * **SHOULD** include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one.\n *\n * A static path segment is a part of the route template with a fixed, low-cardinality value. This includes literal strings like `/users/` and placeholders that\n * are constrained to a finite, predefined set of values, e.g. `{controller}` or `{action}`.\n *\n * A dynamic path segment is a placeholder for a value that can have high cardinality and is not constrained to a predefined list like static path segments.\n *\n * Instrumentations **SHOULD** use routing information provided by the corresponding web framework. They **SHOULD** pick the most precise source of routing information and **MAY**\n * support custom route formatting. Instrumentations **SHOULD** document the format and the API used to obtain the route string.\n */\nexport const ATTR_HTTP_ROUTE = 'http.route' as const;\n\n/**\n * Name of the garbage collector action.\n *\n * @example end of minor GC\n * @example end of major GC\n *\n * @note Garbage collector action is generally obtained via [GarbageCollectionNotificationInfo#getGcAction()](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/GarbageCollectionNotificationInfo.html#getGcAction()).\n */\nexport const ATTR_JVM_GC_ACTION = 'jvm.gc.action' as const;\n\n/**\n * Name of the garbage collector.\n *\n * @example G1 Young Generation\n * @example G1 Old Generation\n *\n * @note Garbage collector name is generally obtained via [GarbageCollectionNotificationInfo#getGcName()](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/GarbageCollectionNotificationInfo.html#getGcName()).\n */\nexport const ATTR_JVM_GC_NAME = 'jvm.gc.name' as const;\n\n/**\n * Name of the memory pool.\n *\n * @example G1 Old Gen\n * @example G1 Eden space\n * @example G1 Survivor Space\n *\n * @note Pool names are generally obtained via [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()).\n */\nexport const ATTR_JVM_MEMORY_POOL_NAME = 'jvm.memory.pool.name' as const;\n\n/**\n * The type of memory.\n *\n * @example heap\n * @example non_heap\n */\nexport const ATTR_JVM_MEMORY_TYPE = 'jvm.memory.type' as const;\n\n/**\n * Enum value \"heap\" for attribute {@link ATTR_JVM_MEMORY_TYPE}.\n *\n * Heap memory.\n */\nexport const JVM_MEMORY_TYPE_VALUE_HEAP = \"heap\" as const;\n\n/**\n * Enum value \"non_heap\" for attribute {@link ATTR_JVM_MEMORY_TYPE}.\n *\n * Non-heap memory\n */\nexport const JVM_MEMORY_TYPE_VALUE_NON_HEAP = \"non_heap\" as const;\n\n/**\n * Whether the thread is daemon or not.\n */\nexport const ATTR_JVM_THREAD_DAEMON = 'jvm.thread.daemon' as const;\n\n/**\n * State of the thread.\n *\n * @example runnable\n * @example blocked\n */\nexport const ATTR_JVM_THREAD_STATE = 'jvm.thread.state' as const;\n\n/**\n * Enum value \"blocked\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread that is blocked waiting for a monitor lock is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_BLOCKED = \"blocked\" as const;\n\n/**\n * Enum value \"new\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread that has not yet started is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_NEW = \"new\" as const;\n\n/**\n * Enum value \"runnable\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread executing in the Java virtual machine is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_RUNNABLE = \"runnable\" as const;\n\n/**\n * Enum value \"terminated\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread that has exited is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_TERMINATED = \"terminated\" as const;\n\n/**\n * Enum value \"timed_waiting\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_TIMED_WAITING = \"timed_waiting\" as const;\n\n/**\n * Enum value \"waiting\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread that is waiting indefinitely for another thread to perform a particular action is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_WAITING = \"waiting\" as const;\n\n/**\n * Local address of the network connection - IP address or Unix domain socket name.\n *\n * @example 10.1.2.80\n * @example /tmp/my.sock\n */\nexport const ATTR_NETWORK_LOCAL_ADDRESS = 'network.local.address' as const;\n\n/**\n * Local port number of the network connection.\n *\n * @example 65123\n */\nexport const ATTR_NETWORK_LOCAL_PORT = 'network.local.port' as const;\n\n/**\n * Peer address of the network connection - IP address or Unix domain socket name.\n *\n * @example 10.1.2.80\n * @example /tmp/my.sock\n */\nexport const ATTR_NETWORK_PEER_ADDRESS = 'network.peer.address' as const;\n\n/**\n * Peer port number of the network connection.\n *\n * @example 65123\n */\nexport const ATTR_NETWORK_PEER_PORT = 'network.peer.port' as const;\n\n/**\n * [OSI application layer](https://wikipedia.org/wiki/Application_layer) or non-OSI equivalent.\n *\n * @example amqp\n * @example http\n * @example mqtt\n *\n * @note The value **SHOULD** be normalized to lowercase.\n */\nexport const ATTR_NETWORK_PROTOCOL_NAME = 'network.protocol.name' as const;\n\n/**\n * The actual version of the protocol used for network communication.\n *\n * @example 1.1\n * @example 2\n *\n * @note If protocol version is subject to negotiation (for example using [ALPN](https://www.rfc-editor.org/rfc/rfc7301.html)), this attribute **SHOULD** be set to the negotiated version. If the actual protocol version is not known, this attribute **SHOULD NOT** be set.\n */\nexport const ATTR_NETWORK_PROTOCOL_VERSION = 'network.protocol.version' as const;\n\n/**\n * [OSI transport layer](https://wikipedia.org/wiki/Transport_layer) or [inter-process communication method](https://wikipedia.org/wiki/Inter-process_communication).\n *\n * @example tcp\n * @example udp\n *\n * @note The value **SHOULD** be normalized to lowercase.\n *\n * Consider always setting the transport when setting a port number, since\n * a port number is ambiguous without knowing the transport. For example\n * different processes could be listening on TCP port 12345 and UDP port 12345.\n */\nexport const ATTR_NETWORK_TRANSPORT = 'network.transport' as const;\n\n/**\n * Enum value \"pipe\" for attribute {@link ATTR_NETWORK_TRANSPORT}.\n *\n * Named or anonymous pipe.\n */\nexport const NETWORK_TRANSPORT_VALUE_PIPE = \"pipe\" as const;\n\n/**\n * Enum value \"quic\" for attribute {@link ATTR_NETWORK_TRANSPORT}.\n *\n * QUIC\n */\nexport const NETWORK_TRANSPORT_VALUE_QUIC = \"quic\" as const;\n\n/**\n * Enum value \"tcp\" for attribute {@link ATTR_NETWORK_TRANSPORT}.\n *\n * TCP\n */\nexport const NETWORK_TRANSPORT_VALUE_TCP = \"tcp\" as const;\n\n/**\n * Enum value \"udp\" for attribute {@link ATTR_NETWORK_TRANSPORT}.\n *\n * UDP\n */\nexport const NETWORK_TRANSPORT_VALUE_UDP = \"udp\" as const;\n\n/**\n * Enum value \"unix\" for attribute {@link ATTR_NETWORK_TRANSPORT}.\n *\n * Unix domain socket\n */\nexport const NETWORK_TRANSPORT_VALUE_UNIX = \"unix\" as const;\n\n/**\n * [OSI network layer](https://wikipedia.org/wiki/Network_layer) or non-OSI equivalent.\n *\n * @example ipv4\n * @example ipv6\n *\n * @note The value **SHOULD** be normalized to lowercase.\n */\nexport const ATTR_NETWORK_TYPE = 'network.type' as const;\n\n/**\n * Enum value \"ipv4\" for attribute {@link ATTR_NETWORK_TYPE}.\n *\n * IPv4\n */\nexport const NETWORK_TYPE_VALUE_IPV4 = \"ipv4\" as const;\n\n/**\n * Enum value \"ipv6\" for attribute {@link ATTR_NETWORK_TYPE}.\n *\n * IPv6\n */\nexport const NETWORK_TYPE_VALUE_IPV6 = \"ipv6\" as const;\n\n/**\n * The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP).\n *\n * @example io.opentelemetry.contrib.mongodb\n */\nexport const ATTR_OTEL_SCOPE_NAME = 'otel.scope.name' as const;\n\n/**\n * The version of the instrumentation scope - (`InstrumentationScope.Version` in OTLP).\n *\n * @example 1.0.0\n */\nexport const ATTR_OTEL_SCOPE_VERSION = 'otel.scope.version' as const;\n\n/**\n * Name of the code, either \"OK\" or \"ERROR\". **MUST NOT** be set if the status code is UNSET.\n */\nexport const ATTR_OTEL_STATUS_CODE = 'otel.status_code' as const;\n\n/**\n * Enum value \"ERROR\" for attribute {@link ATTR_OTEL_STATUS_CODE}.\n *\n * The operation contains an error.\n */\nexport const OTEL_STATUS_CODE_VALUE_ERROR = \"ERROR\" as const;\n\n/**\n * Enum value \"OK\" for attribute {@link ATTR_OTEL_STATUS_CODE}.\n *\n * The operation has been validated by an Application developer or Operator to have completed successfully.\n */\nexport const OTEL_STATUS_CODE_VALUE_OK = \"OK\" as const;\n\n/**\n * Description of the Status if it has a value, otherwise not set.\n *\n * @example resource not found\n */\nexport const ATTR_OTEL_STATUS_DESCRIPTION = 'otel.status_description' as const;\n\n/**\n * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.\n *\n * @example example.com\n * @example 10.1.2.80\n * @example /tmp/my.sock\n *\n * @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_SERVER_ADDRESS = 'server.address' as const;\n\n/**\n * Server port number.\n *\n * @example 80\n * @example 8080\n * @example 443\n *\n * @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_SERVER_PORT = 'server.port' as const;\n\n/**\n * Logical name of the service.\n *\n * @example shoppingcart\n *\n * @note **MUST** be the same for all instances of horizontally scaled services. If the value was not specified, SDKs **MUST** fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value **MUST** be set to `unknown_service`.\n */\nexport const ATTR_SERVICE_NAME = 'service.name' as const;\n\n/**\n * The version string of the service API or implementation. The format is not defined by these conventions.\n *\n * @example 2.0.0\n * @example a01dbef8a\n */\nexport const ATTR_SERVICE_VERSION = 'service.version' as const;\n\n/**\n * SignalR HTTP connection closure status.\n *\n * @example app_shutdown\n * @example timeout\n */\nexport const ATTR_SIGNALR_CONNECTION_STATUS = 'signalr.connection.status' as const;\n\n/**\n * Enum value \"app_shutdown\" for attribute {@link ATTR_SIGNALR_CONNECTION_STATUS}.\n *\n * The connection was closed because the app is shutting down.\n */\nexport const SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN = \"app_shutdown\" as const;\n\n/**\n * Enum value \"normal_closure\" for attribute {@link ATTR_SIGNALR_CONNECTION_STATUS}.\n *\n * The connection was closed normally.\n */\nexport const SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE = \"normal_closure\" as const;\n\n/**\n * Enum value \"timeout\" for attribute {@link ATTR_SIGNALR_CONNECTION_STATUS}.\n *\n * The connection was closed due to a timeout.\n */\nexport const SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT = \"timeout\" as const;\n\n/**\n * [SignalR transport type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md)\n *\n * @example web_sockets\n * @example long_polling\n */\nexport const ATTR_SIGNALR_TRANSPORT = 'signalr.transport' as const;\n\n/**\n * Enum value \"long_polling\" for attribute {@link ATTR_SIGNALR_TRANSPORT}.\n *\n * LongPolling protocol\n */\nexport const SIGNALR_TRANSPORT_VALUE_LONG_POLLING = \"long_polling\" as const;\n\n/**\n * Enum value \"server_sent_events\" for attribute {@link ATTR_SIGNALR_TRANSPORT}.\n *\n * ServerSentEvents protocol\n */\nexport const SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS = \"server_sent_events\" as const;\n\n/**\n * Enum value \"web_sockets\" for attribute {@link ATTR_SIGNALR_TRANSPORT}.\n *\n * WebSockets protocol\n */\nexport const SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS = \"web_sockets\" as const;\n\n/**\n * The language of the telemetry SDK.\n */\nexport const ATTR_TELEMETRY_SDK_LANGUAGE = 'telemetry.sdk.language' as const;\n\n/**\n * Enum value \"cpp\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_CPP = \"cpp\" as const;\n\n/**\n * Enum value \"dotnet\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET = \"dotnet\" as const;\n\n/**\n * Enum value \"erlang\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG = \"erlang\" as const;\n\n/**\n * Enum value \"go\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_GO = \"go\" as const;\n\n/**\n * Enum value \"java\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_JAVA = \"java\" as const;\n\n/**\n * Enum value \"nodejs\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS = \"nodejs\" as const;\n\n/**\n * Enum value \"php\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_PHP = \"php\" as const;\n\n/**\n * Enum value \"python\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON = \"python\" as const;\n\n/**\n * Enum value \"ruby\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_RUBY = \"ruby\" as const;\n\n/**\n * Enum value \"rust\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_RUST = \"rust\" as const;\n\n/**\n * Enum value \"swift\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT = \"swift\" as const;\n\n/**\n * Enum value \"webjs\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS = \"webjs\" as const;\n\n/**\n * The name of the telemetry SDK as defined above.\n *\n * @example opentelemetry\n *\n * @note The OpenTelemetry SDK **MUST** set the `telemetry.sdk.name` attribute to `opentelemetry`.\n * If another SDK, like a fork or a vendor-provided implementation, is used, this SDK **MUST** set the\n * `telemetry.sdk.name` attribute to the fully-qualified class or module name of this SDK's main entry point\n * or another suitable identifier depending on the language.\n * The identifier `opentelemetry` is reserved and **MUST NOT** be used in this case.\n * All custom identifiers **SHOULD** be stable across different versions of an implementation.\n */\nexport const ATTR_TELEMETRY_SDK_NAME = 'telemetry.sdk.name' as const;\n\n/**\n * The version string of the telemetry SDK.\n *\n * @example 1.2.3\n */\nexport const ATTR_TELEMETRY_SDK_VERSION = 'telemetry.sdk.version' as const;\n\n/**\n * The [URI fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component\n *\n * @example SemConv\n */\nexport const ATTR_URL_FRAGMENT = 'url.fragment' as const;\n\n/**\n * Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986)\n *\n * @example https://www.foo.bar/search?q=OpenTelemetry#SemConv\n * @example //localhost\n *\n * @note For network calls, URL usually has `scheme://host[:port][path][?query][#fragment]` format, where the fragment\n * is not transmitted over HTTP, but if it is known, it **SHOULD** be included nevertheless.\n *\n * `url.full` **MUST NOT** contain credentials passed via URL in form of `https://username:password@www.example.com/`.\n * In such case username and password **SHOULD** be redacted and attribute's value **SHOULD** be `https://REDACTED:REDACTED@www.example.com/`.\n *\n * `url.full` **SHOULD** capture the absolute URL when it is available (or can be reconstructed).\n *\n * Sensitive content provided in `url.full` **SHOULD** be scrubbed when instrumentations can identify it.\n *\n *\n * Query string values for the following keys **SHOULD** be redacted by default and replaced by the\n * value `REDACTED`:\n *\n * - [`AWSAccessKeyId`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)\n * - [`Signature`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)\n * - [`sig`](https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token)\n * - [`X-Goog-Signature`](https://cloud.google.com/storage/docs/access-control/signed-urls)\n *\n * This list is subject to change over time.\n *\n * When a query string value is redacted, the query string key **SHOULD** still be preserved, e.g.\n * `https://www.example.com/path?color=blue&sig=REDACTED`.\n */\nexport const ATTR_URL_FULL = 'url.full' as const;\n\n/**\n * The [URI path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component\n *\n * @example /search\n *\n * @note Sensitive content provided in `url.path` **SHOULD** be scrubbed when instrumentations can identify it.\n */\nexport const ATTR_URL_PATH = 'url.path' as const;\n\n/**\n * The [URI query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component\n *\n * @example q=OpenTelemetry\n *\n * @note Sensitive content provided in `url.query` **SHOULD** be scrubbed when instrumentations can identify it.\n *\n *\n * Query string values for the following keys **SHOULD** be redacted by default and replaced by the value `REDACTED`:\n *\n * - [`AWSAccessKeyId`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)\n * - [`Signature`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)\n * - [`sig`](https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token)\n * - [`X-Goog-Signature`](https://cloud.google.com/storage/docs/access-control/signed-urls)\n *\n * This list is subject to change over time.\n *\n * When a query string value is redacted, the query string key **SHOULD** still be preserved, e.g.\n * `q=OpenTelemetry&sig=REDACTED`.\n */\nexport const ATTR_URL_QUERY = 'url.query' as const;\n\n/**\n * The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol.\n *\n * @example https\n * @example ftp\n * @example telnet\n */\nexport const ATTR_URL_SCHEME = 'url.scheme' as const;\n\n/**\n * Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client.\n *\n * @example CERN-LineMode/2.15 libwww/2.17b3\n * @example Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1\n * @example YourApp/1.0.0 grpc-java-okhttp/1.27.2\n */\nexport const ATTR_USER_AGENT_ORIGINAL = 'user_agent.original' as const;\n\n","/**\n * Configuration schema using Zod\n */\nimport { z } from 'zod'\n\nexport const PatternConfigSchema = z.object({\n pattern: z.string(),\n enabled: z.boolean().optional(),\n description: z.string().optional()\n})\n\n/**\n * Configuration for automatic span isolation in Effect operations\n *\n * This prevents context leakage when using FiberSet.run, Effect.fork, etc.\n * while maintaining logical parent relationships via span links.\n */\nexport const AutoIsolationConfigSchema = z.object({\n // Global enable/disable for auto-isolation\n enabled: z.boolean().default(false),\n\n // Which operators to auto-isolate\n operators: z\n .object({\n fiberset_run: z.boolean().default(true),\n effect_fork: z.boolean().default(true),\n effect_fork_daemon: z.boolean().default(true),\n effect_fork_in: z.boolean().default(false)\n })\n .default({}),\n\n // Virtual parent tracking configuration\n tracking: z\n .object({\n use_span_links: z.boolean().default(true),\n use_attributes: z.boolean().default(true),\n capture_logical_parent: z.boolean().default(true)\n })\n .default({}),\n\n // Span categorization\n attributes: z\n .object({\n category: z.string().default('background_task'),\n add_metadata: z.boolean().default(true)\n })\n .default({})\n})\n\n/**\n * HTTP instrumentation filtering configuration\n *\n * Allows filtering of HTTP requests to prevent noisy traces\n * (e.g., health checks, OTLP exports, internal endpoints)\n */\nexport const HttpFilteringConfigSchema = z.object({\n // Patterns to ignore for outgoing HTTP requests (string patterns only in YAML)\n ignore_outgoing_urls: z.array(z.string()).optional(),\n\n // Patterns to ignore for incoming HTTP requests (string patterns only in YAML)\n ignore_incoming_paths: z.array(z.string()).optional(),\n\n // Require parent span for outgoing requests (prevents root spans for HTTP calls)\n require_parent_for_outgoing_spans: z.boolean().optional(),\n\n // Trace context propagation configuration\n // Controls which cross-origin requests receive W3C Trace Context headers (traceparent, tracestate)\n propagate_trace_context: z\n .object({\n // Strategy for trace propagation\n // - \"all\": Propagate to all cross-origin requests (may cause CORS errors)\n // - \"none\": Never propagate trace headers\n // - \"same-origin\": Only propagate to same-origin requests (default, safe)\n // - \"patterns\": Propagate based on include_urls patterns\n strategy: z.enum(['all', 'none', 'same-origin', 'patterns']).default('same-origin'),\n\n // URL patterns to include when strategy is \"patterns\"\n // Supports regex patterns (e.g., \"^https://api\\\\.myapp\\\\.com\")\n include_urls: z.array(z.string()).optional()\n })\n .optional()\n})\n\nexport const InstrumentationConfigSchema = z.object({\n version: z.string(),\n instrumentation: z.object({\n enabled: z.boolean(),\n description: z.string().optional(),\n logging: z.enum(['on', 'off', 'minimal']).optional().default('on'),\n instrument_patterns: z.array(PatternConfigSchema),\n ignore_patterns: z.array(PatternConfigSchema)\n }),\n effect: z\n .object({\n auto_extract_metadata: z.boolean(),\n auto_isolation: AutoIsolationConfigSchema.optional()\n })\n .optional(),\n http: HttpFilteringConfigSchema.optional()\n})\n\nexport type InstrumentationConfig = z.infer<typeof InstrumentationConfigSchema>\nexport type PatternConfig = z.infer<typeof PatternConfigSchema>\nexport type AutoIsolationConfig = z.infer<typeof AutoIsolationConfigSchema>\nexport type HttpFilteringConfig = z.infer<typeof HttpFilteringConfigSchema>\n","/**\n * Typed error hierarchy for @atrim/instrumentation\n *\n * These errors use Effect's Data.TaggedError for typed error handling\n * with proper discriminated unions.\n */\n\nimport { Data } from 'effect'\n\n/**\n * Base error for configuration-related failures\n */\nexport class ConfigError extends Data.TaggedError('ConfigError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n\n/**\n * Error when fetching configuration from a URL fails\n */\nexport class ConfigUrlError extends Data.TaggedError('ConfigUrlError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n\n/**\n * Error when configuration validation fails (invalid YAML, schema mismatch)\n */\nexport class ConfigValidationError extends Data.TaggedError('ConfigValidationError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n\n/**\n * Error when reading configuration from a file fails\n */\nexport class ConfigFileError extends Data.TaggedError('ConfigFileError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n\n/**\n * Error when service detection fails (package.json not found, invalid format)\n */\nexport class ServiceDetectionError extends Data.TaggedError('ServiceDetectionError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n\n/**\n * Error when OpenTelemetry SDK initialization fails\n */\nexport class InitializationError extends Data.TaggedError('InitializationError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n\n/**\n * Error when span export fails (e.g., ECONNREFUSED to collector)\n */\nexport class ExportError extends Data.TaggedError('ExportError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n\n/**\n * Error when shutting down the SDK fails\n */\nexport class ShutdownError extends Data.TaggedError('ShutdownError')<{\n reason: string\n cause?: unknown\n}> {\n override get message() {\n return this.reason\n }\n}\n","/**\n * ConfigLoader service using Effect Platform\n *\n * Provides URI-based configuration loading with pluggable platform services:\n * - FileSystem for file:// URIs (Node.js/Bun/Deno)\n * - HttpClient for http:// and https:// URIs (universal)\n *\n * This service has NO Node.js-specific dependencies - it depends only on\n * abstract Effect Platform services that are provided by environment-specific layers.\n */\n\nimport { Effect, Context, Layer } from 'effect'\nimport { FileSystem } from '@effect/platform/FileSystem'\nimport * as HttpClient from '@effect/platform/HttpClient'\nimport * as HttpClientRequest from '@effect/platform/HttpClientRequest'\nimport { parse as parseYAML } from 'yaml'\nimport {\n InstrumentationConfigSchema,\n type InstrumentationConfig\n} from '../instrumentation-schema.js'\nimport { ConfigError, ConfigFileError, ConfigUrlError, ConfigValidationError } from '../errors.js'\n\n// Security constraints\nconst SECURITY_DEFAULTS = {\n maxConfigSize: 1_000_000, // 1MB\n requestTimeout: 5_000 // 5 seconds\n} as const\n\n/**\n * ConfigLoader service interface\n */\nexport interface ConfigLoaderService {\n /**\n * Load configuration from a URI\n *\n * Supports:\n * - file:// URIs (uses FileSystem if available)\n * - http:// and https:// URIs (uses HttpClient)\n * - Relative paths (treated as file:// in Node, http:// in browser)\n *\n * @param uri - Configuration URI\n * @returns Effect that resolves to validated configuration (NO requirements)\n */\n readonly loadFromUri: (\n uri: string\n ) => Effect.Effect<\n InstrumentationConfig,\n ConfigError | ConfigFileError | ConfigUrlError | ConfigValidationError\n >\n\n /**\n * Load configuration from inline content (YAML, JSON, or object)\n *\n * @param content - YAML string, JSON string, or plain object\n * @returns Effect that resolves to validated configuration\n */\n readonly loadFromInline: (\n content: string | unknown\n ) => Effect.Effect<InstrumentationConfig, ConfigError | ConfigValidationError>\n}\n\n/**\n * ConfigLoader service tag\n */\nexport class ConfigLoader extends Context.Tag('ConfigLoader')<\n ConfigLoader,\n ConfigLoaderService\n>() {}\n\n/**\n * Parse and validate YAML content\n */\nconst parseYamlContent = (\n content: string,\n uri?: string\n): Effect.Effect<InstrumentationConfig, ConfigValidationError> =>\n Effect.gen(function* () {\n // Parse YAML\n const parsed = yield* Effect.try({\n try: () => parseYAML(content),\n catch: (error) =>\n new ConfigValidationError({\n reason: uri ? `Failed to parse YAML from ${uri}` : 'Failed to parse YAML',\n cause: error\n })\n })\n\n // Validate schema\n return yield* Effect.try({\n try: () => InstrumentationConfigSchema.parse(parsed),\n catch: (error) =>\n new ConfigValidationError({\n reason: uri ? `Invalid configuration schema from ${uri}` : 'Invalid configuration schema',\n cause: error\n })\n })\n })\n\n/**\n * Load configuration from file using captured FileSystem service\n */\nconst loadFromFileWithFs = (\n fs: FileSystem,\n path: string,\n uri: string\n): Effect.Effect<InstrumentationConfig, ConfigFileError | ConfigValidationError> =>\n Effect.gen(function* () {\n // Read file\n const content = yield* fs.readFileString(path).pipe(\n Effect.mapError(\n (error) =>\n new ConfigFileError({\n reason: `Failed to read config file at ${uri}`,\n cause: error\n })\n )\n )\n\n // Security: Check file size\n if (content.length > SECURITY_DEFAULTS.maxConfigSize) {\n return yield* Effect.fail(\n new ConfigFileError({\n reason: `Config file exceeds maximum size of ${SECURITY_DEFAULTS.maxConfigSize} bytes`\n })\n )\n }\n\n // Parse and validate\n return yield* parseYamlContent(content, uri)\n })\n\n/**\n * Load configuration from http using captured HttpClient service\n */\nconst loadFromHttpWithClient = (\n client: HttpClient.HttpClient,\n url: string\n): Effect.Effect<InstrumentationConfig, ConfigUrlError | ConfigValidationError> =>\n Effect.scoped(\n Effect.gen(function* () {\n // Security: Reject non-HTTPS URLs\n if (url.startsWith('http://')) {\n return yield* Effect.fail(\n new ConfigUrlError({\n reason: 'Insecure protocol: only HTTPS URLs are allowed'\n })\n )\n }\n\n // Create request\n const request = HttpClientRequest.get(url).pipe(\n HttpClientRequest.setHeaders({\n Accept: 'application/yaml, text/yaml, application/x-yaml'\n })\n )\n\n // Execute request with timeout\n const response = yield* client.execute(request).pipe(\n Effect.timeout(`${SECURITY_DEFAULTS.requestTimeout} millis`),\n Effect.mapError((error) => {\n if (error._tag === 'TimeoutException') {\n return new ConfigUrlError({\n reason: `Config fetch timeout after ${SECURITY_DEFAULTS.requestTimeout}ms from ${url}`\n })\n }\n return new ConfigUrlError({\n reason: `Failed to load config from URL: ${url}`,\n cause: error\n })\n })\n )\n\n // Check HTTP status\n if (response.status >= 400) {\n return yield* Effect.fail(\n new ConfigUrlError({\n reason: `HTTP ${response.status} from ${url}`\n })\n )\n }\n\n // Get response text\n const text = yield* response.text.pipe(\n Effect.mapError(\n (error) =>\n new ConfigUrlError({\n reason: `Failed to read response body from ${url}`,\n cause: error\n })\n )\n )\n\n // Security: Check size\n if (text.length > SECURITY_DEFAULTS.maxConfigSize) {\n return yield* Effect.fail(\n new ConfigUrlError({\n reason: `Config exceeds maximum size of ${SECURITY_DEFAULTS.maxConfigSize} bytes`\n })\n )\n }\n\n // Parse and validate\n return yield* parseYamlContent(text, url)\n })\n )\n\n/**\n * ConfigLoader service implementation\n *\n * Captures FileSystem and HttpClient dependencies at construction time\n */\nconst makeConfigLoader = Effect.gen(function* () {\n // Capture dependencies at construction time\n const fs = yield* Effect.serviceOption(FileSystem)\n const http = yield* HttpClient.HttpClient\n\n // Create the loadFromUri function\n const loadFromUriUncached = (uri: string) =>\n Effect.gen(function* () {\n // file:// protocol\n if (uri.startsWith('file://')) {\n const path = uri.slice(7) // Remove \"file://\"\n\n if (fs._tag === 'None') {\n return yield* Effect.fail(\n new ConfigFileError({\n reason: 'FileSystem not available (browser environment?)',\n cause: { uri }\n })\n )\n }\n\n return yield* loadFromFileWithFs(fs.value, path, uri)\n }\n\n // http:// or https:// protocol\n if (uri.startsWith('http://') || uri.startsWith('https://')) {\n return yield* loadFromHttpWithClient(http, uri)\n }\n\n // Relative path - try FileSystem first, fallback to HTTP\n if (fs._tag === 'Some') {\n // FileSystem available (Node.js environment)\n return yield* loadFromFileWithFs(fs.value, uri, uri)\n } else {\n // No FileSystem (browser environment) - treat as HTTP\n // Relative URLs will be resolved by browser fetch to current origin\n return yield* loadFromHttpWithClient(http, uri)\n }\n })\n\n // Cache the loadFromUri function with 5 minute TTL (default cache timeout)\n const loadFromUriCached = yield* Effect.cachedFunction(loadFromUriUncached)\n\n return ConfigLoader.of({\n loadFromUri: loadFromUriCached,\n\n loadFromInline: (content: string | unknown) =>\n Effect.gen(function* () {\n // If string, parse as YAML\n if (typeof content === 'string') {\n return yield* parseYamlContent(content)\n }\n\n // Already an object - just validate schema\n return yield* Effect.try({\n try: () => InstrumentationConfigSchema.parse(content),\n catch: (error) =>\n new ConfigValidationError({\n reason: 'Invalid configuration schema',\n cause: error\n })\n })\n })\n })\n})\n\n/**\n * ConfigLoader Live layer\n *\n * Provides ConfigLoader service implementation.\n * Requires HttpClient to be provided by platform-specific layers.\n * FileSystem is optional (for browser compatibility).\n */\nexport const ConfigLoaderLive = Layer.effect(ConfigLoader, makeConfigLoader)\n","/**\n * Pattern matching utilities\n *\n * Implements efficient pattern-based span filtering with caching.\n *\n * Matching rules:\n * 1. Check ignore patterns first (takes precedence)\n * 2. Check instrument patterns second\n * 3. Default behavior: If no patterns match, span is created (fail-open)\n */\n\nimport type { InstrumentationConfig, PatternConfig } from './instrumentation-schema.js'\n\n/**\n * Compiled pattern with metadata\n */\ninterface CompiledPattern {\n regex: RegExp\n enabled: boolean\n description?: string\n}\n\n/**\n * Pattern matcher with compiled regex cache\n */\nexport class PatternMatcher {\n private ignorePatterns: CompiledPattern[] = []\n private instrumentPatterns: CompiledPattern[] = []\n private enabled: boolean = true\n\n constructor(config: InstrumentationConfig) {\n this.enabled = config.instrumentation.enabled\n\n // Compile ignore patterns (highest priority)\n this.ignorePatterns = config.instrumentation.ignore_patterns.map((p) => this.compilePattern(p))\n\n // Compile instrument patterns\n this.instrumentPatterns = config.instrumentation.instrument_patterns\n .filter((p) => p.enabled !== false) // Filter out disabled patterns\n .map((p) => this.compilePattern(p))\n }\n\n /**\n * Compile a pattern configuration into a RegExp\n */\n private compilePattern(pattern: PatternConfig): CompiledPattern {\n try {\n const compiled: CompiledPattern = {\n regex: new RegExp(pattern.pattern),\n enabled: pattern.enabled !== false\n }\n if (pattern.description !== undefined) {\n compiled.description = pattern.description\n }\n return compiled\n } catch (error) {\n throw new Error(\n `Failed to compile pattern \"${pattern.pattern}\": ${error instanceof Error ? error.message : String(error)}`\n )\n }\n }\n\n /**\n * Check if a span should be instrumented\n *\n * Returns true if the span should be created, false otherwise.\n *\n * Logic:\n * 1. If instrumentation disabled globally, return false\n * 2. Check ignore patterns - if any match, return false\n * 3. Check instrument patterns - if any match, return true\n * 4. Default: return true (fail-open - create span if no patterns match)\n */\n shouldInstrument(spanName: string): boolean {\n // Global disable\n if (!this.enabled) {\n return false\n }\n\n // Check ignore patterns first (highest priority)\n for (const pattern of this.ignorePatterns) {\n if (pattern.regex.test(spanName)) {\n return false\n }\n }\n\n // Check instrument patterns\n for (const pattern of this.instrumentPatterns) {\n if (pattern.enabled && pattern.regex.test(spanName)) {\n return true\n }\n }\n\n // Default: fail-open (create span if no patterns match)\n // This ensures backward compatibility and doesn't break existing instrumentation\n return true\n }\n\n /**\n * Get statistics about pattern matching (for debugging/monitoring)\n */\n getStats(): {\n enabled: boolean\n ignorePatternCount: number\n instrumentPatternCount: number\n } {\n return {\n enabled: this.enabled,\n ignorePatternCount: this.ignorePatterns.length,\n instrumentPatternCount: this.instrumentPatterns.filter((p) => p.enabled).length\n }\n }\n}\n\n// Global pattern matcher instance\nlet globalMatcher: PatternMatcher | null = null\n\n/**\n * Initialize the global pattern matcher\n */\nexport function initializePatternMatcher(config: InstrumentationConfig): void {\n globalMatcher = new PatternMatcher(config)\n}\n\n/**\n * Check if a span should be instrumented (uses global matcher)\n *\n * This is a convenience function for use without direct access to the matcher instance.\n * If no matcher is initialized, defaults to true (fail-open).\n */\nexport function shouldInstrumentSpan(spanName: string): boolean {\n if (!globalMatcher) {\n // No matcher initialized - fail open\n return true\n }\n return globalMatcher.shouldInstrument(spanName)\n}\n\n/**\n * Get the global pattern matcher (for advanced use cases)\n */\nexport function getPatternMatcher(): PatternMatcher | null {\n return globalMatcher\n}\n\n/**\n * Clear the global pattern matcher (useful for testing)\n */\nexport function clearPatternMatcher(): void {\n globalMatcher = null\n}\n","/**\n * Centralized logging utility for @atrim/instrumentation\n *\n * Supports three levels:\n * - 'on' (default): All logging enabled\n * - 'minimal': Only a single initialization message + errors/warnings\n * - 'off': No logging at all\n */\n\nexport type LogLevel = 'on' | 'off' | 'minimal'\n\nclass Logger {\n private level: LogLevel = 'on'\n private hasLoggedMinimal = false\n\n /**\n * Set the logging level\n */\n setLevel(level: LogLevel): void {\n this.level = level\n this.hasLoggedMinimal = false\n }\n\n /**\n * Get the current logging level\n */\n getLevel(): LogLevel {\n return this.level\n }\n\n /**\n * Log a minimal initialization message (only shown once in minimal mode)\n */\n minimal(message: string): void {\n if (this.level === 'off') {\n return\n }\n\n if (this.level === 'minimal' && !this.hasLoggedMinimal) {\n console.log(message)\n this.hasLoggedMinimal = true\n return\n }\n\n if (this.level === 'on') {\n console.log(message)\n }\n }\n\n /**\n * Log an informational message\n */\n log(...args: unknown[]): void {\n if (this.level === 'on') {\n console.log(...args)\n }\n }\n\n /**\n * Log a warning message (shown in minimal mode)\n */\n warn(...args: unknown[]): void {\n if (this.level !== 'off') {\n console.warn(...args)\n }\n }\n\n /**\n * Log an error message (shown in minimal mode)\n */\n error(...args: unknown[]): void {\n if (this.level !== 'off') {\n console.error(...args)\n }\n }\n\n /**\n * Check if full logging is enabled\n */\n isEnabled(): boolean {\n return this.level === 'on'\n }\n\n /**\n * Check if minimal logging is enabled\n */\n isMinimal(): boolean {\n return this.level === 'minimal'\n }\n\n /**\n * Check if logging is completely disabled\n */\n isDisabled(): boolean {\n return this.level === 'off'\n }\n}\n\n// Singleton instance\nexport const logger = new Logger()\n","/**\n * Node.js configuration loader using Effect Platform\n *\n * Provides FileSystem and HttpClient layers for the core ConfigLoader service\n */\n\nimport { Effect, Layer } from 'effect'\nimport { NodeContext } from '@effect/platform-node'\nimport { FetchHttpClient } from '@effect/platform'\nimport {\n ConfigLoader,\n ConfigLoaderLive,\n type InstrumentationConfig,\n type ConfigLoaderService\n} from '@atrim/instrument-core'\n\n/**\n * Complete ConfigLoader layer with all Node.js platform dependencies\n *\n * Provides:\n * - ConfigLoader service\n * - FileSystem (from NodeContext)\n * - HttpClient (from FetchHttpClient)\n */\nexport const NodeConfigLoaderLive = ConfigLoaderLive.pipe(\n Layer.provide(Layer.mergeAll(NodeContext.layer, FetchHttpClient.layer))\n)\n\n/**\n * Singleton cached config loader for sharing cache across calls\n */\nlet cachedLoaderPromise: Promise<ConfigLoaderService> | null = null\n\nfunction getCachedLoader(): Promise<ConfigLoaderService> {\n if (!cachedLoaderPromise) {\n cachedLoaderPromise = Effect.runPromise(\n Effect.gen(function* () {\n return yield* ConfigLoader\n }).pipe(Effect.provide(NodeConfigLoaderLive))\n )\n }\n return cachedLoaderPromise\n}\n\n/**\n * Reset the cached loader (for testing purposes)\n * @internal\n */\nexport function _resetConfigLoaderCache(): void {\n cachedLoaderPromise = null\n}\n\n/**\n * Load configuration from URI (Promise-based convenience API)\n *\n * Automatically provides Node.js platform layers (FileSystem + HttpClient)\n *\n * @param uri - Configuration URI (file://, http://, https://, or relative path)\n * @param options - Optional loading options (e.g., to disable caching)\n * @returns Promise that resolves to validated configuration\n */\nexport async function loadConfig(\n uri: string,\n options?: { cacheTimeout?: number }\n): Promise<InstrumentationConfig> {\n // If cacheTimeout is 0, bypass cache\n if (options?.cacheTimeout === 0) {\n const program = Effect.gen(function* () {\n const loader = yield* ConfigLoader\n return yield* loader.loadFromUri(uri)\n })\n return Effect.runPromise(program.pipe(Effect.provide(NodeConfigLoaderLive)))\n }\n\n const loader = await getCachedLoader()\n return Effect.runPromise(loader.loadFromUri(uri))\n}\n\n/**\n * Load configuration from inline content (Promise-based convenience API)\n *\n * @param content - YAML string, JSON string, or plain object\n * @returns Promise that resolves to validated configuration\n */\nexport async function loadConfigFromInline(\n content: string | unknown\n): Promise<InstrumentationConfig> {\n const loader = await getCachedLoader()\n return Effect.runPromise(loader.loadFromInline(content))\n}\n\n/**\n * Legacy options interface for backward compatibility\n */\nexport interface ConfigLoaderOptions {\n configPath?: string\n configUrl?: string\n config?: InstrumentationConfig\n cacheTimeout?: number\n}\n\n/**\n * Get default configuration\n */\nfunction getDefaultConfig(): InstrumentationConfig {\n return {\n version: '1.0',\n instrumentation: {\n enabled: true,\n logging: 'on',\n description: 'Default instrumentation configuration',\n instrument_patterns: [\n { pattern: '^app\\\\.', enabled: true, description: 'Application operations' },\n { pattern: '^http\\\\.server\\\\.', enabled: true, description: 'HTTP server operations' },\n { pattern: '^http\\\\.client\\\\.', enabled: true, description: 'HTTP client operations' }\n ],\n ignore_patterns: [\n { pattern: '^test\\\\.', description: 'Test utilities' },\n { pattern: '^internal\\\\.', description: 'Internal operations' },\n { pattern: '^health\\\\.', description: 'Health checks' }\n ]\n },\n effect: {\n auto_extract_metadata: true\n }\n }\n}\n\n/**\n * Load configuration with priority order (backward compatible API)\n *\n * Priority order (highest to lowest):\n * 1. Explicit config object (options.config)\n * 2. Environment variable (ATRIM_INSTRUMENTATION_CONFIG)\n * 3. Explicit path/URL (options.configPath or options.configUrl)\n * 4. Project root file (./instrumentation.yaml)\n * 5. Default config (built-in defaults)\n *\n * @param options - Configuration options\n * @returns Promise that resolves to validated configuration\n */\nexport async function loadConfigWithOptions(\n options: ConfigLoaderOptions = {}\n): Promise<InstrumentationConfig> {\n // Extract cacheTimeout option\n const loadOptions =\n options.cacheTimeout !== undefined ? { cacheTimeout: options.cacheTimeout } : undefined\n\n // Priority 1: Explicit config object\n if (options.config) {\n return loadConfigFromInline(options.config)\n }\n\n // Priority 2: Environment variable\n const envConfigPath = process.env.ATRIM_INSTRUMENTATION_CONFIG\n if (envConfigPath) {\n return loadConfig(envConfigPath, loadOptions)\n }\n\n // Priority 3: Explicit options\n if (options.configUrl) {\n return loadConfig(options.configUrl, loadOptions)\n }\n if (options.configPath) {\n return loadConfig(options.configPath, loadOptions)\n }\n\n // Priority 4: Project root file\n const { existsSync } = await import('fs')\n const { join } = await import('path')\n\n const defaultPath = join(process.cwd(), 'instrumentation.yaml')\n if (existsSync(defaultPath)) {\n return loadConfig(defaultPath, loadOptions)\n }\n\n // Priority 5: Default config\n return getDefaultConfig()\n}\n","/**\n * Effect-TS Tracer integration with context propagation\n *\n * This module provides Effect-TS tracing that seamlessly integrates with\n * OpenTelemetry NodeSDK auto-instrumentation. Effect spans will automatically\n * continue existing traces created by NodeSDK (e.g., HTTP requests).\n *\n * Context Propagation:\n * - NodeSDK auto-instrumentation creates root spans (e.g., HTTP requests)\n * - Effect operations automatically become child spans of the active trace\n * - Uses OpenTelemetry Context API (equivalent to Java thread-local)\n * - No configuration needed - works out of the box\n *\n * Architecture:\n * 1. @effect/opentelemetry uses the global OpenTelemetry tracer provider\n * 2. When an Effect operation starts, it checks context.active() for existing spans\n * 3. If found, creates child spans. If not, creates new root span.\n * 4. This happens automatically via OpenTelemetry Context propagation\n */\n\nimport { Effect, Layer, Tracer } from 'effect'\nimport type { Tracer as EffectTracer } from 'effect'\nimport * as Otlp from '@effect/opentelemetry/Otlp'\nimport { FetchHttpClient } from '@effect/platform'\nimport { context, trace, type SpanContext, TraceFlags } from '@opentelemetry/api'\nimport {\n ATTR_TELEMETRY_SDK_LANGUAGE,\n ATTR_TELEMETRY_SDK_NAME,\n TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS\n} from '@opentelemetry/semantic-conventions'\nimport { initializePatternMatcher, logger } from '@atrim/instrument-core'\nimport { loadConfigWithOptions, type ConfigLoaderOptions } from '../../core/config-loader.js'\n\n// SDK metadata for resource attributes\nconst SDK_NAME = '@effect/opentelemetry-otlp'\n\n/**\n * Configuration options for Effect instrumentation\n */\nexport interface EffectInstrumentationOptions extends ConfigLoaderOptions {\n /**\n * OTLP endpoint URL\n * @default process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318'\n */\n otlpEndpoint?: string\n\n /**\n * Service name\n * @default process.env.OTEL_SERVICE_NAME || 'effect-service'\n */\n serviceName?: string\n\n /**\n * Service version\n * @default process.env.npm_package_version || '1.0.0'\n */\n serviceVersion?: string\n\n /**\n * Whether to automatically extract Effect fiber metadata\n * @default true\n */\n autoExtractMetadata?: boolean\n\n /**\n * Whether to continue existing traces from NodeSDK auto-instrumentation\n *\n * When true (default):\n * - Effect spans become children of existing NodeSDK spans\n * - Example: HTTP request span → Effect business logic span\n * - Uses OpenTelemetry Context API for propagation\n *\n * When false:\n * - Effect operations always create new root spans\n * - Not recommended unless you have specific requirements\n *\n * @default true\n */\n continueExistingTraces?: boolean\n}\n\n/**\n * Create Effect instrumentation layer with custom options\n *\n * This function creates an Effect Layer that provides OpenTelemetry tracing\n * with automatic context propagation from NodeSDK auto-instrumentation.\n *\n * @example\n * ```typescript\n * // With NodeSDK auto-instrumentation\n * import { NodeSDK } from '@opentelemetry/sdk-node'\n * import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'\n *\n * // 1. Start NodeSDK (creates HTTP spans automatically)\n * const sdk = new NodeSDK({\n * instrumentations: [getNodeAutoInstrumentations()]\n * })\n * sdk.start()\n *\n * // 2. Create Effect instrumentation (will continue NodeSDK traces)\n * const EffectLayer = createEffectInstrumentation()\n *\n * // 3. Use in Effect operations\n * const program = Effect.gen(function* () {\n * // This span will be a child of the HTTP request span (if any)\n * yield* Effect.log(\"Business logic\")\n * }).pipe(\n * Effect.withSpan(\"app.business.logic\"),\n * Effect.provide(EffectLayer)\n * )\n * ```\n */\nexport function createEffectInstrumentation(options: EffectInstrumentationOptions = {}) {\n return Layer.unwrapEffect(\n Effect.gen(function* () {\n // 1. Load configuration\n const config = yield* Effect.tryPromise({\n try: () => loadConfigWithOptions(options),\n catch: (error) => ({\n _tag: 'ConfigError' as const,\n message: error instanceof Error ? error.message : String(error)\n })\n })\n\n // 2. Configure logger based on config\n yield* Effect.sync(() => {\n const loggingLevel = config.instrumentation.logging || 'on'\n logger.setLevel(loggingLevel)\n })\n\n // 3. Initialize pattern matcher\n yield* Effect.sync(() => initializePatternMatcher(config))\n\n // 4. Extract options with defaults\n const otlpEndpoint =\n options.otlpEndpoint || process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318'\n\n const serviceName = options.serviceName || process.env.OTEL_SERVICE_NAME || 'effect-service'\n\n const serviceVersion = options.serviceVersion || process.env.npm_package_version || '1.0.0'\n\n const autoExtractMetadata =\n options.autoExtractMetadata ?? config.effect?.auto_extract_metadata ?? true\n\n const continueExistingTraces = options.continueExistingTraces ?? true\n\n logger.log('🔍 Effect OpenTelemetry instrumentation')\n logger.log(` 📡 Endpoint: ${otlpEndpoint}`)\n logger.log(` 🏷️ Service: ${serviceName}`)\n logger.log(` ✅ Auto metadata extraction: ${autoExtractMetadata}`)\n logger.log(` ✅ Continue existing traces: ${continueExistingTraces}`)\n\n // 5. Create Otlp layer for Effect operations\n // CRITICAL: Uses tracerContext callback to bridge Effect spans to OpenTelemetry context\n // This allows bidirectional context propagation:\n // - NodeSDK spans → Effect spans (child relationship)\n // - Effect spans → NodeSDK spans (subsequent auto-instrumented calls)\n const otlpLayer = Otlp.layer({\n baseUrl: otlpEndpoint,\n resource: {\n serviceName,\n serviceVersion,\n attributes: {\n 'platform.component': 'effect',\n 'effect.auto_metadata': autoExtractMetadata,\n 'effect.context_propagation': continueExistingTraces,\n [ATTR_TELEMETRY_SDK_LANGUAGE]: TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,\n [ATTR_TELEMETRY_SDK_NAME]: SDK_NAME\n }\n },\n // Bridge Effect context to OpenTelemetry global context\n // This is essential for context propagation to work properly\n tracerContext: <X>(f: () => X, span: Tracer.AnySpan): X => {\n // Only bridge actual Effect spans (not ExternalSpan)\n if (span._tag !== 'Span') {\n return f()\n }\n\n // Create OpenTelemetry SpanContext from Effect span metadata\n const spanContext: SpanContext = {\n traceId: span.traceId,\n spanId: span.spanId,\n traceFlags: span.sampled ? TraceFlags.SAMPLED : TraceFlags.NONE\n }\n\n // Create a non-recording span to represent the Effect span in OTel context\n const otelSpan = trace.wrapSpanContext(spanContext)\n\n // Set as active span in OpenTelemetry global context\n return context.with(trace.setSpan(context.active(), otelSpan), f)\n }\n }).pipe(Layer.provide(FetchHttpClient.layer))\n\n // 6. If auto-metadata extraction is enabled, add a layer that extracts\n // Effect fiber metadata for each span\n if (autoExtractMetadata) {\n // TODO: Implement metadata extraction layer\n // For now, just return the base Otlp layer\n return otlpLayer\n }\n\n return otlpLayer\n })\n ).pipe(Layer.orDie)\n}\n\n/**\n * Zero-config Effect instrumentation layer\n *\n * Uses the global OpenTelemetry tracer provider that was set up by\n * initializeInstrumentation(). This ensures all traces (Express, Effect, etc.)\n * go to the same OTLP endpoint.\n *\n * Context Propagation:\n * - Automatically continues traces from NodeSDK auto-instrumentation\n * - Effect spans become children of HTTP request spans\n * - No configuration needed\n *\n * @example\n * ```typescript\n * import { EffectInstrumentationLive } from '@atrim/instrumentation/effect'\n *\n * const program = Effect.gen(function* () {\n * // This span continues any existing trace from NodeSDK\n * yield* Effect.log(\"Processing\")\n * }).pipe(\n * Effect.withSpan(\"app.process\"),\n * Effect.provide(EffectInstrumentationLive)\n * )\n * ```\n */\nexport const EffectInstrumentationLive = Effect.sync(() => {\n const endpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318'\n const serviceName = process.env.OTEL_SERVICE_NAME || 'effect-service'\n const serviceVersion = process.env.npm_package_version || '1.0.0'\n\n logger.minimal(`@atrim/instrumentation/effect: Effect tracing enabled (${serviceName})`)\n logger.log('🔍 Effect OpenTelemetry tracer')\n logger.log(` 📡 Endpoint: ${endpoint}`)\n logger.log(` 🏷️ Service: ${serviceName}`)\n\n // Use Otlp.layer() like atrim platform\n // This creates Effect-specific spans that get exported via OTLP\n return Otlp.layer({\n baseUrl: endpoint,\n resource: {\n serviceName,\n serviceVersion,\n attributes: {\n 'platform.component': 'effect',\n [ATTR_TELEMETRY_SDK_LANGUAGE]: TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,\n [ATTR_TELEMETRY_SDK_NAME]: SDK_NAME\n }\n },\n // CRITICAL: Bridge Effect context to OpenTelemetry global context\n // This allows NodeSDK auto-instrumentation to see Effect spans as parent spans\n tracerContext: <X>(f: () => X, span: EffectTracer.AnySpan): X => {\n // Only bridge actual Effect spans (not ExternalSpan)\n if (span._tag !== 'Span') {\n return f()\n }\n\n // Create OpenTelemetry SpanContext from Effect span metadata\n const spanContext: SpanContext = {\n traceId: span.traceId,\n spanId: span.spanId,\n traceFlags: span.sampled ? TraceFlags.SAMPLED : TraceFlags.NONE\n }\n\n // Create a non-recording span to represent the Effect span in OTel context\n const otelSpan = trace.wrapSpanContext(spanContext)\n\n // Set as active span in OpenTelemetry global context\n return context.with(trace.setSpan(context.active(), otelSpan), f)\n }\n }).pipe(Layer.provide(FetchHttpClient.layer))\n}).pipe(Layer.unwrapEffect)\n","/**\n * Effect-specific span annotation helpers\n *\n * Provides reusable helper functions for adding common span attributes.\n * These helpers follow OpenTelemetry semantic conventions and platform patterns.\n *\n * Usage:\n * ```typescript\n * Effect.gen(function* () {\n * yield* annotateUser(userId, email)\n * yield* annotateBatch(items.length, 5)\n * const results = yield* storage.writeBatch(items)\n * yield* annotateBatch(items.length, 5, results.success, results.failures)\n * }).pipe(Effect.withSpan('storage.writeBatch'))\n * ```\n */\n\nimport { Effect } from 'effect'\n\n/**\n * Annotate span with user context\n *\n * @param userId - User identifier\n * @param email - Optional user email\n * @param username - Optional username\n */\nexport function annotateUser(\n userId: string,\n email?: string,\n username?: string\n): Effect.Effect<void, never, never> {\n const attributes: Record<string, string> = {\n 'user.id': userId\n }\n if (email) attributes['user.email'] = email\n if (username) attributes['user.name'] = username\n\n return Effect.annotateCurrentSpan(attributes)\n}\n\n/**\n * Annotate span with data size metrics\n *\n * @param bytes - Total bytes processed\n * @param items - Number of items\n * @param compressionRatio - Optional compression ratio\n */\nexport function annotateDataSize(\n bytes: number,\n items: number,\n compressionRatio?: number\n): Effect.Effect<void, never, never> {\n const attributes: Record<string, number> = {\n 'data.size.bytes': bytes,\n 'data.size.items': items\n }\n if (compressionRatio !== undefined) {\n attributes['data.compression.ratio'] = compressionRatio\n }\n\n return Effect.annotateCurrentSpan(attributes)\n}\n\n/**\n * Annotate span with batch operation metadata\n *\n * @param totalItems - Total number of items in batch\n * @param batchSize - Size of each batch\n * @param successCount - Optional number of successful items\n * @param failureCount - Optional number of failed items\n */\nexport function annotateBatch(\n totalItems: number,\n batchSize: number,\n successCount?: number,\n failureCount?: number\n): Effect.Effect<void, never, never> {\n const attributes: Record<string, number> = {\n 'batch.size': batchSize,\n 'batch.total_items': totalItems,\n 'batch.count': Math.ceil(totalItems / batchSize)\n }\n\n if (successCount !== undefined) {\n attributes['batch.success_count'] = successCount\n }\n if (failureCount !== undefined) {\n attributes['batch.failure_count'] = failureCount\n }\n\n return Effect.annotateCurrentSpan(attributes)\n}\n\n/**\n * Annotate span with LLM operation metadata\n *\n * @param model - Model name (e.g., 'gpt-4', 'claude-3-opus')\n * @param provider - LLM provider (e.g., 'openai', 'anthropic')\n * @param tokens - Optional token usage information\n */\nexport function annotateLLM(\n model: string,\n provider: string,\n tokens?: { prompt?: number; completion?: number; total?: number }\n): Effect.Effect<void, never, never> {\n const attributes: Record<string, string | number> = {\n 'llm.model': model,\n 'llm.provider': provider\n }\n\n if (tokens) {\n if (tokens.prompt !== undefined) attributes['llm.tokens.prompt'] = tokens.prompt\n if (tokens.completion !== undefined) attributes['llm.tokens.completion'] = tokens.completion\n if (tokens.total !== undefined) attributes['llm.tokens.total'] = tokens.total\n }\n\n return Effect.annotateCurrentSpan(attributes)\n}\n\n/**\n * Annotate span with database query metadata\n *\n * @param query - SQL query or query description\n * @param duration - Optional query duration in milliseconds\n * @param rowCount - Optional number of rows returned/affected\n * @param database - Optional database name\n */\nexport function annotateQuery(\n query: string,\n duration?: number,\n rowCount?: number,\n database?: string\n): Effect.Effect<void, never, never> {\n const attributes: Record<string, string | number> = {\n 'db.statement': query.length > 1000 ? query.substring(0, 1000) + '...' : query\n }\n\n if (duration !== undefined) attributes['db.duration.ms'] = duration\n if (rowCount !== undefined) attributes['db.row_count'] = rowCount\n if (database) attributes['db.name'] = database\n\n return Effect.annotateCurrentSpan(attributes)\n}\n\n/**\n * Annotate span with HTTP request metadata\n *\n * @param method - HTTP method (GET, POST, etc.)\n * @param url - Request URL\n * @param statusCode - Optional HTTP status code\n * @param contentLength - Optional response content length\n */\nexport function annotateHttpRequest(\n method: string,\n url: string,\n statusCode?: number,\n contentLength?: number\n): Effect.Effect<void, never, never> {\n const attributes: Record<string, string | number> = {\n 'http.method': method,\n 'http.url': url\n }\n\n if (statusCode !== undefined) attributes['http.status_code'] = statusCode\n if (contentLength !== undefined) attributes['http.response.content_length'] = contentLength\n\n return Effect.annotateCurrentSpan(attributes)\n}\n\n/**\n * Annotate span with error context\n *\n * @param error - Error object or message\n * @param recoverable - Whether the error is recoverable\n * @param errorType - Optional error type/category\n */\nexport function annotateError(\n error: Error | string,\n recoverable: boolean,\n errorType?: string\n): Effect.Effect<void, never, never> {\n const errorMessage = typeof error === 'string' ? error : error.message\n const errorStack = typeof error === 'string' ? undefined : error.stack\n\n const attributes: Record<string, string | boolean> = {\n 'error.message': errorMessage,\n 'error.recoverable': recoverable\n }\n\n if (errorType) attributes['error.type'] = errorType\n if (errorStack) attributes['error.stack'] = errorStack\n\n return Effect.annotateCurrentSpan(attributes)\n}\n\n/**\n * Annotate span with operation priority\n *\n * @param priority - Priority level (high, medium, low)\n * @param reason - Optional reason for priority level\n */\nexport function annotatePriority(\n priority: 'high' | 'medium' | 'low',\n reason?: string\n): Effect.Effect<void, never, never> {\n const attributes: Record<string, string> = {\n 'operation.priority': priority\n }\n\n if (reason) attributes['operation.priority.reason'] = reason\n\n return Effect.annotateCurrentSpan(attributes)\n}\n\n/**\n * Annotate span with cache operation metadata\n *\n * @param hit - Whether the cache was hit\n * @param key - Cache key\n * @param ttl - Optional time-to-live in seconds\n */\nexport function annotateCache(\n hit: boolean,\n key: string,\n ttl?: number\n): Effect.Effect<void, never, never> {\n const attributes: Record<string, string | number | boolean> = {\n 'cache.hit': hit,\n 'cache.key': key\n }\n\n if (ttl !== undefined) attributes['cache.ttl.seconds'] = ttl\n\n return Effect.annotateCurrentSpan(attributes)\n}\n","/**\n * Effect metadata extraction\n *\n * Automatically extracts metadata from Effect fibers and adds them as span attributes.\n * This provides valuable context about the Effect execution environment.\n *\n * Uses Effect's public APIs:\n * - Fiber.getCurrentFiber() - Get current fiber information\n * - Effect.currentSpan - Detect parent spans and nesting\n */\n\nimport { Effect, Fiber, FiberId, Option } from 'effect'\n\n/**\n * Metadata extracted from Effect fibers\n */\nexport interface EffectMetadata {\n 'effect.fiber.id'?: string\n 'effect.fiber.status'?: string\n 'effect.operation.root'?: boolean\n 'effect.operation.nested'?: boolean\n 'effect.parent.span.id'?: string\n 'effect.parent.span.name'?: string\n 'effect.parent.trace.id'?: string\n}\n\n/**\n * Extract Effect-native metadata from current execution context\n *\n * Uses Effect's native APIs:\n * - Fiber.getCurrentFiber() - Get current fiber information\n * - Effect.currentSpan - Detect parent spans and nesting\n *\n * @returns Effect that yields extracted metadata\n */\nexport function extractEffectMetadata(): Effect.Effect<EffectMetadata> {\n return Effect.gen(function* () {\n const metadata: EffectMetadata = {}\n\n // Extract fiber metadata using Fiber.getCurrentFiber()\n const currentFiber = Fiber.getCurrentFiber()\n\n if (Option.isSome(currentFiber)) {\n const fiber = currentFiber.value\n const fiberId = fiber.id()\n\n // Add fiber ID\n metadata['effect.fiber.id'] = FiberId.threadName(fiberId)\n\n // Get fiber status (returns an Effect)\n const status = yield* Fiber.status(fiber)\n if (status._tag) {\n metadata['effect.fiber.status'] = status._tag\n }\n }\n\n // Detect parent span for nesting analysis\n const parentSpanResult = yield* Effect.currentSpan.pipe(\n Effect.option // Convert NoSuchElementException to Option\n )\n\n if (Option.isSome(parentSpanResult)) {\n const parentSpan = parentSpanResult.value\n metadata['effect.operation.nested'] = true\n metadata['effect.operation.root'] = false\n\n // Extract parent span information\n if (parentSpan.spanId) {\n metadata['effect.parent.span.id'] = parentSpan.spanId\n }\n\n if (parentSpan.name) {\n metadata['effect.parent.span.name'] = parentSpan.name\n }\n\n // Detect forking: if parent span exists in different context\n // This is a best-effort detection based on span context\n if (parentSpan.traceId) {\n metadata['effect.parent.trace.id'] = parentSpan.traceId\n }\n } else {\n // No parent span - this is a root span\n metadata['effect.operation.nested'] = false\n metadata['effect.operation.root'] = true\n }\n\n return metadata\n })\n}\n","/**\n * Effect Auto-Enrichment Utilities\n *\n * Provides utilities for automatically extracting and enriching spans with Effect-native metadata.\n *\n * Usage:\n * ```typescript\n * import { autoEnrichSpan, withAutoEnrichedSpan } from '@atrim/instrument-node/effect'\n *\n * // Option 1: Manual enrichment\n * Effect.gen(function* () {\n * yield* autoEnrichSpan() // Auto-add Effect metadata\n * yield* annotateBatch(items.length, 10) // Add custom attributes\n * const result = yield* storage.writeBatch(items)\n * return result\n * }).pipe(Effect.withSpan('storage.writeBatch'))\n *\n * // Option 2: Automatic enrichment wrapper\n * const instrumented = withAutoEnrichedSpan('storage.writeBatch')(\n * Effect.gen(function* () {\n * yield* annotateBatch(items.length, 10)\n * return yield* storage.writeBatch(items)\n * })\n * )\n * ```\n */\n\nimport { Effect } from 'effect'\nimport { extractEffectMetadata } from './metadata-extractor.js'\n\n/**\n * Auto-enrich the current span with Effect metadata\n *\n * This function should be called within an Effect.withSpan() context.\n * It extracts Effect metadata (fiber ID, status, parent span info)\n * and adds it as span attributes.\n *\n * Best practice: Call this at the start of your instrumented Effect:\n *\n * ```typescript\n * Effect.gen(function* () {\n * yield* autoEnrichSpan() // Auto-add metadata\n * yield* annotateBatch(items.length, 10) // Add custom attributes\n * const result = yield* storage.writeBatch(items)\n * return result\n * }).pipe(Effect.withSpan('storage.writeBatch'))\n * ```\n *\n * @returns Effect that annotates the current span with Effect metadata\n */\nexport function autoEnrichSpan(): Effect.Effect<void> {\n return Effect.gen(function* () {\n // Extract Effect metadata\n const metadata = yield* extractEffectMetadata()\n\n // Add metadata as span attributes\n // Cast to Record<string, unknown> to satisfy Effect.annotateCurrentSpan type\n yield* Effect.annotateCurrentSpan(metadata as Record<string, unknown>)\n })\n}\n\n/**\n * Create a wrapper that combines Effect.withSpan with automatic enrichment\n *\n * This is a convenience function that wraps an Effect with both:\n * 1. A span (via Effect.withSpan)\n * 2. Automatic metadata extraction (via autoEnrichSpan)\n *\n * Usage:\n * ```typescript\n * const instrumented = withAutoEnrichedSpan('storage.writeBatch')(\n * Effect.gen(function* () {\n * yield* annotateBatch(items.length, 10)\n * return yield* storage.writeBatch(items)\n * })\n * )\n * ```\n *\n * @param spanName - The name of the span\n * @param options - Optional span options\n * @returns Function that wraps an Effect with an auto-enriched span\n */\nexport function withAutoEnrichedSpan<A, E, R>(\n spanName: string,\n options?: {\n readonly attributes?: Record<string, unknown>\n readonly kind?: 'client' | 'server' | 'producer' | 'consumer' | 'internal'\n }\n) {\n return (self: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> => {\n return Effect.gen(function* () {\n // Auto-enrich with metadata\n yield* autoEnrichSpan()\n\n // Execute the wrapped effect\n return yield* self\n }).pipe(Effect.withSpan(spanName, options))\n }\n}\n","/**\n * FiberSet helpers with automatic span isolation and virtual parent tracking\n *\n * Provides wrappers around Effect's FiberSet.run that automatically:\n * 1. Isolate span context (prevent leakage via { root: true })\n * 2. Track logical parent via OpenTelemetry span links\n * 3. Add custom attributes as universal fallback\n *\n * @module\n */\n\nimport { Effect, FiberSet as EffectFiberSet, Tracer } from 'effect'\nimport type { RuntimeFiber } from 'effect/Fiber'\n\n/**\n * Options for span isolation when running effects in FiberSet\n */\nexport interface IsolationOptions {\n /**\n * Whether to create a root span (breaks parent chain)\n * @default true (from config or this default)\n */\n readonly createRoot?: boolean\n\n /**\n * Capture logical parent relationship via span links and attributes\n * @default true\n */\n readonly captureLogicalParent?: boolean\n\n /**\n * Use OpenTelemetry span links to track logical parent\n * Works in: Honeycomb, Datadog, Lightstep, SigNoz, Splunk\n * @default true\n */\n readonly useSpanLinks?: boolean\n\n /**\n * Add custom attributes for logical parent tracking\n * Works in: ALL observability tools (universal fallback)\n * @default true\n */\n readonly useAttributes?: boolean\n\n /**\n * Propagate interruption from parent\n * @default undefined (FiberSet.run default behavior)\n */\n readonly propagateInterruption?: boolean\n\n /**\n * Custom span attributes to add\n */\n readonly attributes?: Record<string, unknown>\n\n /**\n * Span category for Atrim grouping\n * @default \"background_task\"\n */\n readonly category?: string\n}\n\n/**\n * Create a span link to the logical parent span\n *\n * This maintains observability while using root spans to prevent context leakage.\n */\nconst createLogicalParentLink = (\n parentSpan: Tracer.AnySpan,\n useSpanLinks: boolean\n): Tracer.SpanLink[] => {\n if (!useSpanLinks) {\n return []\n }\n\n return [\n {\n _tag: 'SpanLink' as const,\n span: parentSpan,\n attributes: {\n 'link.type': 'logical_parent',\n 'atrim.relationship': 'spawned_by',\n description: 'Logical parent (isolated to prevent context leakage)'\n }\n }\n ]\n}\n\n/**\n * Create attributes for logical parent tracking\n *\n * These serve as universal fallback for tools that don't support span links well.\n */\nconst createLogicalParentAttributes = (\n parentSpan: Tracer.AnySpan,\n useAttributes: boolean,\n category: string,\n useSpanLinks: boolean,\n customAttributes: Record<string, unknown>\n): Record<string, unknown> => {\n if (!useAttributes) {\n return customAttributes\n }\n\n return {\n // Logical parent tracking (works in ALL tools)\n 'atrim.logical_parent.span_id': parentSpan.spanId,\n 'atrim.logical_parent.trace_id': parentSpan.traceId,\n 'atrim.logical_parent.name': parentSpan._tag === 'Span' ? parentSpan.name : 'external',\n\n // Categorization and metadata\n 'atrim.fiberset.isolated': true,\n 'atrim.span.category': category,\n 'atrim.has_logical_parent': true,\n 'atrim.isolation.method': useSpanLinks ? 'hybrid' : 'attributes_only',\n\n // User-provided attributes\n ...customAttributes\n }\n}\n\n/**\n * Run an effect in a FiberSet with automatic span isolation and virtual parent tracking.\n *\n * This function prevents span context leakage (fibers inheriting parent spans incorrectly)\n * while maintaining logical parent relationships for observability.\n *\n * **Technical:** Uses `{ root: true }` to create independent root span\n * **Observability:** Uses span links + attributes to track logical parent\n *\n * @example\n * ```typescript\n * import { runIsolated } from \"@atrim/instrumentation/effect/fiberset\"\n *\n * const program = Effect.scoped(\n * Effect.gen(function* () {\n * const set = yield* FiberSet.make()\n *\n * yield* Effect.gen(function* () {\n * // Spawn background tasks with automatic isolation\n * yield* runIsolated(set, backgroundTask1(), \"background-task-1\")\n * yield* runIsolated(set, backgroundTask2(), \"background-task-2\")\n * }).pipe(\n * Effect.withSpan(\"parent-operation\")\n * )\n *\n * yield* Effect.sleep(\"100 millis\")\n * })\n * )\n *\n * // In Honeycomb/Datadog/SigNoz:\n * // - background tasks are ROOT spans (no context leakage)\n * // - span links show they were spawned by parent-operation\n * // - can reconstruct virtual hierarchy\n * ```\n *\n * @param set - The FiberSet to run the effect in\n * @param effect - The effect to run (will be isolated)\n * @param name - Span name for the isolated effect\n * @param options - Configuration options\n * @returns Effect that returns the forked fiber\n *\n * @see https://github.com/atrim-ai/instrumentation/issues/5\n */\nexport const runIsolated = <A, E, R>(\n set: EffectFiberSet.FiberSet<A, E>,\n effect: Effect.Effect<A, E, R>,\n name: string,\n options?: IsolationOptions\n): Effect.Effect<RuntimeFiber<A, E>, never, R> => {\n const {\n createRoot = true,\n captureLogicalParent = true,\n useSpanLinks = true,\n useAttributes = true,\n propagateInterruption,\n attributes = {},\n category = 'background_task'\n } = options ?? {}\n\n // If not creating root and not capturing parent, just use standard FiberSet.run\n if (!createRoot && !captureLogicalParent) {\n return EffectFiberSet.run(set, effect, { propagateInterruption })\n }\n\n return Effect.gen(function* () {\n // Get current parent span (if any)\n const maybeParent = yield* Effect.serviceOption(Tracer.ParentSpan)\n\n // If no parent, just create root span\n if (maybeParent._tag === 'None' || !captureLogicalParent) {\n const isolated = effect.pipe(\n Effect.withSpan(name, {\n root: createRoot,\n attributes: {\n 'atrim.fiberset.isolated': createRoot,\n 'atrim.span.category': category,\n 'atrim.has_logical_parent': false,\n ...attributes\n }\n })\n )\n\n return yield* EffectFiberSet.run(set, isolated, { propagateInterruption })\n }\n\n const parent = maybeParent.value\n\n // Create span links for logical parent tracking\n const links = createLogicalParentLink(parent, useSpanLinks)\n\n // Create attributes for universal fallback\n const spanAttributes = createLogicalParentAttributes(\n parent,\n useAttributes,\n category,\n useSpanLinks,\n attributes\n )\n\n // Create isolated effect with root span + logical parent tracking\n const isolated = effect.pipe(\n Effect.withSpan(name, {\n root: createRoot,\n links: links.length > 0 ? links : undefined,\n attributes: spanAttributes\n })\n )\n\n return yield* EffectFiberSet.run(set, isolated, { propagateInterruption })\n })\n}\n\n/**\n * Convenience function to run an effect in a FiberSet with automatic span isolation.\n *\n * This is a simpler version of `runIsolated` with sensible defaults.\n *\n * @example\n * ```typescript\n * yield* runWithSpan(set, \"background-task\", backgroundTask(), {\n * attributes: { \"task.priority\": \"high\" }\n * })\n * ```\n */\nexport const runWithSpan = <A, E, R>(\n set: EffectFiberSet.FiberSet<A, E>,\n name: string,\n effect: Effect.Effect<A, E, R>,\n options?: {\n readonly propagateInterruption?: boolean\n readonly attributes?: Record<string, unknown>\n readonly category?: string\n }\n): Effect.Effect<RuntimeFiber<A, E>, never, R> => {\n return runIsolated(set, effect, name, {\n createRoot: true,\n captureLogicalParent: true,\n useSpanLinks: true,\n useAttributes: true,\n ...options\n })\n}\n\n/**\n * Annotate the current span with metadata about spawned FiberSet tasks.\n *\n * Call this in the parent operation before spawning tasks to add metadata\n * that helps reconstruct the virtual hierarchy.\n *\n * @example\n * ```typescript\n * yield* Effect.gen(function* () {\n * yield* annotateSpawnedTasks([\n * { name: \"background-task-1\" },\n * { name: \"background-task-2\" },\n * { name: \"background-task-3\" }\n * ])\n *\n * yield* runIsolated(set, task1(), \"background-task-1\")\n * yield* runIsolated(set, task2(), \"background-task-2\")\n * yield* runIsolated(set, task3(), \"background-task-3\")\n * }).pipe(\n * Effect.withSpan(\"parent-operation\")\n * )\n * ```\n */\nexport const annotateSpawnedTasks = (\n tasks: Array<{ name: string; spanId?: string; category?: string }>\n): Effect.Effect<void> => {\n return Effect.annotateCurrentSpan({\n 'atrim.fiberset.spawned_count': tasks.length,\n 'atrim.fiberset.task_names': tasks.map((t) => t.name).join(','),\n 'atrim.has_background_tasks': true,\n 'atrim.spawned_tasks': JSON.stringify(\n tasks.map((t) => ({\n name: t.name,\n ...(t.spanId && { span_id: t.spanId }),\n ...(t.category && { category: t.category })\n }))\n )\n })\n}\n\n/**\n * Re-export FiberSet namespace with isolation helpers\n *\n * This provides a convenient way to import all FiberSet functions:\n * ```typescript\n * import { FiberSet } from \"@atrim/instrumentation/effect/fiberset\"\n * ```\n */\nexport const FiberSet = {\n // Re-export all original FiberSet functions\n make: EffectFiberSet.make,\n add: EffectFiberSet.add,\n unsafeAdd: EffectFiberSet.unsafeAdd,\n run: EffectFiberSet.run,\n clear: EffectFiberSet.clear,\n join: EffectFiberSet.join,\n awaitEmpty: EffectFiberSet.awaitEmpty,\n size: EffectFiberSet.size,\n runtime: EffectFiberSet.runtime,\n runtimePromise: EffectFiberSet.runtimePromise,\n makeRuntime: EffectFiberSet.makeRuntime,\n makeRuntimePromise: EffectFiberSet.makeRuntimePromise,\n isFiberSet: EffectFiberSet.isFiberSet,\n\n // Add our isolation helpers\n runIsolated,\n runWithSpan\n}\n"]}
|