@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 +17 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +17 -1
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -810,7 +810,7 @@ import semver from "semver";
|
|
|
810
810
|
|
|
811
811
|
// src/installers/templates.ts
|
|
812
812
|
var OTEL_INIT_HEADER = "// Generated by `neat init --apply` (ADR-069). OpenTelemetry auto-instrumentation hook.";
|
|
813
|
-
var OTEL_INIT_STAMP = "// neat-template-version:
|
|
813
|
+
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).";
|
|
814
814
|
var OTEL_OTLP_HEADERS_JS = "if (process.env.NEAT_OTEL_TOKEN) process.env.OTEL_EXPORTER_OTLP_HEADERS ||= 'Authorization=Bearer ' + process.env.NEAT_OTEL_TOKEN";
|
|
815
815
|
var OTEL_OTLP_PROTOCOL_JS = "process.env.OTEL_EXPORTER_OTLP_PROTOCOL ||= 'http/json'";
|
|
816
816
|
var OTEL_ENDPOINT_RESOLVER_CJS = `;(function () {
|
|
@@ -1146,6 +1146,14 @@ ${OTEL_ENDPOINT_RESOLVER_CJS}
|
|
|
1146
1146
|
${OTEL_OTLP_PROTOCOL_JS}
|
|
1147
1147
|
${OTEL_OTLP_HEADERS_JS}
|
|
1148
1148
|
|
|
1149
|
+
// Instrumentation is ambient \u2014 it must never break the host app. If the
|
|
1150
|
+
// @opentelemetry packages aren't installed (a package-manager install that
|
|
1151
|
+
// failed or hasn't run yet), degrade to running WITHOUT OBSERVED rather than
|
|
1152
|
+
// crashing the process on a missing module (#820). The require-based flavor can
|
|
1153
|
+
// guard this at runtime; do so around the whole SDK setup, not just the
|
|
1154
|
+
// requires, so a broken instrumentation registration can't take the app down
|
|
1155
|
+
// either.
|
|
1156
|
+
try {
|
|
1149
1157
|
const { NodeSDK } = require('@opentelemetry/sdk-node')
|
|
1150
1158
|
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node')
|
|
1151
1159
|
const { trace, context } = require('@opentelemetry/api')
|
|
@@ -1157,6 +1165,14 @@ __INSTRUMENTATION_BLOCK__
|
|
|
1157
1165
|
const sdk = new NodeSDK({ instrumentations })
|
|
1158
1166
|
sdk.start()
|
|
1159
1167
|
${neatWireCaptureSource(false)}
|
|
1168
|
+
} catch (__neatOtelErr) {
|
|
1169
|
+
const __neatMsg = String((__neatOtelErr && __neatOtelErr.message) || __neatOtelErr)
|
|
1170
|
+
if (/Cannot find module|MODULE_NOT_FOUND/.test(__neatMsg)) {
|
|
1171
|
+
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.')
|
|
1172
|
+
} else {
|
|
1173
|
+
console.warn('[neat] OpenTelemetry failed to start; the app is running without OBSERVED tracing: ' + __neatMsg)
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1160
1176
|
`;
|
|
1161
1177
|
var OTEL_INIT_ESM = `${OTEL_INIT_HEADER}
|
|
1162
1178
|
${OTEL_INIT_STAMP}
|