@bymax-one/nest-telemetry 1.0.8 → 1.0.9

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/CHANGELOG.md CHANGED
@@ -10,6 +10,42 @@ heading here.
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [1.0.9] - 2026-11-20
14
+
15
+ ### Fixed
16
+
17
+ - **The start reads `unsafe` and `instrumentations` once, each field once, and `ignoreIncomingRequest` once.** The
18
+ warning about turned-off redactions, the SDK build and the instrumentation config each read `unsafe` (and its
19
+ fields), the winston transport warning and the config each read `instrumentations`, and the config read
20
+ `ignoreIncomingRequest` twice, so an option object with a getter, on the option or on one of its fields, could
21
+ make a warning and the effect disagree: a first read of `{}` gave no warning while the host id, the process
22
+ command line and the raw URL were exported. The start now copies both options into a plain object, reading each
23
+ field once, and every step works from the copy. This replaces the per-step reads that 1.0.8 described.
24
+ - **An option that throws when read can no longer leave a started SDK without a handle.** `shutdownTimeoutMs` was
25
+ read after the SDK had started, so a getter that threw there made the start reject while the SDK kept running
26
+ and nothing could stop it. It is read before the start now, with the other options, and every position at which
27
+ an operation on the options fails ends in that error with no SDK started.
28
+
29
+ ### Documentation
30
+
31
+ - **The README says that the sampler ratio warning does not repeat a blank value.** It repeats the value only when
32
+ it is not blank; a blank one is called blank.
33
+ - **1.0.7's note on a rejecting `TELEMETRY_LOGGER` is superseded.** It says a rejection is dropped silently; since
34
+ 1.0.8 the report goes to the Nest logger (a failed flush) or to a process warning (a shutdown timeout, a failed
35
+ export), and the README's logger paragraph says so. The README also says that starting twice returns the running
36
+ handle unless `enabled: false`, which returns a disabled one.
37
+ - **The README says what `startTelemetry` rejects with.** The error that was thrown, as it was thrown: there is no
38
+ library error class for a start. When an option cannot be read, the start ends with that error, with no SDK
39
+ started and no handle left.
40
+
41
+ ### Apply to a derived backend
42
+
43
+ The public declarations did not change. A derived backend acts on this behaviour:
44
+
45
+ 1. An options object whose `unsafe` or `instrumentations` is a getter, or whose fields are getters (a computed or lazy
46
+ option), is now read once, each field once, for the whole start, so the redaction warning and the redaction the
47
+ SDK applies come from the same values. An option that answers differently on each read no longer splits them.
48
+
13
49
  ## [1.0.8] - 2026-11-20
14
50
 
15
51
  ### Fixed
@@ -375,6 +411,7 @@ First release.
375
411
  - Verification from the packed tarball: real `node --import` processes in a CommonJS and a native-ESM
376
412
  application, with planted secrets absent from the exported body and negative controls.
377
413
 
414
+ [1.0.9]: https://github.com/bymaxone/nest-telemetry/releases/tag/v1.0.9
378
415
  [1.0.8]: https://github.com/bymaxone/nest-telemetry/releases/tag/v1.0.8
379
416
  [1.0.7]: https://github.com/bymaxone/nest-telemetry/releases/tag/v1.0.7
380
417
  [1.0.6]: https://github.com/bymaxone/nest-telemetry/releases/tag/v1.0.6
package/README.md CHANGED
@@ -156,7 +156,7 @@ const telemetry = await startTelemetry({
156
156
  await telemetry.shutdown()
157
157
  ```
158
158
 
159
- This package installs no signal handler and shows none, because handling signals belongs to the application: a `SIGTERM` listener replaces Node's default termination, so it has to end the process itself once its work is done. `startTelemetry` resolves to a handle with `enabled` and `shutdown()`. Starting twice returns the handle already running, including across two copies of the module (an ES-module preload and a CommonJS application share the handle through `globalThis`). A later call that passes options is told they were ignored, and `enabled: false` against a running SDK is told it does not stop it: `shutdownTelemetry()` does.
159
+ This package installs no signal handler and shows none, because handling signals belongs to the application: a `SIGTERM` listener replaces Node's default termination, so it has to end the process itself once its work is done. `startTelemetry` resolves to a handle with `enabled` and `shutdown()`. Starting twice returns the handle already running (unless `enabled: false`, which returns a disabled handle), including across two copies of the module (an ES-module preload and a CommonJS application share the handle through `globalThis`). A later call that passes options is told they were ignored, and `enabled: false` against a running SDK is told it does not stop it: `shutdownTelemetry()` does.
160
160
 
161
161
  ---
162
162
 
@@ -216,7 +216,7 @@ The start emits these warnings:
216
216
  | `BYMAX_TELEMETRY_ESM_HOOK_UNAVAILABLE` | The loader hook could not be registered. Native-ESM code is not instrumented. The warning names the error's code and package in the same way. |
217
217
  | `BYMAX_TELEMETRY_SERVICE_NAME_MISSING` | No service name is set; spans use `unknown_service:node`. |
218
218
  | `BYMAX_TELEMETRY_UNSAFE_REDACTION_DISABLED` | A redaction was turned off through an `unsafe` option. |
219
- | `BYMAX_TELEMETRY_OPTIONS_IGNORED` | A `startTelemetry` call reached an SDK that was already running, so its options were ignored, or `enabled: false` did not stop it. Any defined option counts, `env` included. |
219
+ | `BYMAX_TELEMETRY_OPTIONS_IGNORED` | A `startTelemetry` call reached an SDK that was already running, so its options were ignored, or `enabled: false` did not stop it. Any option that is neither `undefined` nor `null` counts, `env` included. |
220
220
  | `BYMAX_TELEMETRY_RESTART_UNSUPPORTED` | `startTelemetry` was called after a shutdown in the same process, and is refused. |
221
221
  | `BYMAX_TELEMETRY_SHUTDOWN_TIMEOUT` | The final flush did not finish within `shutdownTimeoutMs`. Shutdown resolved without it, and spans still queued may be lost. With `TelemetryModule` and a bound `TELEMETRY_LOGGER`, it is reported through `errorStructured` under `TRACING_SHUTDOWN_TIMEOUT` instead. |
222
222
  | `BYMAX_TELEMETRY_EXPORT_FAILED` | A span export failed, so the batch was dropped. The warning names the exporter and a short error code, never the payload or the endpoint, and repeats at most once a minute. With `TelemetryModule` and a bound `TELEMETRY_LOGGER` that has `warnStructured`, it is reported through it under `TRACING_EXPORT_FAILED` instead. |
@@ -225,7 +225,7 @@ The start emits these warnings:
225
225
  | `BYMAX_TELEMETRY_WINSTON_TRANSPORT_MISSING` | Log forwarding is on and winston is installed, but `@opentelemetry/winston-transport` cannot be resolved from the winston instrumentation, so winston records are not forwarded. Install it as a direct dependency of the application, or ignore the warning when your application never creates a winston logger or `OTEL_LOGS_EXPORTER` is `none`. |
226
226
  | `BYMAX_TELEMETRY_BSP_VALUE_IGNORED` | An `OTEL_BSP_SCHEDULE_DELAY` or `OTEL_BSP_EXPORT_TIMEOUT` above 2147483647 ms was ignored, because a timer cannot hold it and Node would clamp it to 1 ms. The default applies. |
227
227
 
228
- The programmatic `startTelemetry` keeps its rejection when the SDK cannot start, for callers that want it.
228
+ The programmatic `startTelemetry` keeps its rejection when the SDK cannot start, for callers that want it. It rejects with the error that was thrown, as it was thrown: the library has no error class of its own for a start, so an option whose getter throws (or a proxy that fails an operation) ends the start with that error, with no SDK started and no handle left.
229
229
 
230
230
  ### What is traced
231
231
 
@@ -289,7 +289,7 @@ A start after a shutdown in the same process is refused: `startTelemetry` reject
289
289
 
290
290
  Every figure here was measured on one laptop, with Node 24 and a handler that does nothing but answer. Read them as orders of magnitude for your own measurement to confirm, not as promises.
291
291
 
292
- - **Sampling.** The default samples every trace. For high traffic set `OTEL_TRACES_SAMPLER=parentbased_traceidratio` and `OTEL_TRACES_SAMPLER_ARG=0.1`. Of 2,000 spans created in one run each, the default exported all of them, a ratio of `0.1` exported 210 and a ratio of `0.01` exported 25. A ratio sampler needs `OTEL_TRACES_SAMPLER_ARG` to be a number from 0 to 1. When it is unset, empty or only whitespace, not a number or outside that range, the SDK falls back to a ratio of 1 and samples every trace, noting it only on a diagnostic channel; the start warns once with `BYMAX_TELEMETRY_SAMPLER_ARG_INVALID`, naming the variable and, when one was given, the value (a blank value is called blank, not unset). The SDK matches the sampler name exactly: `always_on`, `always_off`, `traceidratio`, `parentbased_always_on`, `parentbased_always_off` and `parentbased_traceidratio`, in lower case and without surrounding whitespace. Any other value, `TraceIdRatio` included, is replaced by its default and samples every trace; when the value differs from one of those names only in letter case or surrounding whitespace, the start warns once with `BYMAX_TELEMETRY_SAMPLER_NAME_UNKNOWN`, naming the name that was meant and not repeating the value. A name that is not one of those up to case and whitespace, such as `xyz` or a misspelling like `always_offf`, is not warned about: it samples every trace as well, so check the spelling of the variable. It reads the process environment, as the SDK does, and not the `env` option.
292
+ - **Sampling.** The default samples every trace. For high traffic set `OTEL_TRACES_SAMPLER=parentbased_traceidratio` and `OTEL_TRACES_SAMPLER_ARG=0.1`. Of 2,000 spans created in one run each, the default exported all of them, a ratio of `0.1` exported 210 and a ratio of `0.01` exported 25. A ratio sampler needs `OTEL_TRACES_SAMPLER_ARG` to be a number from 0 to 1. When it is unset, empty or only whitespace, not a number or outside that range, the SDK falls back to a ratio of 1 and samples every trace, noting it only on a diagnostic channel; the start warns once with `BYMAX_TELEMETRY_SAMPLER_ARG_INVALID`, naming the variable and, when a non-blank value was given, the value (a blank value is called blank, not unset, and is not repeated). The SDK matches the sampler name exactly: `always_on`, `always_off`, `traceidratio`, `parentbased_always_on`, `parentbased_always_off` and `parentbased_traceidratio`, in lower case and without surrounding whitespace. Any other value, `TraceIdRatio` included, is replaced by its default and samples every trace; when the value differs from one of those names only in letter case or surrounding whitespace, the start warns once with `BYMAX_TELEMETRY_SAMPLER_NAME_UNKNOWN`, naming the name that was meant and not repeating the value. A name that is not one of those up to case and whitespace, such as `xyz` or a misspelling like `always_offf`, is not warned about: it samples every trace as well, so check the spelling of the variable. It reads the process environment, as the SDK does, and not the `env` option.
293
293
  - **TLS to the collector.** Against a collector whose certificate Node does not trust, every export failed with `self-signed certificate`. Setting `OTEL_EXPORTER_OTLP_CERTIFICATE` to the CA file, or `NODE_EXTRA_CA_CERTS`, exported all 2,000 spans in the same setup.
294
294
  - **A collector that is down.** The batch is dropped and the library emits `BYMAX_TELEMETRY_EXPORT_FAILED`, at most once a minute. Shutdown stops waiting at `shutdownTimeoutMs`, 5 seconds by default. Before that deadline existed, shutdown against a closed port took 7,048 ms and 7,214 ms in two runs.
295
295
  - **CPU.** One process, 4 runs per mode, median CPU time per request: 25 µs without the library, 26 µs with it loaded and disabled, 58 µs with a healthy collector (range 35 to 66) and 43 µs with the collector down (range 26 to 65). The extra cost in that handler is roughly 10 to 40 µs per request, and a handler that does real I/O dilutes it. The same configuration varied by up to a factor of two between runs.
@@ -221,8 +221,23 @@ function buildResourceAttributes(options, env) {
221
221
  if (version !== void 0) attributes["service.version"] = version;
222
222
  return attributes;
223
223
  }
224
+ function settleUnsafe(unsafe) {
225
+ return {
226
+ disableUrlRedaction: unsafe?.disableUrlRedaction === true,
227
+ disableRedisArgumentRedaction: unsafe?.disableRedisArgumentRedaction === true,
228
+ exportProcessCommandArgs: unsafe?.exportProcessCommandArgs === true,
229
+ exportHostId: unsafe?.exportHostId === true
230
+ };
231
+ }
232
+ function settleInstrumentations(instrumentations) {
233
+ return {
234
+ fs: instrumentations?.fs,
235
+ sendLogs: instrumentations?.sendLogs,
236
+ overrides: instrumentations?.overrides
237
+ };
238
+ }
224
239
  function buildInstrumentationConfig(options, signals) {
225
- const instrumentations = options.instrumentations ?? {};
240
+ const instrumentations = settleInstrumentations(options.instrumentations);
226
241
  const overrides = {};
227
242
  for (const [name, config] of Object.entries(instrumentations.overrides ?? {})) {
228
243
  if (isPresent(config)) overrides[name] = definedEntries(config);
@@ -248,8 +263,9 @@ function buildInstrumentationConfig(options, signals) {
248
263
  ...options.extraRedactedQueryParams ?? []
249
264
  ])
250
265
  };
251
- if (isPresent(options.ignoreIncomingRequest)) {
252
- merged[HTTP_INSTRUMENTATION]["ignoreIncomingRequestHook"] = options.ignoreIncomingRequest;
266
+ const ignoreIncomingRequest = options.ignoreIncomingRequest;
267
+ if (isPresent(ignoreIncomingRequest)) {
268
+ merged[HTTP_INSTRUMENTATION]["ignoreIncomingRequestHook"] = ignoreIncomingRequest;
253
269
  }
254
270
  if (redactRedis) {
255
271
  for (const name of [IOREDIS_INSTRUMENTATION, REDIS_INSTRUMENTATION]) {
@@ -572,10 +588,10 @@ async function loadPackages() {
572
588
  ]);
573
589
  return { sdkNode, sdkTrace, autoInstrumentations, exporter, resources };
574
590
  }
575
- function buildSdk(packages, options, env) {
591
+ function buildSdk(packages, options, env, read) {
576
592
  const { sdkNode, sdkTrace, autoInstrumentations, exporter, resources } = packages;
577
593
  const signals = planSignals(env);
578
- const unsafe = options.unsafe;
594
+ const { instrumentations, unsafe } = read;
579
595
  return new sdkNode.NodeSDK({
580
596
  ...signals.overrides,
581
597
  resource: resources.resourceFromAttributes(buildResourceAttributes(options, env)),
@@ -602,20 +618,33 @@ function buildSdk(packages, options, env) {
602
618
  })
603
619
  ],
604
620
  instrumentations: [
605
- autoInstrumentations.getNodeAutoInstrumentations(buildInstrumentationConfig(options, signals))
621
+ autoInstrumentations.getNodeAutoInstrumentations(
622
+ buildInstrumentationConfig(
623
+ {
624
+ instrumentations,
625
+ unsafe,
626
+ extraRedactedQueryParams: options.extraRedactedQueryParams,
627
+ ignoreIncomingRequest: options.ignoreIncomingRequest
628
+ },
629
+ signals
630
+ )
631
+ )
606
632
  ]
607
633
  });
608
634
  }
609
635
  async function boot(options, env) {
610
- warnAboutUnsafeOptions(options);
636
+ const unsafe = settleUnsafe(options.unsafe);
637
+ const instrumentations = settleInstrumentations(options.instrumentations);
638
+ warnAboutUnsafeOptions({ unsafe });
611
639
  warnAboutMissingServiceName(options, env);
612
640
  warnAboutOversizedTimers(env);
613
641
  warnAboutSamplerName(readSamplerNearMiss());
614
642
  warnAboutSamplerRatio(readRatioSampler());
615
- warnAboutMissingWinstonTransport(options.instrumentations?.sendLogs ?? planSignals(env).sendLogs);
616
- const sdk = buildSdk(await loadPackages(), options, env);
643
+ warnAboutMissingWinstonTransport(instrumentations.sendLogs ?? planSignals(env).sendLogs);
644
+ const shutdownTimeoutMs = options.shutdownTimeoutMs;
645
+ const sdk = buildSdk(await loadPackages(), options, env, { instrumentations, unsafe });
617
646
  sdk.start();
618
- const handle = createHandle(() => sdk.shutdown(), options.shutdownTimeoutMs);
647
+ const handle = createHandle(() => sdk.shutdown(), shutdownTimeoutMs);
619
648
  registerHandle(handle);
620
649
  return handle;
621
650
  }
@@ -221,8 +221,23 @@ function buildResourceAttributes(options, env) {
221
221
  if (version !== void 0) attributes["service.version"] = version;
222
222
  return attributes;
223
223
  }
224
+ function settleUnsafe(unsafe) {
225
+ return {
226
+ disableUrlRedaction: unsafe?.disableUrlRedaction === true,
227
+ disableRedisArgumentRedaction: unsafe?.disableRedisArgumentRedaction === true,
228
+ exportProcessCommandArgs: unsafe?.exportProcessCommandArgs === true,
229
+ exportHostId: unsafe?.exportHostId === true
230
+ };
231
+ }
232
+ function settleInstrumentations(instrumentations) {
233
+ return {
234
+ fs: instrumentations?.fs,
235
+ sendLogs: instrumentations?.sendLogs,
236
+ overrides: instrumentations?.overrides
237
+ };
238
+ }
224
239
  function buildInstrumentationConfig(options, signals) {
225
- const instrumentations = options.instrumentations ?? {};
240
+ const instrumentations = settleInstrumentations(options.instrumentations);
226
241
  const overrides = {};
227
242
  for (const [name, config] of Object.entries(instrumentations.overrides ?? {})) {
228
243
  if (isPresent(config)) overrides[name] = definedEntries(config);
@@ -248,8 +263,9 @@ function buildInstrumentationConfig(options, signals) {
248
263
  ...options.extraRedactedQueryParams ?? []
249
264
  ])
250
265
  };
251
- if (isPresent(options.ignoreIncomingRequest)) {
252
- merged[HTTP_INSTRUMENTATION]["ignoreIncomingRequestHook"] = options.ignoreIncomingRequest;
266
+ const ignoreIncomingRequest = options.ignoreIncomingRequest;
267
+ if (isPresent(ignoreIncomingRequest)) {
268
+ merged[HTTP_INSTRUMENTATION]["ignoreIncomingRequestHook"] = ignoreIncomingRequest;
253
269
  }
254
270
  if (redactRedis) {
255
271
  for (const name of [IOREDIS_INSTRUMENTATION, REDIS_INSTRUMENTATION]) {
@@ -581,10 +597,10 @@ async function loadPackages() {
581
597
  ]);
582
598
  return { sdkNode, sdkTrace, autoInstrumentations, exporter, resources };
583
599
  }
584
- function buildSdk(packages, options, env) {
600
+ function buildSdk(packages, options, env, read) {
585
601
  const { sdkNode, sdkTrace, autoInstrumentations, exporter, resources } = packages;
586
602
  const signals = planSignals(env);
587
- const unsafe = options.unsafe;
603
+ const { instrumentations, unsafe } = read;
588
604
  return new sdkNode.NodeSDK({
589
605
  ...signals.overrides,
590
606
  resource: resources.resourceFromAttributes(buildResourceAttributes(options, env)),
@@ -611,20 +627,33 @@ function buildSdk(packages, options, env) {
611
627
  })
612
628
  ],
613
629
  instrumentations: [
614
- autoInstrumentations.getNodeAutoInstrumentations(buildInstrumentationConfig(options, signals))
630
+ autoInstrumentations.getNodeAutoInstrumentations(
631
+ buildInstrumentationConfig(
632
+ {
633
+ instrumentations,
634
+ unsafe,
635
+ extraRedactedQueryParams: options.extraRedactedQueryParams,
636
+ ignoreIncomingRequest: options.ignoreIncomingRequest
637
+ },
638
+ signals
639
+ )
640
+ )
615
641
  ]
616
642
  });
617
643
  }
618
644
  async function boot(options, env) {
619
- warnAboutUnsafeOptions(options);
645
+ const unsafe = settleUnsafe(options.unsafe);
646
+ const instrumentations = settleInstrumentations(options.instrumentations);
647
+ warnAboutUnsafeOptions({ unsafe });
620
648
  warnAboutMissingServiceName(options, env);
621
649
  warnAboutOversizedTimers(env);
622
650
  warnAboutSamplerName(readSamplerNearMiss());
623
651
  warnAboutSamplerRatio(readRatioSampler());
624
- warnAboutMissingWinstonTransport(options.instrumentations?.sendLogs ?? planSignals(env).sendLogs);
625
- const sdk = buildSdk(await loadPackages(), options, env);
652
+ warnAboutMissingWinstonTransport(instrumentations.sendLogs ?? planSignals(env).sendLogs);
653
+ const shutdownTimeoutMs = options.shutdownTimeoutMs;
654
+ const sdk = buildSdk(await loadPackages(), options, env, { instrumentations, unsafe });
626
655
  sdk.start();
627
- const handle = createHandle(() => sdk.shutdown(), options.shutdownTimeoutMs);
656
+ const handle = createHandle(() => sdk.shutdown(), shutdownTimeoutMs);
628
657
  registerHandle(handle);
629
658
  return handle;
630
659
  }
@@ -219,8 +219,23 @@ function buildResourceAttributes(options, env) {
219
219
  if (version !== void 0) attributes["service.version"] = version;
220
220
  return attributes;
221
221
  }
222
+ function settleUnsafe(unsafe) {
223
+ return {
224
+ disableUrlRedaction: unsafe?.disableUrlRedaction === true,
225
+ disableRedisArgumentRedaction: unsafe?.disableRedisArgumentRedaction === true,
226
+ exportProcessCommandArgs: unsafe?.exportProcessCommandArgs === true,
227
+ exportHostId: unsafe?.exportHostId === true
228
+ };
229
+ }
230
+ function settleInstrumentations(instrumentations) {
231
+ return {
232
+ fs: instrumentations?.fs,
233
+ sendLogs: instrumentations?.sendLogs,
234
+ overrides: instrumentations?.overrides
235
+ };
236
+ }
222
237
  function buildInstrumentationConfig(options, signals) {
223
- const instrumentations = options.instrumentations ?? {};
238
+ const instrumentations = settleInstrumentations(options.instrumentations);
224
239
  const overrides = {};
225
240
  for (const [name, config] of Object.entries(instrumentations.overrides ?? {})) {
226
241
  if (isPresent(config)) overrides[name] = definedEntries(config);
@@ -246,8 +261,9 @@ function buildInstrumentationConfig(options, signals) {
246
261
  ...options.extraRedactedQueryParams ?? []
247
262
  ])
248
263
  };
249
- if (isPresent(options.ignoreIncomingRequest)) {
250
- merged[HTTP_INSTRUMENTATION]["ignoreIncomingRequestHook"] = options.ignoreIncomingRequest;
264
+ const ignoreIncomingRequest = options.ignoreIncomingRequest;
265
+ if (isPresent(ignoreIncomingRequest)) {
266
+ merged[HTTP_INSTRUMENTATION]["ignoreIncomingRequestHook"] = ignoreIncomingRequest;
251
267
  }
252
268
  if (redactRedis) {
253
269
  for (const name of [IOREDIS_INSTRUMENTATION, REDIS_INSTRUMENTATION]) {
@@ -579,10 +595,10 @@ async function loadPackages() {
579
595
  ]);
580
596
  return { sdkNode, sdkTrace, autoInstrumentations, exporter, resources };
581
597
  }
582
- function buildSdk(packages, options, env) {
598
+ function buildSdk(packages, options, env, read) {
583
599
  const { sdkNode, sdkTrace, autoInstrumentations, exporter, resources } = packages;
584
600
  const signals = planSignals(env);
585
- const unsafe = options.unsafe;
601
+ const { instrumentations, unsafe } = read;
586
602
  return new sdkNode.NodeSDK({
587
603
  ...signals.overrides,
588
604
  resource: resources.resourceFromAttributes(buildResourceAttributes(options, env)),
@@ -609,20 +625,33 @@ function buildSdk(packages, options, env) {
609
625
  })
610
626
  ],
611
627
  instrumentations: [
612
- autoInstrumentations.getNodeAutoInstrumentations(buildInstrumentationConfig(options, signals))
628
+ autoInstrumentations.getNodeAutoInstrumentations(
629
+ buildInstrumentationConfig(
630
+ {
631
+ instrumentations,
632
+ unsafe,
633
+ extraRedactedQueryParams: options.extraRedactedQueryParams,
634
+ ignoreIncomingRequest: options.ignoreIncomingRequest
635
+ },
636
+ signals
637
+ )
638
+ )
613
639
  ]
614
640
  });
615
641
  }
616
642
  async function boot(options, env) {
617
- warnAboutUnsafeOptions(options);
643
+ const unsafe = settleUnsafe(options.unsafe);
644
+ const instrumentations = settleInstrumentations(options.instrumentations);
645
+ warnAboutUnsafeOptions({ unsafe });
618
646
  warnAboutMissingServiceName(options, env);
619
647
  warnAboutOversizedTimers(env);
620
648
  warnAboutSamplerName(readSamplerNearMiss());
621
649
  warnAboutSamplerRatio(readRatioSampler());
622
- warnAboutMissingWinstonTransport(options.instrumentations?.sendLogs ?? planSignals(env).sendLogs);
623
- const sdk = buildSdk(await loadPackages(), options, env);
650
+ warnAboutMissingWinstonTransport(instrumentations.sendLogs ?? planSignals(env).sendLogs);
651
+ const shutdownTimeoutMs = options.shutdownTimeoutMs;
652
+ const sdk = buildSdk(await loadPackages(), options, env, { instrumentations, unsafe });
624
653
  sdk.start();
625
- const handle = createHandle(() => sdk.shutdown(), options.shutdownTimeoutMs);
654
+ const handle = createHandle(() => sdk.shutdown(), shutdownTimeoutMs);
626
655
  registerHandle(handle);
627
656
  return handle;
628
657
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bymax-one/nest-telemetry",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "OpenTelemetry tracing for NestJS 11 and plain Node: starts the SDK before your app loads, redacts secrets from spans by default, and flushes on shutdown. Optional peers, zero cost when disabled.",
5
5
  "author": "Bymax One <support@bymax.one>",
6
6
  "license": "MIT",