@atrim/instrument-node 0.4.0 → 0.4.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.
@@ -3,8 +3,8 @@ import { NodeSDKConfiguration, NodeSDK } from '@opentelemetry/sdk-node';
3
3
  import { Instrumentation } from '@opentelemetry/instrumentation';
4
4
  import { RequestOptions, IncomingMessage } from 'node:http';
5
5
  import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
6
- import { ConfigLoaderOptions, InstrumentationConfig, PatternMatcher } from '@atrim/instrument-core';
7
- export { ConfigLoaderOptions, InstrumentationConfig, PatternConfig, PatternMatcher, getPatternMatcher, loadConfig, shouldInstrumentSpan } from '@atrim/instrument-core';
6
+ import { InstrumentationConfig, PatternMatcher } from '@atrim/instrument-core';
7
+ export { InstrumentationConfig, PatternConfig, PatternMatcher, getPatternMatcher, shouldInstrumentSpan } from '@atrim/instrument-core';
8
8
  import * as effect_Cause from 'effect/Cause';
9
9
  import * as effect_Types from 'effect/Types';
10
10
  import { SpanProcessor, Span, ReadableSpan } from '@opentelemetry/sdk-trace-base';
@@ -45,6 +45,60 @@ declare function createOtlpExporter(options?: OtlpExporterOptions): OTLPTraceExp
45
45
  */
46
46
  declare function getOtlpEndpoint(options?: OtlpExporterOptions): string;
47
47
 
48
+ /**
49
+ * Node.js configuration loader using Effect Platform
50
+ *
51
+ * Provides FileSystem and HttpClient layers for the core ConfigLoader service
52
+ */
53
+
54
+ /**
55
+ * Reset the cached loader (for testing purposes)
56
+ * @internal
57
+ */
58
+ declare function _resetConfigLoaderCache(): void;
59
+ /**
60
+ * Load configuration from URI (Promise-based convenience API)
61
+ *
62
+ * Automatically provides Node.js platform layers (FileSystem + HttpClient)
63
+ *
64
+ * @param uri - Configuration URI (file://, http://, https://, or relative path)
65
+ * @param options - Optional loading options (e.g., to disable caching)
66
+ * @returns Promise that resolves to validated configuration
67
+ */
68
+ declare function loadConfig(uri: string, options?: {
69
+ cacheTimeout?: number;
70
+ }): Promise<InstrumentationConfig>;
71
+ /**
72
+ * Load configuration from inline content (Promise-based convenience API)
73
+ *
74
+ * @param content - YAML string, JSON string, or plain object
75
+ * @returns Promise that resolves to validated configuration
76
+ */
77
+ declare function loadConfigFromInline(content: string | unknown): Promise<InstrumentationConfig>;
78
+ /**
79
+ * Legacy options interface for backward compatibility
80
+ */
81
+ interface ConfigLoaderOptions {
82
+ configPath?: string;
83
+ configUrl?: string;
84
+ config?: InstrumentationConfig;
85
+ cacheTimeout?: number;
86
+ }
87
+ /**
88
+ * Load configuration with priority order (backward compatible API)
89
+ *
90
+ * Priority order (highest to lowest):
91
+ * 1. Explicit config object (options.config)
92
+ * 2. Environment variable (ATRIM_INSTRUMENTATION_CONFIG)
93
+ * 3. Explicit path/URL (options.configPath or options.configUrl)
94
+ * 4. Project root file (./instrumentation.yaml)
95
+ * 5. Default config (built-in defaults)
96
+ *
97
+ * @param options - Configuration options
98
+ * @returns Promise that resolves to validated configuration
99
+ */
100
+ declare function loadConfigWithOptions(options?: ConfigLoaderOptions): Promise<InstrumentationConfig>;
101
+
48
102
  /**
49
103
  * NodeSDK Initialization
50
104
  *
@@ -599,4 +653,4 @@ declare function annotateCacheOperation(span: Span$1, operation: 'get' | 'set' |
599
653
  */
600
654
  declare function suppressShutdownErrors(): void;
601
655
 
602
- export { ConfigError, ConfigFileError, ConfigUrlError, ConfigValidationError, ExportError, InitializationError, type OtlpExporterOptions, PatternSpanProcessor, type SdkInitializationOptions, ServiceDetectionError, type ServiceInfo, ShutdownError, annotateCacheOperation, annotateDbQuery, annotateHttpRequest, createOtlpExporter, detectServiceInfoAsync as detectServiceInfo, detectServiceInfo as detectServiceInfoEffect, getOtlpEndpoint, getSdkInstance, getServiceInfoWithFallback, getServiceNameAsync as getServiceName, getServiceName as getServiceNameEffect, getServiceVersionAsync as getServiceVersion, getServiceVersion as getServiceVersionEffect, initializeInstrumentation, initializeInstrumentationEffect, initializePatternMatchingOnly, initializePatternMatchingOnlyEffect, markSpanError, markSpanSuccess, recordException, resetSdk, setSpanAttributes, shutdownSdk, suppressShutdownErrors };
656
+ export { ConfigError, ConfigFileError, type ConfigLoaderOptions, ConfigUrlError, ConfigValidationError, ExportError, InitializationError, type OtlpExporterOptions, PatternSpanProcessor, type SdkInitializationOptions, ServiceDetectionError, type ServiceInfo, ShutdownError, annotateCacheOperation, annotateDbQuery, annotateHttpRequest, _resetConfigLoaderCache as clearConfigCache, createOtlpExporter, detectServiceInfoAsync as detectServiceInfo, detectServiceInfo as detectServiceInfoEffect, getOtlpEndpoint, getSdkInstance, getServiceInfoWithFallback, getServiceNameAsync as getServiceName, getServiceName as getServiceNameEffect, getServiceVersionAsync as getServiceVersion, getServiceVersion as getServiceVersionEffect, initializeInstrumentation, initializeInstrumentationEffect, initializePatternMatchingOnly, initializePatternMatchingOnlyEffect, loadConfig, loadConfigFromInline, loadConfigWithOptions, markSpanError, markSpanSuccess, recordException, resetSdk, setSpanAttributes, shutdownSdk, suppressShutdownErrors };
@@ -3,8 +3,8 @@ import { NodeSDKConfiguration, NodeSDK } from '@opentelemetry/sdk-node';
3
3
  import { Instrumentation } from '@opentelemetry/instrumentation';
4
4
  import { RequestOptions, IncomingMessage } from 'node:http';
5
5
  import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
6
- import { ConfigLoaderOptions, InstrumentationConfig, PatternMatcher } from '@atrim/instrument-core';
7
- export { ConfigLoaderOptions, InstrumentationConfig, PatternConfig, PatternMatcher, getPatternMatcher, loadConfig, shouldInstrumentSpan } from '@atrim/instrument-core';
6
+ import { InstrumentationConfig, PatternMatcher } from '@atrim/instrument-core';
7
+ export { InstrumentationConfig, PatternConfig, PatternMatcher, getPatternMatcher, shouldInstrumentSpan } from '@atrim/instrument-core';
8
8
  import * as effect_Cause from 'effect/Cause';
9
9
  import * as effect_Types from 'effect/Types';
10
10
  import { SpanProcessor, Span, ReadableSpan } from '@opentelemetry/sdk-trace-base';
@@ -45,6 +45,60 @@ declare function createOtlpExporter(options?: OtlpExporterOptions): OTLPTraceExp
45
45
  */
46
46
  declare function getOtlpEndpoint(options?: OtlpExporterOptions): string;
47
47
 
48
+ /**
49
+ * Node.js configuration loader using Effect Platform
50
+ *
51
+ * Provides FileSystem and HttpClient layers for the core ConfigLoader service
52
+ */
53
+
54
+ /**
55
+ * Reset the cached loader (for testing purposes)
56
+ * @internal
57
+ */
58
+ declare function _resetConfigLoaderCache(): void;
59
+ /**
60
+ * Load configuration from URI (Promise-based convenience API)
61
+ *
62
+ * Automatically provides Node.js platform layers (FileSystem + HttpClient)
63
+ *
64
+ * @param uri - Configuration URI (file://, http://, https://, or relative path)
65
+ * @param options - Optional loading options (e.g., to disable caching)
66
+ * @returns Promise that resolves to validated configuration
67
+ */
68
+ declare function loadConfig(uri: string, options?: {
69
+ cacheTimeout?: number;
70
+ }): Promise<InstrumentationConfig>;
71
+ /**
72
+ * Load configuration from inline content (Promise-based convenience API)
73
+ *
74
+ * @param content - YAML string, JSON string, or plain object
75
+ * @returns Promise that resolves to validated configuration
76
+ */
77
+ declare function loadConfigFromInline(content: string | unknown): Promise<InstrumentationConfig>;
78
+ /**
79
+ * Legacy options interface for backward compatibility
80
+ */
81
+ interface ConfigLoaderOptions {
82
+ configPath?: string;
83
+ configUrl?: string;
84
+ config?: InstrumentationConfig;
85
+ cacheTimeout?: number;
86
+ }
87
+ /**
88
+ * Load configuration with priority order (backward compatible API)
89
+ *
90
+ * Priority order (highest to lowest):
91
+ * 1. Explicit config object (options.config)
92
+ * 2. Environment variable (ATRIM_INSTRUMENTATION_CONFIG)
93
+ * 3. Explicit path/URL (options.configPath or options.configUrl)
94
+ * 4. Project root file (./instrumentation.yaml)
95
+ * 5. Default config (built-in defaults)
96
+ *
97
+ * @param options - Configuration options
98
+ * @returns Promise that resolves to validated configuration
99
+ */
100
+ declare function loadConfigWithOptions(options?: ConfigLoaderOptions): Promise<InstrumentationConfig>;
101
+
48
102
  /**
49
103
  * NodeSDK Initialization
50
104
  *
@@ -599,4 +653,4 @@ declare function annotateCacheOperation(span: Span$1, operation: 'get' | 'set' |
599
653
  */
600
654
  declare function suppressShutdownErrors(): void;
601
655
 
602
- export { ConfigError, ConfigFileError, ConfigUrlError, ConfigValidationError, ExportError, InitializationError, type OtlpExporterOptions, PatternSpanProcessor, type SdkInitializationOptions, ServiceDetectionError, type ServiceInfo, ShutdownError, annotateCacheOperation, annotateDbQuery, annotateHttpRequest, createOtlpExporter, detectServiceInfoAsync as detectServiceInfo, detectServiceInfo as detectServiceInfoEffect, getOtlpEndpoint, getSdkInstance, getServiceInfoWithFallback, getServiceNameAsync as getServiceName, getServiceName as getServiceNameEffect, getServiceVersionAsync as getServiceVersion, getServiceVersion as getServiceVersionEffect, initializeInstrumentation, initializeInstrumentationEffect, initializePatternMatchingOnly, initializePatternMatchingOnlyEffect, markSpanError, markSpanSuccess, recordException, resetSdk, setSpanAttributes, shutdownSdk, suppressShutdownErrors };
656
+ export { ConfigError, ConfigFileError, type ConfigLoaderOptions, ConfigUrlError, ConfigValidationError, ExportError, InitializationError, type OtlpExporterOptions, PatternSpanProcessor, type SdkInitializationOptions, ServiceDetectionError, type ServiceInfo, ShutdownError, annotateCacheOperation, annotateDbQuery, annotateHttpRequest, _resetConfigLoaderCache as clearConfigCache, createOtlpExporter, detectServiceInfoAsync as detectServiceInfo, detectServiceInfo as detectServiceInfoEffect, getOtlpEndpoint, getSdkInstance, getServiceInfoWithFallback, getServiceNameAsync as getServiceName, getServiceName as getServiceNameEffect, getServiceVersionAsync as getServiceVersion, getServiceVersion as getServiceVersionEffect, initializeInstrumentation, initializeInstrumentationEffect, initializePatternMatchingOnly, initializePatternMatchingOnlyEffect, loadConfig, loadConfigFromInline, loadConfigWithOptions, markSpanError, markSpanSuccess, recordException, resetSdk, setSpanAttributes, shutdownSdk, suppressShutdownErrors };