@atrim/instrument-node 0.1.3-12a8f92-20251118011211

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.
@@ -0,0 +1,602 @@
1
+ import { Effect } from 'effect';
2
+ import { NodeSDKConfiguration, NodeSDK } from '@opentelemetry/sdk-node';
3
+ import { Instrumentation } from '@opentelemetry/instrumentation';
4
+ import { RequestOptions, IncomingMessage } from 'node:http';
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';
8
+ import * as effect_Cause from 'effect/Cause';
9
+ import * as effect_Types from 'effect/Types';
10
+ import { SpanProcessor, Span, ReadableSpan } from '@opentelemetry/sdk-trace-base';
11
+ import { Context, Span as Span$1 } from '@opentelemetry/api';
12
+
13
+ /**
14
+ * OTLP Exporter Factory
15
+ *
16
+ * Creates and configures OTLP trace exporters with smart defaults
17
+ */
18
+
19
+ interface OtlpExporterOptions {
20
+ /**
21
+ * OTLP endpoint URL
22
+ * Defaults to OTEL_EXPORTER_OTLP_ENDPOINT or http://localhost:4318/v1/traces
23
+ */
24
+ endpoint?: string;
25
+ /**
26
+ * Custom headers to send with requests
27
+ * Useful for authentication, custom routing, etc.
28
+ */
29
+ headers?: Record<string, string>;
30
+ }
31
+ /**
32
+ * Create an OTLP trace exporter with smart defaults
33
+ *
34
+ * Priority for endpoint:
35
+ * 1. Explicit endpoint option
36
+ * 2. OTEL_EXPORTER_OTLP_TRACES_ENDPOINT environment variable
37
+ * 3. OTEL_EXPORTER_OTLP_ENDPOINT environment variable
38
+ * 4. Default: http://localhost:4318/v1/traces
39
+ */
40
+ declare function createOtlpExporter(options?: OtlpExporterOptions): OTLPTraceExporter;
41
+ /**
42
+ * Get the OTLP endpoint that would be used with current configuration
43
+ *
44
+ * Useful for debugging and logging
45
+ */
46
+ declare function getOtlpEndpoint(options?: OtlpExporterOptions): string;
47
+
48
+ /**
49
+ * NodeSDK Initialization
50
+ *
51
+ * Provides comprehensive OpenTelemetry SDK initialization with smart defaults
52
+ */
53
+
54
+ interface SdkInitializationOptions extends ConfigLoaderOptions {
55
+ /**
56
+ * OTLP exporter configuration
57
+ */
58
+ otlp?: OtlpExporterOptions;
59
+ /**
60
+ * Service name
61
+ * If not provided, auto-detects from OTEL_SERVICE_NAME or package.json
62
+ */
63
+ serviceName?: string;
64
+ /**
65
+ * Service version
66
+ * If not provided, auto-detects from OTEL_SERVICE_VERSION or package.json
67
+ */
68
+ serviceVersion?: string;
69
+ /**
70
+ * Enable auto-instrumentation
71
+ * Default: auto-detected based on your runtime and framework
72
+ * - true: Enables Express, HTTP, and other common instrumentations
73
+ * - false: Disables all auto-instrumentation (manual spans only)
74
+ * - undefined: Smart detection (checks for Effect-TS usage)
75
+ */
76
+ autoInstrument?: boolean;
77
+ /**
78
+ * Custom instrumentations to add
79
+ * These are added in addition to auto-instrumentations (if enabled)
80
+ */
81
+ instrumentations?: Instrumentation[];
82
+ /**
83
+ * Advanced: Full NodeSDK configuration override
84
+ * Provides complete control over SDK initialization
85
+ */
86
+ sdk?: Partial<NodeSDKConfiguration>;
87
+ /**
88
+ * Disable automatic shutdown handler registration
89
+ * Default: false (automatic shutdown is enabled)
90
+ */
91
+ disableAutoShutdown?: boolean;
92
+ /**
93
+ * HTTP instrumentation filtering configuration
94
+ *
95
+ * Allows filtering of HTTP requests to prevent noisy traces
96
+ * (e.g., health checks, OTLP exports, internal endpoints)
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * // Pattern-based filtering
101
+ * http: {
102
+ * ignoreOutgoingUrls: [/\/health$/, /\/v1\/traces$/],
103
+ * ignoreIncomingPaths: [/^\/health$/]
104
+ * }
105
+ *
106
+ * // Custom hook for advanced filtering
107
+ * http: {
108
+ * ignoreOutgoingRequestHook: (req) => {
109
+ * const path = req.path || ''
110
+ * return path.includes('otel-collector')
111
+ * }
112
+ * }
113
+ * ```
114
+ */
115
+ http?: {
116
+ /**
117
+ * URL patterns to ignore for outgoing HTTP requests
118
+ * Can be strings or RegExp patterns
119
+ */
120
+ ignoreOutgoingUrls?: (string | RegExp)[];
121
+ /**
122
+ * Path patterns to ignore for incoming HTTP requests
123
+ * Can be strings or RegExp patterns
124
+ */
125
+ ignoreIncomingPaths?: (string | RegExp)[];
126
+ /**
127
+ * Custom hook for filtering outgoing HTTP requests
128
+ * Return true to ignore the request (no span created)
129
+ *
130
+ * Note: The request parameter is RequestOptions (from http.request()),
131
+ * not the ClientRequest object
132
+ */
133
+ ignoreOutgoingRequestHook?: (req: RequestOptions) => boolean;
134
+ /**
135
+ * Custom hook for filtering incoming HTTP requests
136
+ * Return true to ignore the request (no span created)
137
+ */
138
+ ignoreIncomingRequestHook?: (req: IncomingMessage) => boolean;
139
+ /**
140
+ * Require parent span for outgoing requests
141
+ * Prevents root spans for HTTP calls (useful for avoiding noise)
142
+ */
143
+ requireParentForOutgoingSpans?: boolean;
144
+ };
145
+ }
146
+ /**
147
+ * Get the current SDK instance
148
+ */
149
+ declare function getSdkInstance(): NodeSDK | null;
150
+ /**
151
+ * Shutdown the SDK
152
+ */
153
+ declare function shutdownSdk(): Promise<void>;
154
+ /**
155
+ * Reset SDK instance (useful for testing)
156
+ */
157
+ declare function resetSdk(): void;
158
+
159
+ /**
160
+ * Typed error hierarchy for @atrim/instrumentation
161
+ *
162
+ * These errors use Effect's Data.TaggedError for typed error handling
163
+ * with proper discriminated unions.
164
+ */
165
+ 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 & {
166
+ readonly _tag: "ConfigError";
167
+ } & Readonly<A>;
168
+ /**
169
+ * Base error for configuration-related failures
170
+ */
171
+ declare class ConfigError extends ConfigError_base<{
172
+ reason: string;
173
+ cause?: unknown;
174
+ }> {
175
+ }
176
+ 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 & {
177
+ readonly _tag: "ConfigUrlError";
178
+ } & Readonly<A>;
179
+ /**
180
+ * Error when fetching configuration from a URL fails
181
+ */
182
+ declare class ConfigUrlError extends ConfigUrlError_base<{
183
+ reason: string;
184
+ cause?: unknown;
185
+ }> {
186
+ }
187
+ 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 & {
188
+ readonly _tag: "ConfigValidationError";
189
+ } & Readonly<A>;
190
+ /**
191
+ * Error when configuration validation fails (invalid YAML, schema mismatch)
192
+ */
193
+ declare class ConfigValidationError extends ConfigValidationError_base<{
194
+ reason: string;
195
+ cause?: unknown;
196
+ }> {
197
+ }
198
+ 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 & {
199
+ readonly _tag: "ConfigFileError";
200
+ } & Readonly<A>;
201
+ /**
202
+ * Error when reading configuration from a file fails
203
+ */
204
+ declare class ConfigFileError extends ConfigFileError_base<{
205
+ reason: string;
206
+ cause?: unknown;
207
+ }> {
208
+ }
209
+ 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 & {
210
+ readonly _tag: "ServiceDetectionError";
211
+ } & Readonly<A>;
212
+ /**
213
+ * Error when service detection fails (package.json not found, invalid format)
214
+ */
215
+ declare class ServiceDetectionError extends ServiceDetectionError_base<{
216
+ reason: string;
217
+ cause?: unknown;
218
+ }> {
219
+ }
220
+ 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 & {
221
+ readonly _tag: "InitializationError";
222
+ } & Readonly<A>;
223
+ /**
224
+ * Error when OpenTelemetry SDK initialization fails
225
+ */
226
+ declare class InitializationError extends InitializationError_base<{
227
+ reason: string;
228
+ cause?: unknown;
229
+ }> {
230
+ }
231
+ 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 & {
232
+ readonly _tag: "ExportError";
233
+ } & Readonly<A>;
234
+ /**
235
+ * Error when span export fails (e.g., ECONNREFUSED to collector)
236
+ */
237
+ declare class ExportError extends ExportError_base<{
238
+ reason: string;
239
+ cause?: unknown;
240
+ }> {
241
+ }
242
+ 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 & {
243
+ readonly _tag: "ShutdownError";
244
+ } & Readonly<A>;
245
+ /**
246
+ * Error when shutting down the SDK fails
247
+ */
248
+ declare class ShutdownError extends ShutdownError_base<{
249
+ reason: string;
250
+ cause?: unknown;
251
+ }> {
252
+ }
253
+
254
+ /**
255
+ * Public API for standard OpenTelemetry usage
256
+ *
257
+ * This module provides the main entry point for complete OpenTelemetry
258
+ * initialization including NodeSDK, OTLP export, and pattern-based filtering.
259
+ *
260
+ * Available in two flavors:
261
+ * - Effect API (primary): For typed error handling and composability
262
+ * - Promise API (backward compatible): For traditional async/await usage
263
+ */
264
+
265
+ /**
266
+ * Initialize OpenTelemetry instrumentation with complete SDK setup
267
+ *
268
+ * This function provides a single-line initialization for OpenTelemetry:
269
+ * - Loads instrumentation.yaml configuration
270
+ * - Creates and configures OTLP exporter
271
+ * - Sets up pattern-based span filtering
272
+ * - Initializes NodeSDK with auto-instrumentations
273
+ * - Registers graceful shutdown handlers
274
+ *
275
+ * Configuration priority (highest to lowest):
276
+ * 1. Explicit config object (options.config)
277
+ * 2. Environment variable (ATRIM_INSTRUMENTATION_CONFIG)
278
+ * 3. Explicit path/URL (options.configPath or options.configUrl)
279
+ * 4. Project root file (./instrumentation.yaml)
280
+ * 5. Default config (built-in defaults)
281
+ *
282
+ * OTLP endpoint priority:
283
+ * 1. options.otlp.endpoint
284
+ * 2. OTEL_EXPORTER_OTLP_TRACES_ENDPOINT environment variable
285
+ * 3. OTEL_EXPORTER_OTLP_ENDPOINT environment variable
286
+ * 4. Default: http://localhost:4318/v1/traces
287
+ *
288
+ * Service name priority:
289
+ * 1. options.serviceName
290
+ * 2. OTEL_SERVICE_NAME environment variable
291
+ * 3. package.json name field
292
+ * 4. Default: 'unknown-service'
293
+ *
294
+ * @param options - Initialization options
295
+ * @returns The initialized NodeSDK instance
296
+ *
297
+ * @example
298
+ * ```typescript
299
+ * // Zero-config initialization (recommended)
300
+ * await initializeInstrumentation()
301
+ * // Auto-detects everything from env vars and package.json
302
+ *
303
+ * // With custom OTLP endpoint
304
+ * await initializeInstrumentation({
305
+ * otlp: {
306
+ * endpoint: 'https://otel-collector.company.com:4318'
307
+ * }
308
+ * })
309
+ *
310
+ * // With custom service name
311
+ * await initializeInstrumentation({
312
+ * serviceName: 'my-api-service',
313
+ * serviceVersion: '2.0.0'
314
+ * })
315
+ *
316
+ * // Disable auto-instrumentation (manual spans only)
317
+ * await initializeInstrumentation({
318
+ * autoInstrument: false
319
+ * })
320
+ *
321
+ * // With custom config file
322
+ * await initializeInstrumentation({
323
+ * configPath: './config/custom-instrumentation.yaml'
324
+ * })
325
+ *
326
+ * // With remote config URL
327
+ * await initializeInstrumentation({
328
+ * configUrl: 'https://config.company.com/instrumentation.yaml',
329
+ * cacheTimeout: 300_000 // 5 minutes
330
+ * })
331
+ *
332
+ * // Advanced: Full control
333
+ * await initializeInstrumentation({
334
+ * otlp: {
335
+ * endpoint: process.env.CUSTOM_ENDPOINT,
336
+ * headers: { 'x-api-key': 'secret' }
337
+ * },
338
+ * serviceName: 'my-service',
339
+ * autoInstrument: true,
340
+ * instrumentations: [], // custom instrumentations
341
+ * sdk: {
342
+ * // Additional NodeSDK configuration
343
+ * }
344
+ * })
345
+ * ```
346
+ */
347
+ declare function initializeInstrumentation(options?: SdkInitializationOptions): Promise<NodeSDK | null>;
348
+ /**
349
+ * Legacy initialization function for pattern-only mode
350
+ *
351
+ * This function only initializes pattern matching without setting up the NodeSDK.
352
+ * Use this if you want to manually configure OpenTelemetry while still using
353
+ * pattern-based filtering.
354
+ *
355
+ * @deprecated Use initializeInstrumentation() instead for complete setup
356
+ */
357
+ declare function initializePatternMatchingOnly(options?: SdkInitializationOptions): Promise<void>;
358
+ /**
359
+ * Initialize OpenTelemetry instrumentation (Effect version)
360
+ *
361
+ * Provides typed error handling and composability with Effect ecosystem.
362
+ * All errors are returned in the error channel, not thrown.
363
+ *
364
+ * @param options - Initialization options
365
+ * @returns Effect that yields the initialized NodeSDK or null
366
+ *
367
+ * @example
368
+ * ```typescript
369
+ * import { Effect } from 'effect'
370
+ * import { initializeInstrumentationEffect } from '@atrim/instrumentation'
371
+ *
372
+ * // Basic usage
373
+ * const program = initializeInstrumentationEffect()
374
+ *
375
+ * await Effect.runPromise(program)
376
+ *
377
+ * // With error handling
378
+ * const program = initializeInstrumentationEffect().pipe(
379
+ * Effect.catchTag('ConfigError', (error) => {
380
+ * console.error('Config error:', error.reason)
381
+ * return Effect.succeed(null)
382
+ * }),
383
+ * Effect.catchTag('InitializationError', (error) => {
384
+ * console.error('Init error:', error.reason)
385
+ * return Effect.succeed(null)
386
+ * })
387
+ * )
388
+ *
389
+ * await Effect.runPromise(program)
390
+ *
391
+ * // With custom options
392
+ * const program = initializeInstrumentationEffect({
393
+ * otlp: { endpoint: 'https://otel.company.com:4318' },
394
+ * serviceName: 'my-service'
395
+ * })
396
+ * ```
397
+ */
398
+ declare const initializeInstrumentationEffect: (options?: SdkInitializationOptions) => Effect.Effect<NodeSDK | null, InitializationError | ConfigError>;
399
+ /**
400
+ * Initialize pattern matching only (Effect version)
401
+ *
402
+ * Use this if you want manual OpenTelemetry setup with pattern filtering.
403
+ *
404
+ * @param options - Configuration options
405
+ * @returns Effect that yields void
406
+ *
407
+ * @example
408
+ * ```typescript
409
+ * import { Effect } from 'effect'
410
+ * import { initializePatternMatchingOnlyEffect } from '@atrim/instrumentation'
411
+ *
412
+ * const program = initializePatternMatchingOnlyEffect({
413
+ * configPath: './instrumentation.yaml'
414
+ * }).pipe(
415
+ * Effect.catchAll((error) => {
416
+ * console.error('Pattern matching setup failed:', error.reason)
417
+ * return Effect.succeed(undefined)
418
+ * })
419
+ * )
420
+ *
421
+ * await Effect.runPromise(program)
422
+ * ```
423
+ */
424
+ declare const initializePatternMatchingOnlyEffect: (options?: SdkInitializationOptions) => Effect.Effect<void, ConfigError>;
425
+
426
+ /**
427
+ * Service Detection Utilities
428
+ *
429
+ * Auto-detects service name and version from environment variables and package.json
430
+ * Uses Effect for typed error handling and composability
431
+ */
432
+
433
+ interface ServiceInfo {
434
+ name: string;
435
+ version?: string | undefined;
436
+ }
437
+ /**
438
+ * Detect service name and version (Effect version)
439
+ *
440
+ * Priority order:
441
+ * 1. OTEL_SERVICE_NAME environment variable
442
+ * 2. package.json name field
443
+ * 3. Fallback to 'unknown-service'
444
+ *
445
+ * Version:
446
+ * 1. OTEL_SERVICE_VERSION environment variable
447
+ * 2. package.json version field
448
+ * 3. undefined (not set)
449
+ *
450
+ * @returns Effect that yields ServiceInfo or ServiceDetectionError
451
+ */
452
+ declare const detectServiceInfo: Effect.Effect<ServiceInfo, ServiceDetectionError>;
453
+ /**
454
+ * Get service name with fallback (Effect version)
455
+ *
456
+ * Never fails - returns 'unknown-service' if detection fails
457
+ */
458
+ declare const getServiceName: Effect.Effect<string, never>;
459
+ /**
460
+ * Get service version with fallback (Effect version)
461
+ *
462
+ * Never fails - returns undefined if detection fails
463
+ */
464
+ declare const getServiceVersion: Effect.Effect<string | undefined, never>;
465
+ /**
466
+ * Get service info with fallback (Effect version)
467
+ *
468
+ * Never fails - returns default ServiceInfo if detection fails
469
+ */
470
+ declare const getServiceInfoWithFallback: Effect.Effect<ServiceInfo, never>;
471
+ /**
472
+ * Detect service name and version (Promise version)
473
+ *
474
+ * @deprecated Use `detectServiceInfo` Effect API for better error handling
475
+ * @returns Promise that resolves to ServiceInfo with fallback
476
+ */
477
+ declare function detectServiceInfoAsync(): Promise<ServiceInfo>;
478
+ /**
479
+ * Get service name with fallback (Promise version)
480
+ *
481
+ * @deprecated Use `getServiceName` Effect API
482
+ */
483
+ declare function getServiceNameAsync(): Promise<string>;
484
+ /**
485
+ * Get service version if available (Promise version)
486
+ *
487
+ * @deprecated Use `getServiceVersion` Effect API
488
+ */
489
+ declare function getServiceVersionAsync(): Promise<string | undefined>;
490
+
491
+ /**
492
+ * OpenTelemetry SpanProcessor for pattern-based filtering
493
+ *
494
+ * This processor filters spans based on configured patterns before they are exported.
495
+ * It wraps another processor (typically BatchSpanProcessor) and only forwards spans
496
+ * that match the instrumentation patterns.
497
+ */
498
+
499
+ /**
500
+ * SpanProcessor that filters spans based on pattern configuration
501
+ *
502
+ * This processor sits in the processing pipeline and decides whether a span
503
+ * should be forwarded to the next processor (for export) or dropped.
504
+ *
505
+ * Usage:
506
+ * ```typescript
507
+ * const exporter = new OTLPTraceExporter()
508
+ * const batchProcessor = new BatchSpanProcessor(exporter)
509
+ * const patternProcessor = new PatternSpanProcessor(config, batchProcessor)
510
+ *
511
+ * const sdk = new NodeSDK({
512
+ * spanProcessor: patternProcessor
513
+ * })
514
+ * ```
515
+ */
516
+ declare class PatternSpanProcessor implements SpanProcessor {
517
+ private matcher;
518
+ private wrappedProcessor;
519
+ constructor(config: InstrumentationConfig, wrappedProcessor: SpanProcessor);
520
+ /**
521
+ * Called when a span is started
522
+ *
523
+ * We check if the span should be instrumented here. If not, we can mark it
524
+ * to be dropped later in onEnd().
525
+ */
526
+ onStart(span: Span, parentContext: Context): void;
527
+ /**
528
+ * Called when a span is ended
529
+ *
530
+ * This is where we make the final decision on whether to export the span.
531
+ */
532
+ onEnd(span: ReadableSpan): void;
533
+ /**
534
+ * Shutdown the processor
535
+ */
536
+ shutdown(): Promise<void>;
537
+ /**
538
+ * Force flush any pending spans
539
+ */
540
+ forceFlush(): Promise<void>;
541
+ /**
542
+ * Get the pattern matcher (for debugging/testing)
543
+ */
544
+ getPatternMatcher(): PatternMatcher;
545
+ }
546
+
547
+ /**
548
+ * Standard OpenTelemetry span helpers (no Effect dependency)
549
+ *
550
+ * These helpers work with any OpenTelemetry span and don't require Effect-TS.
551
+ */
552
+
553
+ /**
554
+ * Set multiple attributes on a span at once
555
+ */
556
+ declare function setSpanAttributes(span: Span$1, attributes: Record<string, string | number | boolean>): void;
557
+ /**
558
+ * Record an exception on a span with optional context
559
+ */
560
+ declare function recordException(span: Span$1, error: Error, context?: Record<string, string | number | boolean>): void;
561
+ /**
562
+ * Mark a span as successful (OK status)
563
+ */
564
+ declare function markSpanSuccess(span: Span$1): void;
565
+ /**
566
+ * Mark a span as failed with an error message
567
+ */
568
+ declare function markSpanError(span: Span$1, message?: string): void;
569
+ /**
570
+ * Helper for HTTP request spans
571
+ */
572
+ declare function annotateHttpRequest(span: Span$1, method: string, url: string, statusCode?: number): void;
573
+ /**
574
+ * Helper for database query spans
575
+ */
576
+ declare function annotateDbQuery(span: Span$1, system: string, statement: string, table?: string): void;
577
+ /**
578
+ * Helper for cache operation spans
579
+ */
580
+ declare function annotateCacheOperation(span: Span$1, operation: 'get' | 'set' | 'delete' | 'clear', key: string, hit?: boolean): void;
581
+
582
+ /**
583
+ * Test utilities for handling shutdown errors during testing
584
+ */
585
+ /**
586
+ * Suppress ECONNREFUSED errors during shutdown in test environments
587
+ *
588
+ * This function installs error handlers that ignore connection refused errors
589
+ * when the OpenTelemetry SDK tries to export spans during shutdown. This is
590
+ * expected behavior when collectors are stopped before child processes finish.
591
+ *
592
+ * @example
593
+ * ```typescript
594
+ * import { suppressShutdownErrors } from '@atrim/instrumentation/test-utils'
595
+ *
596
+ * // Call at the start of your main function
597
+ * suppressShutdownErrors()
598
+ * ```
599
+ */
600
+ declare function suppressShutdownErrors(): void;
601
+
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 };