@atrim/instrument-node 0.4.1 → 0.5.0-c05e3a1-20251119131235
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 +4 -4
- package/target/dist/index.cjs +72 -75
- package/target/dist/index.cjs.map +1 -1
- package/target/dist/index.d.cts +107 -140
- package/target/dist/index.d.ts +107 -140
- package/target/dist/index.js +71 -69
- package/target/dist/index.js.map +1 -1
- package/target/dist/integrations/effect/index.cjs +14 -1
- package/target/dist/integrations/effect/index.cjs.map +1 -1
- package/target/dist/integrations/effect/index.js +14 -1
- package/target/dist/integrations/effect/index.js.map +1 -1
package/target/dist/index.d.cts
CHANGED
|
@@ -45,6 +45,101 @@ 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
|
+
|
|
48
143
|
/**
|
|
49
144
|
* Node.js configuration loader using Effect Platform
|
|
50
145
|
*
|
|
@@ -210,101 +305,6 @@ declare function shutdownSdk(): Promise<void>;
|
|
|
210
305
|
*/
|
|
211
306
|
declare function resetSdk(): void;
|
|
212
307
|
|
|
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,17 +398,6 @@ declare class ShutdownError extends ShutdownError_base<{
|
|
|
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>;
|
|
412
401
|
/**
|
|
413
402
|
* Initialize OpenTelemetry instrumentation (Effect version)
|
|
414
403
|
*
|
|
@@ -421,15 +410,14 @@ declare function initializePatternMatchingOnly(options?: SdkInitializationOption
|
|
|
421
410
|
* @example
|
|
422
411
|
* ```typescript
|
|
423
412
|
* import { Effect } from 'effect'
|
|
424
|
-
* import {
|
|
425
|
-
*
|
|
426
|
-
* // Basic usage
|
|
427
|
-
* const program = initializeInstrumentationEffect()
|
|
413
|
+
* import { initializeInstrumentation } from '@atrim/instrumentation'
|
|
428
414
|
*
|
|
415
|
+
* // Zero-config initialization (recommended)
|
|
416
|
+
* const program = initializeInstrumentation()
|
|
429
417
|
* await Effect.runPromise(program)
|
|
430
418
|
*
|
|
431
419
|
* // With error handling
|
|
432
|
-
* const program =
|
|
420
|
+
* const program = initializeInstrumentation().pipe(
|
|
433
421
|
* Effect.catchTag('ConfigError', (error) => {
|
|
434
422
|
* console.error('Config error:', error.reason)
|
|
435
423
|
* return Effect.succeed(null)
|
|
@@ -440,18 +428,16 @@ declare function initializePatternMatchingOnly(options?: SdkInitializationOption
|
|
|
440
428
|
* })
|
|
441
429
|
* )
|
|
442
430
|
*
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
* // With custom options
|
|
446
|
-
* const program = initializeInstrumentationEffect({
|
|
431
|
+
* // With custom OTLP endpoint
|
|
432
|
+
* const program = initializeInstrumentation({
|
|
447
433
|
* otlp: { endpoint: 'https://otel.company.com:4318' },
|
|
448
434
|
* serviceName: 'my-service'
|
|
449
435
|
* })
|
|
450
436
|
* ```
|
|
451
437
|
*/
|
|
452
|
-
declare const
|
|
438
|
+
declare const initializeInstrumentation: (options?: SdkInitializationOptions) => Effect.Effect<NodeSDK | null, InitializationError | ConfigError>;
|
|
453
439
|
/**
|
|
454
|
-
* Initialize pattern matching only
|
|
440
|
+
* Initialize pattern matching only
|
|
455
441
|
*
|
|
456
442
|
* Use this if you want manual OpenTelemetry setup with pattern filtering.
|
|
457
443
|
*
|
|
@@ -461,9 +447,9 @@ declare const initializeInstrumentationEffect: (options?: SdkInitializationOptio
|
|
|
461
447
|
* @example
|
|
462
448
|
* ```typescript
|
|
463
449
|
* import { Effect } from 'effect'
|
|
464
|
-
* import {
|
|
450
|
+
* import { initializePatternMatchingOnly } from '@atrim/instrumentation'
|
|
465
451
|
*
|
|
466
|
-
* const program =
|
|
452
|
+
* const program = initializePatternMatchingOnly({
|
|
467
453
|
* configPath: './instrumentation.yaml'
|
|
468
454
|
* }).pipe(
|
|
469
455
|
* Effect.catchAll((error) => {
|
|
@@ -475,7 +461,7 @@ declare const initializeInstrumentationEffect: (options?: SdkInitializationOptio
|
|
|
475
461
|
* await Effect.runPromise(program)
|
|
476
462
|
* ```
|
|
477
463
|
*/
|
|
478
|
-
declare const
|
|
464
|
+
declare const initializePatternMatchingOnly: (options?: SdkInitializationOptions) => Effect.Effect<void, ConfigError>;
|
|
479
465
|
|
|
480
466
|
/**
|
|
481
467
|
* Service Detection Utilities
|
|
@@ -522,25 +508,6 @@ declare const getServiceVersion: Effect.Effect<string | undefined, never>;
|
|
|
522
508
|
* Never fails - returns default ServiceInfo if detection fails
|
|
523
509
|
*/
|
|
524
510
|
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>;
|
|
544
511
|
|
|
545
512
|
/**
|
|
546
513
|
* OpenTelemetry SpanProcessor for pattern-based filtering
|
|
@@ -653,4 +620,4 @@ declare function annotateCacheOperation(span: Span$1, operation: 'get' | 'set' |
|
|
|
653
620
|
*/
|
|
654
621
|
declare function suppressShutdownErrors(): void;
|
|
655
622
|
|
|
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,
|
|
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 };
|
package/target/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,101 @@ 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
|
+
|
|
48
143
|
/**
|
|
49
144
|
* Node.js configuration loader using Effect Platform
|
|
50
145
|
*
|
|
@@ -210,101 +305,6 @@ declare function shutdownSdk(): Promise<void>;
|
|
|
210
305
|
*/
|
|
211
306
|
declare function resetSdk(): void;
|
|
212
307
|
|
|
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,17 +398,6 @@ declare class ShutdownError extends ShutdownError_base<{
|
|
|
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>;
|
|
412
401
|
/**
|
|
413
402
|
* Initialize OpenTelemetry instrumentation (Effect version)
|
|
414
403
|
*
|
|
@@ -421,15 +410,14 @@ declare function initializePatternMatchingOnly(options?: SdkInitializationOption
|
|
|
421
410
|
* @example
|
|
422
411
|
* ```typescript
|
|
423
412
|
* import { Effect } from 'effect'
|
|
424
|
-
* import {
|
|
425
|
-
*
|
|
426
|
-
* // Basic usage
|
|
427
|
-
* const program = initializeInstrumentationEffect()
|
|
413
|
+
* import { initializeInstrumentation } from '@atrim/instrumentation'
|
|
428
414
|
*
|
|
415
|
+
* // Zero-config initialization (recommended)
|
|
416
|
+
* const program = initializeInstrumentation()
|
|
429
417
|
* await Effect.runPromise(program)
|
|
430
418
|
*
|
|
431
419
|
* // With error handling
|
|
432
|
-
* const program =
|
|
420
|
+
* const program = initializeInstrumentation().pipe(
|
|
433
421
|
* Effect.catchTag('ConfigError', (error) => {
|
|
434
422
|
* console.error('Config error:', error.reason)
|
|
435
423
|
* return Effect.succeed(null)
|
|
@@ -440,18 +428,16 @@ declare function initializePatternMatchingOnly(options?: SdkInitializationOption
|
|
|
440
428
|
* })
|
|
441
429
|
* )
|
|
442
430
|
*
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
* // With custom options
|
|
446
|
-
* const program = initializeInstrumentationEffect({
|
|
431
|
+
* // With custom OTLP endpoint
|
|
432
|
+
* const program = initializeInstrumentation({
|
|
447
433
|
* otlp: { endpoint: 'https://otel.company.com:4318' },
|
|
448
434
|
* serviceName: 'my-service'
|
|
449
435
|
* })
|
|
450
436
|
* ```
|
|
451
437
|
*/
|
|
452
|
-
declare const
|
|
438
|
+
declare const initializeInstrumentation: (options?: SdkInitializationOptions) => Effect.Effect<NodeSDK | null, InitializationError | ConfigError>;
|
|
453
439
|
/**
|
|
454
|
-
* Initialize pattern matching only
|
|
440
|
+
* Initialize pattern matching only
|
|
455
441
|
*
|
|
456
442
|
* Use this if you want manual OpenTelemetry setup with pattern filtering.
|
|
457
443
|
*
|
|
@@ -461,9 +447,9 @@ declare const initializeInstrumentationEffect: (options?: SdkInitializationOptio
|
|
|
461
447
|
* @example
|
|
462
448
|
* ```typescript
|
|
463
449
|
* import { Effect } from 'effect'
|
|
464
|
-
* import {
|
|
450
|
+
* import { initializePatternMatchingOnly } from '@atrim/instrumentation'
|
|
465
451
|
*
|
|
466
|
-
* const program =
|
|
452
|
+
* const program = initializePatternMatchingOnly({
|
|
467
453
|
* configPath: './instrumentation.yaml'
|
|
468
454
|
* }).pipe(
|
|
469
455
|
* Effect.catchAll((error) => {
|
|
@@ -475,7 +461,7 @@ declare const initializeInstrumentationEffect: (options?: SdkInitializationOptio
|
|
|
475
461
|
* await Effect.runPromise(program)
|
|
476
462
|
* ```
|
|
477
463
|
*/
|
|
478
|
-
declare const
|
|
464
|
+
declare const initializePatternMatchingOnly: (options?: SdkInitializationOptions) => Effect.Effect<void, ConfigError>;
|
|
479
465
|
|
|
480
466
|
/**
|
|
481
467
|
* Service Detection Utilities
|
|
@@ -522,25 +508,6 @@ declare const getServiceVersion: Effect.Effect<string | undefined, never>;
|
|
|
522
508
|
* Never fails - returns default ServiceInfo if detection fails
|
|
523
509
|
*/
|
|
524
510
|
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>;
|
|
544
511
|
|
|
545
512
|
/**
|
|
546
513
|
* OpenTelemetry SpanProcessor for pattern-based filtering
|
|
@@ -653,4 +620,4 @@ declare function annotateCacheOperation(span: Span$1, operation: 'get' | 'set' |
|
|
|
653
620
|
*/
|
|
654
621
|
declare function suppressShutdownErrors(): void;
|
|
655
622
|
|
|
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,
|
|
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 };
|