@neat.is/core 0.5.1 → 0.5.2

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/dist/cli.cjs CHANGED
@@ -12539,7 +12539,7 @@ var import_semver2 = __toESM(require("semver"), 1);
12539
12539
  // src/installers/templates.ts
12540
12540
  init_cjs_shims();
12541
12541
  var OTEL_INIT_HEADER = "// Generated by `neat init --apply` (ADR-069). OpenTelemetry auto-instrumentation hook.";
12542
- var OTEL_INIT_STAMP = "// neat-template-version: 6 \u2014 daemon.json endpoint resolution (ADR-096) + layered file-first capture (ADR-090).";
12542
+ var OTEL_INIT_STAMP = "// neat-template-version: 7 \u2014 OTel init degrades to no-OBSERVED instead of crashing the host app when @opentelemetry deps are absent (#820); daemon.json endpoint resolution (ADR-096) + layered file-first capture (ADR-090).";
12543
12543
  var OTEL_OTLP_HEADERS_JS = "if (process.env.NEAT_OTEL_TOKEN) process.env.OTEL_EXPORTER_OTLP_HEADERS ||= 'Authorization=Bearer ' + process.env.NEAT_OTEL_TOKEN";
12544
12544
  var OTEL_OTLP_PROTOCOL_JS = "process.env.OTEL_EXPORTER_OTLP_PROTOCOL ||= 'http/json'";
12545
12545
  var OTEL_ENDPOINT_RESOLVER_CJS = `;(function () {
@@ -12875,6 +12875,14 @@ ${OTEL_ENDPOINT_RESOLVER_CJS}
12875
12875
  ${OTEL_OTLP_PROTOCOL_JS}
12876
12876
  ${OTEL_OTLP_HEADERS_JS}
12877
12877
 
12878
+ // Instrumentation is ambient \u2014 it must never break the host app. If the
12879
+ // @opentelemetry packages aren't installed (a package-manager install that
12880
+ // failed or hasn't run yet), degrade to running WITHOUT OBSERVED rather than
12881
+ // crashing the process on a missing module (#820). The require-based flavor can
12882
+ // guard this at runtime; do so around the whole SDK setup, not just the
12883
+ // requires, so a broken instrumentation registration can't take the app down
12884
+ // either.
12885
+ try {
12878
12886
  const { NodeSDK } = require('@opentelemetry/sdk-node')
12879
12887
  const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node')
12880
12888
  const { trace, context } = require('@opentelemetry/api')
@@ -12886,6 +12894,14 @@ __INSTRUMENTATION_BLOCK__
12886
12894
  const sdk = new NodeSDK({ instrumentations })
12887
12895
  sdk.start()
12888
12896
  ${neatWireCaptureSource(false)}
12897
+ } catch (__neatOtelErr) {
12898
+ const __neatMsg = String((__neatOtelErr && __neatOtelErr.message) || __neatOtelErr)
12899
+ if (/Cannot find module|MODULE_NOT_FOUND/.test(__neatMsg)) {
12900
+ console.warn('[neat] OpenTelemetry is not active: its packages are not installed, so this app is running without OBSERVED tracing. Run your package manager install and restart to enable it.')
12901
+ } else {
12902
+ console.warn('[neat] OpenTelemetry failed to start; the app is running without OBSERVED tracing: ' + __neatMsg)
12903
+ }
12904
+ }
12889
12905
  `;
12890
12906
  var OTEL_INIT_ESM = `${OTEL_INIT_HEADER}
12891
12907
  ${OTEL_INIT_STAMP}