@atrim/instrument-node 0.5.0-c05e3a1-20251119131235 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/target/dist/index.cjs +75 -72
- package/target/dist/index.cjs.map +1 -1
- package/target/dist/index.d.cts +140 -107
- package/target/dist/index.d.ts +140 -107
- package/target/dist/index.js +69 -71
- package/target/dist/index.js.map +1 -1
- package/target/dist/integrations/effect/index.cjs +1 -14
- package/target/dist/integrations/effect/index.cjs.map +1 -1
- package/target/dist/integrations/effect/index.js +1 -14
- package/target/dist/integrations/effect/index.js.map +1 -1
package/target/dist/index.d.cts
CHANGED
|
@@ -45,101 +45,6 @@ declare function createOtlpExporter(options?: OtlpExporterOptions): OTLPTraceExp
|
|
|
45
45
|
*/
|
|
46
46
|
declare function getOtlpEndpoint(options?: OtlpExporterOptions): string;
|
|
47
47
|
|
|
48
|
-
/**
|
|
49
|
-
* Typed error hierarchy for @atrim/instrumentation
|
|
50
|
-
*
|
|
51
|
-
* These errors use Effect's Data.TaggedError for typed error handling
|
|
52
|
-
* with proper discriminated unions.
|
|
53
|
-
*/
|
|
54
|
-
declare const ConfigError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
55
|
-
readonly _tag: "ConfigError";
|
|
56
|
-
} & Readonly<A>;
|
|
57
|
-
/**
|
|
58
|
-
* Base error for configuration-related failures
|
|
59
|
-
*/
|
|
60
|
-
declare class ConfigError extends ConfigError_base<{
|
|
61
|
-
reason: string;
|
|
62
|
-
cause?: unknown;
|
|
63
|
-
}> {
|
|
64
|
-
}
|
|
65
|
-
declare const ConfigUrlError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
66
|
-
readonly _tag: "ConfigUrlError";
|
|
67
|
-
} & Readonly<A>;
|
|
68
|
-
/**
|
|
69
|
-
* Error when fetching configuration from a URL fails
|
|
70
|
-
*/
|
|
71
|
-
declare class ConfigUrlError extends ConfigUrlError_base<{
|
|
72
|
-
reason: string;
|
|
73
|
-
cause?: unknown;
|
|
74
|
-
}> {
|
|
75
|
-
}
|
|
76
|
-
declare const ConfigValidationError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
77
|
-
readonly _tag: "ConfigValidationError";
|
|
78
|
-
} & Readonly<A>;
|
|
79
|
-
/**
|
|
80
|
-
* Error when configuration validation fails (invalid YAML, schema mismatch)
|
|
81
|
-
*/
|
|
82
|
-
declare class ConfigValidationError extends ConfigValidationError_base<{
|
|
83
|
-
reason: string;
|
|
84
|
-
cause?: unknown;
|
|
85
|
-
}> {
|
|
86
|
-
}
|
|
87
|
-
declare const ConfigFileError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
88
|
-
readonly _tag: "ConfigFileError";
|
|
89
|
-
} & Readonly<A>;
|
|
90
|
-
/**
|
|
91
|
-
* Error when reading configuration from a file fails
|
|
92
|
-
*/
|
|
93
|
-
declare class ConfigFileError extends ConfigFileError_base<{
|
|
94
|
-
reason: string;
|
|
95
|
-
cause?: unknown;
|
|
96
|
-
}> {
|
|
97
|
-
}
|
|
98
|
-
declare const ServiceDetectionError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
99
|
-
readonly _tag: "ServiceDetectionError";
|
|
100
|
-
} & Readonly<A>;
|
|
101
|
-
/**
|
|
102
|
-
* Error when service detection fails (package.json not found, invalid format)
|
|
103
|
-
*/
|
|
104
|
-
declare class ServiceDetectionError extends ServiceDetectionError_base<{
|
|
105
|
-
reason: string;
|
|
106
|
-
cause?: unknown;
|
|
107
|
-
}> {
|
|
108
|
-
}
|
|
109
|
-
declare const InitializationError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
110
|
-
readonly _tag: "InitializationError";
|
|
111
|
-
} & Readonly<A>;
|
|
112
|
-
/**
|
|
113
|
-
* Error when OpenTelemetry SDK initialization fails
|
|
114
|
-
*/
|
|
115
|
-
declare class InitializationError extends InitializationError_base<{
|
|
116
|
-
reason: string;
|
|
117
|
-
cause?: unknown;
|
|
118
|
-
}> {
|
|
119
|
-
}
|
|
120
|
-
declare const ExportError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
121
|
-
readonly _tag: "ExportError";
|
|
122
|
-
} & Readonly<A>;
|
|
123
|
-
/**
|
|
124
|
-
* Error when span export fails (e.g., ECONNREFUSED to collector)
|
|
125
|
-
*/
|
|
126
|
-
declare class ExportError extends ExportError_base<{
|
|
127
|
-
reason: string;
|
|
128
|
-
cause?: unknown;
|
|
129
|
-
}> {
|
|
130
|
-
}
|
|
131
|
-
declare const ShutdownError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
132
|
-
readonly _tag: "ShutdownError";
|
|
133
|
-
} & Readonly<A>;
|
|
134
|
-
/**
|
|
135
|
-
* Error when shutting down the SDK fails
|
|
136
|
-
*/
|
|
137
|
-
declare class ShutdownError extends ShutdownError_base<{
|
|
138
|
-
reason: string;
|
|
139
|
-
cause?: unknown;
|
|
140
|
-
}> {
|
|
141
|
-
}
|
|
142
|
-
|
|
143
48
|
/**
|
|
144
49
|
* Node.js configuration loader using Effect Platform
|
|
145
50
|
*
|
|
@@ -305,6 +210,101 @@ declare function shutdownSdk(): Promise<void>;
|
|
|
305
210
|
*/
|
|
306
211
|
declare function resetSdk(): void;
|
|
307
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Typed error hierarchy for @atrim/instrumentation
|
|
215
|
+
*
|
|
216
|
+
* These errors use Effect's Data.TaggedError for typed error handling
|
|
217
|
+
* with proper discriminated unions.
|
|
218
|
+
*/
|
|
219
|
+
declare const ConfigError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
220
|
+
readonly _tag: "ConfigError";
|
|
221
|
+
} & Readonly<A>;
|
|
222
|
+
/**
|
|
223
|
+
* Base error for configuration-related failures
|
|
224
|
+
*/
|
|
225
|
+
declare class ConfigError extends ConfigError_base<{
|
|
226
|
+
reason: string;
|
|
227
|
+
cause?: unknown;
|
|
228
|
+
}> {
|
|
229
|
+
}
|
|
230
|
+
declare const ConfigUrlError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
231
|
+
readonly _tag: "ConfigUrlError";
|
|
232
|
+
} & Readonly<A>;
|
|
233
|
+
/**
|
|
234
|
+
* Error when fetching configuration from a URL fails
|
|
235
|
+
*/
|
|
236
|
+
declare class ConfigUrlError extends ConfigUrlError_base<{
|
|
237
|
+
reason: string;
|
|
238
|
+
cause?: unknown;
|
|
239
|
+
}> {
|
|
240
|
+
}
|
|
241
|
+
declare const ConfigValidationError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
242
|
+
readonly _tag: "ConfigValidationError";
|
|
243
|
+
} & Readonly<A>;
|
|
244
|
+
/**
|
|
245
|
+
* Error when configuration validation fails (invalid YAML, schema mismatch)
|
|
246
|
+
*/
|
|
247
|
+
declare class ConfigValidationError extends ConfigValidationError_base<{
|
|
248
|
+
reason: string;
|
|
249
|
+
cause?: unknown;
|
|
250
|
+
}> {
|
|
251
|
+
}
|
|
252
|
+
declare const ConfigFileError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
253
|
+
readonly _tag: "ConfigFileError";
|
|
254
|
+
} & Readonly<A>;
|
|
255
|
+
/**
|
|
256
|
+
* Error when reading configuration from a file fails
|
|
257
|
+
*/
|
|
258
|
+
declare class ConfigFileError extends ConfigFileError_base<{
|
|
259
|
+
reason: string;
|
|
260
|
+
cause?: unknown;
|
|
261
|
+
}> {
|
|
262
|
+
}
|
|
263
|
+
declare const ServiceDetectionError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
264
|
+
readonly _tag: "ServiceDetectionError";
|
|
265
|
+
} & Readonly<A>;
|
|
266
|
+
/**
|
|
267
|
+
* Error when service detection fails (package.json not found, invalid format)
|
|
268
|
+
*/
|
|
269
|
+
declare class ServiceDetectionError extends ServiceDetectionError_base<{
|
|
270
|
+
reason: string;
|
|
271
|
+
cause?: unknown;
|
|
272
|
+
}> {
|
|
273
|
+
}
|
|
274
|
+
declare const InitializationError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
275
|
+
readonly _tag: "InitializationError";
|
|
276
|
+
} & Readonly<A>;
|
|
277
|
+
/**
|
|
278
|
+
* Error when OpenTelemetry SDK initialization fails
|
|
279
|
+
*/
|
|
280
|
+
declare class InitializationError extends InitializationError_base<{
|
|
281
|
+
reason: string;
|
|
282
|
+
cause?: unknown;
|
|
283
|
+
}> {
|
|
284
|
+
}
|
|
285
|
+
declare const ExportError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
286
|
+
readonly _tag: "ExportError";
|
|
287
|
+
} & Readonly<A>;
|
|
288
|
+
/**
|
|
289
|
+
* Error when span export fails (e.g., ECONNREFUSED to collector)
|
|
290
|
+
*/
|
|
291
|
+
declare class ExportError extends ExportError_base<{
|
|
292
|
+
reason: string;
|
|
293
|
+
cause?: unknown;
|
|
294
|
+
}> {
|
|
295
|
+
}
|
|
296
|
+
declare const ShutdownError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
297
|
+
readonly _tag: "ShutdownError";
|
|
298
|
+
} & Readonly<A>;
|
|
299
|
+
/**
|
|
300
|
+
* Error when shutting down the SDK fails
|
|
301
|
+
*/
|
|
302
|
+
declare class ShutdownError extends ShutdownError_base<{
|
|
303
|
+
reason: string;
|
|
304
|
+
cause?: unknown;
|
|
305
|
+
}> {
|
|
306
|
+
}
|
|
307
|
+
|
|
308
308
|
/**
|
|
309
309
|
* Public API for standard OpenTelemetry usage
|
|
310
310
|
*
|
|
@@ -398,6 +398,17 @@ declare function resetSdk(): void;
|
|
|
398
398
|
* })
|
|
399
399
|
* ```
|
|
400
400
|
*/
|
|
401
|
+
declare function initializeInstrumentation(options?: SdkInitializationOptions): Promise<NodeSDK | null>;
|
|
402
|
+
/**
|
|
403
|
+
* Legacy initialization function for pattern-only mode
|
|
404
|
+
*
|
|
405
|
+
* This function only initializes pattern matching without setting up the NodeSDK.
|
|
406
|
+
* Use this if you want to manually configure OpenTelemetry while still using
|
|
407
|
+
* pattern-based filtering.
|
|
408
|
+
*
|
|
409
|
+
* @deprecated Use initializeInstrumentation() instead for complete setup
|
|
410
|
+
*/
|
|
411
|
+
declare function initializePatternMatchingOnly(options?: SdkInitializationOptions): Promise<void>;
|
|
401
412
|
/**
|
|
402
413
|
* Initialize OpenTelemetry instrumentation (Effect version)
|
|
403
414
|
*
|
|
@@ -410,14 +421,15 @@ declare function resetSdk(): void;
|
|
|
410
421
|
* @example
|
|
411
422
|
* ```typescript
|
|
412
423
|
* import { Effect } from 'effect'
|
|
413
|
-
* import {
|
|
424
|
+
* import { initializeInstrumentationEffect } from '@atrim/instrumentation'
|
|
425
|
+
*
|
|
426
|
+
* // Basic usage
|
|
427
|
+
* const program = initializeInstrumentationEffect()
|
|
414
428
|
*
|
|
415
|
-
* // Zero-config initialization (recommended)
|
|
416
|
-
* const program = initializeInstrumentation()
|
|
417
429
|
* await Effect.runPromise(program)
|
|
418
430
|
*
|
|
419
431
|
* // With error handling
|
|
420
|
-
* const program =
|
|
432
|
+
* const program = initializeInstrumentationEffect().pipe(
|
|
421
433
|
* Effect.catchTag('ConfigError', (error) => {
|
|
422
434
|
* console.error('Config error:', error.reason)
|
|
423
435
|
* return Effect.succeed(null)
|
|
@@ -428,16 +440,18 @@ declare function resetSdk(): void;
|
|
|
428
440
|
* })
|
|
429
441
|
* )
|
|
430
442
|
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
443
|
+
* await Effect.runPromise(program)
|
|
444
|
+
*
|
|
445
|
+
* // With custom options
|
|
446
|
+
* const program = initializeInstrumentationEffect({
|
|
433
447
|
* otlp: { endpoint: 'https://otel.company.com:4318' },
|
|
434
448
|
* serviceName: 'my-service'
|
|
435
449
|
* })
|
|
436
450
|
* ```
|
|
437
451
|
*/
|
|
438
|
-
declare const
|
|
452
|
+
declare const initializeInstrumentationEffect: (options?: SdkInitializationOptions) => Effect.Effect<NodeSDK | null, InitializationError | ConfigError>;
|
|
439
453
|
/**
|
|
440
|
-
* Initialize pattern matching only
|
|
454
|
+
* Initialize pattern matching only (Effect version)
|
|
441
455
|
*
|
|
442
456
|
* Use this if you want manual OpenTelemetry setup with pattern filtering.
|
|
443
457
|
*
|
|
@@ -447,9 +461,9 @@ declare const initializeInstrumentation: (options?: SdkInitializationOptions) =>
|
|
|
447
461
|
* @example
|
|
448
462
|
* ```typescript
|
|
449
463
|
* import { Effect } from 'effect'
|
|
450
|
-
* import {
|
|
464
|
+
* import { initializePatternMatchingOnlyEffect } from '@atrim/instrumentation'
|
|
451
465
|
*
|
|
452
|
-
* const program =
|
|
466
|
+
* const program = initializePatternMatchingOnlyEffect({
|
|
453
467
|
* configPath: './instrumentation.yaml'
|
|
454
468
|
* }).pipe(
|
|
455
469
|
* Effect.catchAll((error) => {
|
|
@@ -461,7 +475,7 @@ declare const initializeInstrumentation: (options?: SdkInitializationOptions) =>
|
|
|
461
475
|
* await Effect.runPromise(program)
|
|
462
476
|
* ```
|
|
463
477
|
*/
|
|
464
|
-
declare const
|
|
478
|
+
declare const initializePatternMatchingOnlyEffect: (options?: SdkInitializationOptions) => Effect.Effect<void, ConfigError>;
|
|
465
479
|
|
|
466
480
|
/**
|
|
467
481
|
* Service Detection Utilities
|
|
@@ -508,6 +522,25 @@ declare const getServiceVersion: Effect.Effect<string | undefined, never>;
|
|
|
508
522
|
* Never fails - returns default ServiceInfo if detection fails
|
|
509
523
|
*/
|
|
510
524
|
declare const getServiceInfoWithFallback: Effect.Effect<ServiceInfo, never>;
|
|
525
|
+
/**
|
|
526
|
+
* Detect service name and version (Promise version)
|
|
527
|
+
*
|
|
528
|
+
* @deprecated Use `detectServiceInfo` Effect API for better error handling
|
|
529
|
+
* @returns Promise that resolves to ServiceInfo with fallback
|
|
530
|
+
*/
|
|
531
|
+
declare function detectServiceInfoAsync(): Promise<ServiceInfo>;
|
|
532
|
+
/**
|
|
533
|
+
* Get service name with fallback (Promise version)
|
|
534
|
+
*
|
|
535
|
+
* @deprecated Use `getServiceName` Effect API
|
|
536
|
+
*/
|
|
537
|
+
declare function getServiceNameAsync(): Promise<string>;
|
|
538
|
+
/**
|
|
539
|
+
* Get service version if available (Promise version)
|
|
540
|
+
*
|
|
541
|
+
* @deprecated Use `getServiceVersion` Effect API
|
|
542
|
+
*/
|
|
543
|
+
declare function getServiceVersionAsync(): Promise<string | undefined>;
|
|
511
544
|
|
|
512
545
|
/**
|
|
513
546
|
* OpenTelemetry SpanProcessor for pattern-based filtering
|
|
@@ -620,4 +653,4 @@ declare function annotateCacheOperation(span: Span$1, operation: 'get' | 'set' |
|
|
|
620
653
|
*/
|
|
621
654
|
declare function suppressShutdownErrors(): void;
|
|
622
655
|
|
|
623
|
-
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, detectServiceInfo, getOtlpEndpoint, getSdkInstance, getServiceInfoWithFallback, getServiceName, getServiceVersion, initializeInstrumentation, initializePatternMatchingOnly, loadConfig, loadConfigFromInline, loadConfigWithOptions, 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 };
|
package/target/dist/index.d.ts
CHANGED
|
@@ -45,101 +45,6 @@ declare function createOtlpExporter(options?: OtlpExporterOptions): OTLPTraceExp
|
|
|
45
45
|
*/
|
|
46
46
|
declare function getOtlpEndpoint(options?: OtlpExporterOptions): string;
|
|
47
47
|
|
|
48
|
-
/**
|
|
49
|
-
* Typed error hierarchy for @atrim/instrumentation
|
|
50
|
-
*
|
|
51
|
-
* These errors use Effect's Data.TaggedError for typed error handling
|
|
52
|
-
* with proper discriminated unions.
|
|
53
|
-
*/
|
|
54
|
-
declare const ConfigError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
55
|
-
readonly _tag: "ConfigError";
|
|
56
|
-
} & Readonly<A>;
|
|
57
|
-
/**
|
|
58
|
-
* Base error for configuration-related failures
|
|
59
|
-
*/
|
|
60
|
-
declare class ConfigError extends ConfigError_base<{
|
|
61
|
-
reason: string;
|
|
62
|
-
cause?: unknown;
|
|
63
|
-
}> {
|
|
64
|
-
}
|
|
65
|
-
declare const ConfigUrlError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
66
|
-
readonly _tag: "ConfigUrlError";
|
|
67
|
-
} & Readonly<A>;
|
|
68
|
-
/**
|
|
69
|
-
* Error when fetching configuration from a URL fails
|
|
70
|
-
*/
|
|
71
|
-
declare class ConfigUrlError extends ConfigUrlError_base<{
|
|
72
|
-
reason: string;
|
|
73
|
-
cause?: unknown;
|
|
74
|
-
}> {
|
|
75
|
-
}
|
|
76
|
-
declare const ConfigValidationError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
77
|
-
readonly _tag: "ConfigValidationError";
|
|
78
|
-
} & Readonly<A>;
|
|
79
|
-
/**
|
|
80
|
-
* Error when configuration validation fails (invalid YAML, schema mismatch)
|
|
81
|
-
*/
|
|
82
|
-
declare class ConfigValidationError extends ConfigValidationError_base<{
|
|
83
|
-
reason: string;
|
|
84
|
-
cause?: unknown;
|
|
85
|
-
}> {
|
|
86
|
-
}
|
|
87
|
-
declare const ConfigFileError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
88
|
-
readonly _tag: "ConfigFileError";
|
|
89
|
-
} & Readonly<A>;
|
|
90
|
-
/**
|
|
91
|
-
* Error when reading configuration from a file fails
|
|
92
|
-
*/
|
|
93
|
-
declare class ConfigFileError extends ConfigFileError_base<{
|
|
94
|
-
reason: string;
|
|
95
|
-
cause?: unknown;
|
|
96
|
-
}> {
|
|
97
|
-
}
|
|
98
|
-
declare const ServiceDetectionError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
99
|
-
readonly _tag: "ServiceDetectionError";
|
|
100
|
-
} & Readonly<A>;
|
|
101
|
-
/**
|
|
102
|
-
* Error when service detection fails (package.json not found, invalid format)
|
|
103
|
-
*/
|
|
104
|
-
declare class ServiceDetectionError extends ServiceDetectionError_base<{
|
|
105
|
-
reason: string;
|
|
106
|
-
cause?: unknown;
|
|
107
|
-
}> {
|
|
108
|
-
}
|
|
109
|
-
declare const InitializationError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
110
|
-
readonly _tag: "InitializationError";
|
|
111
|
-
} & Readonly<A>;
|
|
112
|
-
/**
|
|
113
|
-
* Error when OpenTelemetry SDK initialization fails
|
|
114
|
-
*/
|
|
115
|
-
declare class InitializationError extends InitializationError_base<{
|
|
116
|
-
reason: string;
|
|
117
|
-
cause?: unknown;
|
|
118
|
-
}> {
|
|
119
|
-
}
|
|
120
|
-
declare const ExportError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
121
|
-
readonly _tag: "ExportError";
|
|
122
|
-
} & Readonly<A>;
|
|
123
|
-
/**
|
|
124
|
-
* Error when span export fails (e.g., ECONNREFUSED to collector)
|
|
125
|
-
*/
|
|
126
|
-
declare class ExportError extends ExportError_base<{
|
|
127
|
-
reason: string;
|
|
128
|
-
cause?: unknown;
|
|
129
|
-
}> {
|
|
130
|
-
}
|
|
131
|
-
declare const ShutdownError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
132
|
-
readonly _tag: "ShutdownError";
|
|
133
|
-
} & Readonly<A>;
|
|
134
|
-
/**
|
|
135
|
-
* Error when shutting down the SDK fails
|
|
136
|
-
*/
|
|
137
|
-
declare class ShutdownError extends ShutdownError_base<{
|
|
138
|
-
reason: string;
|
|
139
|
-
cause?: unknown;
|
|
140
|
-
}> {
|
|
141
|
-
}
|
|
142
|
-
|
|
143
48
|
/**
|
|
144
49
|
* Node.js configuration loader using Effect Platform
|
|
145
50
|
*
|
|
@@ -305,6 +210,101 @@ declare function shutdownSdk(): Promise<void>;
|
|
|
305
210
|
*/
|
|
306
211
|
declare function resetSdk(): void;
|
|
307
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Typed error hierarchy for @atrim/instrumentation
|
|
215
|
+
*
|
|
216
|
+
* These errors use Effect's Data.TaggedError for typed error handling
|
|
217
|
+
* with proper discriminated unions.
|
|
218
|
+
*/
|
|
219
|
+
declare const ConfigError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
220
|
+
readonly _tag: "ConfigError";
|
|
221
|
+
} & Readonly<A>;
|
|
222
|
+
/**
|
|
223
|
+
* Base error for configuration-related failures
|
|
224
|
+
*/
|
|
225
|
+
declare class ConfigError extends ConfigError_base<{
|
|
226
|
+
reason: string;
|
|
227
|
+
cause?: unknown;
|
|
228
|
+
}> {
|
|
229
|
+
}
|
|
230
|
+
declare const ConfigUrlError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
231
|
+
readonly _tag: "ConfigUrlError";
|
|
232
|
+
} & Readonly<A>;
|
|
233
|
+
/**
|
|
234
|
+
* Error when fetching configuration from a URL fails
|
|
235
|
+
*/
|
|
236
|
+
declare class ConfigUrlError extends ConfigUrlError_base<{
|
|
237
|
+
reason: string;
|
|
238
|
+
cause?: unknown;
|
|
239
|
+
}> {
|
|
240
|
+
}
|
|
241
|
+
declare const ConfigValidationError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
242
|
+
readonly _tag: "ConfigValidationError";
|
|
243
|
+
} & Readonly<A>;
|
|
244
|
+
/**
|
|
245
|
+
* Error when configuration validation fails (invalid YAML, schema mismatch)
|
|
246
|
+
*/
|
|
247
|
+
declare class ConfigValidationError extends ConfigValidationError_base<{
|
|
248
|
+
reason: string;
|
|
249
|
+
cause?: unknown;
|
|
250
|
+
}> {
|
|
251
|
+
}
|
|
252
|
+
declare const ConfigFileError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
253
|
+
readonly _tag: "ConfigFileError";
|
|
254
|
+
} & Readonly<A>;
|
|
255
|
+
/**
|
|
256
|
+
* Error when reading configuration from a file fails
|
|
257
|
+
*/
|
|
258
|
+
declare class ConfigFileError extends ConfigFileError_base<{
|
|
259
|
+
reason: string;
|
|
260
|
+
cause?: unknown;
|
|
261
|
+
}> {
|
|
262
|
+
}
|
|
263
|
+
declare const ServiceDetectionError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
264
|
+
readonly _tag: "ServiceDetectionError";
|
|
265
|
+
} & Readonly<A>;
|
|
266
|
+
/**
|
|
267
|
+
* Error when service detection fails (package.json not found, invalid format)
|
|
268
|
+
*/
|
|
269
|
+
declare class ServiceDetectionError extends ServiceDetectionError_base<{
|
|
270
|
+
reason: string;
|
|
271
|
+
cause?: unknown;
|
|
272
|
+
}> {
|
|
273
|
+
}
|
|
274
|
+
declare const InitializationError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
275
|
+
readonly _tag: "InitializationError";
|
|
276
|
+
} & Readonly<A>;
|
|
277
|
+
/**
|
|
278
|
+
* Error when OpenTelemetry SDK initialization fails
|
|
279
|
+
*/
|
|
280
|
+
declare class InitializationError extends InitializationError_base<{
|
|
281
|
+
reason: string;
|
|
282
|
+
cause?: unknown;
|
|
283
|
+
}> {
|
|
284
|
+
}
|
|
285
|
+
declare const ExportError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
286
|
+
readonly _tag: "ExportError";
|
|
287
|
+
} & Readonly<A>;
|
|
288
|
+
/**
|
|
289
|
+
* Error when span export fails (e.g., ECONNREFUSED to collector)
|
|
290
|
+
*/
|
|
291
|
+
declare class ExportError extends ExportError_base<{
|
|
292
|
+
reason: string;
|
|
293
|
+
cause?: unknown;
|
|
294
|
+
}> {
|
|
295
|
+
}
|
|
296
|
+
declare const ShutdownError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
297
|
+
readonly _tag: "ShutdownError";
|
|
298
|
+
} & Readonly<A>;
|
|
299
|
+
/**
|
|
300
|
+
* Error when shutting down the SDK fails
|
|
301
|
+
*/
|
|
302
|
+
declare class ShutdownError extends ShutdownError_base<{
|
|
303
|
+
reason: string;
|
|
304
|
+
cause?: unknown;
|
|
305
|
+
}> {
|
|
306
|
+
}
|
|
307
|
+
|
|
308
308
|
/**
|
|
309
309
|
* Public API for standard OpenTelemetry usage
|
|
310
310
|
*
|
|
@@ -398,6 +398,17 @@ declare function resetSdk(): void;
|
|
|
398
398
|
* })
|
|
399
399
|
* ```
|
|
400
400
|
*/
|
|
401
|
+
declare function initializeInstrumentation(options?: SdkInitializationOptions): Promise<NodeSDK | null>;
|
|
402
|
+
/**
|
|
403
|
+
* Legacy initialization function for pattern-only mode
|
|
404
|
+
*
|
|
405
|
+
* This function only initializes pattern matching without setting up the NodeSDK.
|
|
406
|
+
* Use this if you want to manually configure OpenTelemetry while still using
|
|
407
|
+
* pattern-based filtering.
|
|
408
|
+
*
|
|
409
|
+
* @deprecated Use initializeInstrumentation() instead for complete setup
|
|
410
|
+
*/
|
|
411
|
+
declare function initializePatternMatchingOnly(options?: SdkInitializationOptions): Promise<void>;
|
|
401
412
|
/**
|
|
402
413
|
* Initialize OpenTelemetry instrumentation (Effect version)
|
|
403
414
|
*
|
|
@@ -410,14 +421,15 @@ declare function resetSdk(): void;
|
|
|
410
421
|
* @example
|
|
411
422
|
* ```typescript
|
|
412
423
|
* import { Effect } from 'effect'
|
|
413
|
-
* import {
|
|
424
|
+
* import { initializeInstrumentationEffect } from '@atrim/instrumentation'
|
|
425
|
+
*
|
|
426
|
+
* // Basic usage
|
|
427
|
+
* const program = initializeInstrumentationEffect()
|
|
414
428
|
*
|
|
415
|
-
* // Zero-config initialization (recommended)
|
|
416
|
-
* const program = initializeInstrumentation()
|
|
417
429
|
* await Effect.runPromise(program)
|
|
418
430
|
*
|
|
419
431
|
* // With error handling
|
|
420
|
-
* const program =
|
|
432
|
+
* const program = initializeInstrumentationEffect().pipe(
|
|
421
433
|
* Effect.catchTag('ConfigError', (error) => {
|
|
422
434
|
* console.error('Config error:', error.reason)
|
|
423
435
|
* return Effect.succeed(null)
|
|
@@ -428,16 +440,18 @@ declare function resetSdk(): void;
|
|
|
428
440
|
* })
|
|
429
441
|
* )
|
|
430
442
|
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
443
|
+
* await Effect.runPromise(program)
|
|
444
|
+
*
|
|
445
|
+
* // With custom options
|
|
446
|
+
* const program = initializeInstrumentationEffect({
|
|
433
447
|
* otlp: { endpoint: 'https://otel.company.com:4318' },
|
|
434
448
|
* serviceName: 'my-service'
|
|
435
449
|
* })
|
|
436
450
|
* ```
|
|
437
451
|
*/
|
|
438
|
-
declare const
|
|
452
|
+
declare const initializeInstrumentationEffect: (options?: SdkInitializationOptions) => Effect.Effect<NodeSDK | null, InitializationError | ConfigError>;
|
|
439
453
|
/**
|
|
440
|
-
* Initialize pattern matching only
|
|
454
|
+
* Initialize pattern matching only (Effect version)
|
|
441
455
|
*
|
|
442
456
|
* Use this if you want manual OpenTelemetry setup with pattern filtering.
|
|
443
457
|
*
|
|
@@ -447,9 +461,9 @@ declare const initializeInstrumentation: (options?: SdkInitializationOptions) =>
|
|
|
447
461
|
* @example
|
|
448
462
|
* ```typescript
|
|
449
463
|
* import { Effect } from 'effect'
|
|
450
|
-
* import {
|
|
464
|
+
* import { initializePatternMatchingOnlyEffect } from '@atrim/instrumentation'
|
|
451
465
|
*
|
|
452
|
-
* const program =
|
|
466
|
+
* const program = initializePatternMatchingOnlyEffect({
|
|
453
467
|
* configPath: './instrumentation.yaml'
|
|
454
468
|
* }).pipe(
|
|
455
469
|
* Effect.catchAll((error) => {
|
|
@@ -461,7 +475,7 @@ declare const initializeInstrumentation: (options?: SdkInitializationOptions) =>
|
|
|
461
475
|
* await Effect.runPromise(program)
|
|
462
476
|
* ```
|
|
463
477
|
*/
|
|
464
|
-
declare const
|
|
478
|
+
declare const initializePatternMatchingOnlyEffect: (options?: SdkInitializationOptions) => Effect.Effect<void, ConfigError>;
|
|
465
479
|
|
|
466
480
|
/**
|
|
467
481
|
* Service Detection Utilities
|
|
@@ -508,6 +522,25 @@ declare const getServiceVersion: Effect.Effect<string | undefined, never>;
|
|
|
508
522
|
* Never fails - returns default ServiceInfo if detection fails
|
|
509
523
|
*/
|
|
510
524
|
declare const getServiceInfoWithFallback: Effect.Effect<ServiceInfo, never>;
|
|
525
|
+
/**
|
|
526
|
+
* Detect service name and version (Promise version)
|
|
527
|
+
*
|
|
528
|
+
* @deprecated Use `detectServiceInfo` Effect API for better error handling
|
|
529
|
+
* @returns Promise that resolves to ServiceInfo with fallback
|
|
530
|
+
*/
|
|
531
|
+
declare function detectServiceInfoAsync(): Promise<ServiceInfo>;
|
|
532
|
+
/**
|
|
533
|
+
* Get service name with fallback (Promise version)
|
|
534
|
+
*
|
|
535
|
+
* @deprecated Use `getServiceName` Effect API
|
|
536
|
+
*/
|
|
537
|
+
declare function getServiceNameAsync(): Promise<string>;
|
|
538
|
+
/**
|
|
539
|
+
* Get service version if available (Promise version)
|
|
540
|
+
*
|
|
541
|
+
* @deprecated Use `getServiceVersion` Effect API
|
|
542
|
+
*/
|
|
543
|
+
declare function getServiceVersionAsync(): Promise<string | undefined>;
|
|
511
544
|
|
|
512
545
|
/**
|
|
513
546
|
* OpenTelemetry SpanProcessor for pattern-based filtering
|
|
@@ -620,4 +653,4 @@ declare function annotateCacheOperation(span: Span$1, operation: 'get' | 'set' |
|
|
|
620
653
|
*/
|
|
621
654
|
declare function suppressShutdownErrors(): void;
|
|
622
655
|
|
|
623
|
-
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, detectServiceInfo, getOtlpEndpoint, getSdkInstance, getServiceInfoWithFallback, getServiceName, getServiceVersion, initializeInstrumentation, initializePatternMatchingOnly, loadConfig, loadConfigFromInline, loadConfigWithOptions, 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 };
|