@neat.is/core 0.5.4-dev.20260721 → 0.6.0

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.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  resolveNeatVersion,
13
13
  validateConnectorEntry,
14
14
  writeDaemonRecord
15
- } from "./chunk-VR73QNJD.js";
15
+ } from "./chunk-5PVQJLPR.js";
16
16
  import {
17
17
  buildSearchIndex
18
18
  } from "./chunk-BIY46Q6U.js";
@@ -71,10 +71,10 @@ import {
71
71
  startPersistLoop,
72
72
  startStalenessLoop,
73
73
  upsertConnectorEntry
74
- } from "./chunk-PEFX3DBR.js";
74
+ } from "./chunk-CS4GHQO3.js";
75
75
  import {
76
76
  startOtelGrpcReceiver
77
- } from "./chunk-4RU3AAOI.js";
77
+ } from "./chunk-MVINCLQM.js";
78
78
  import {
79
79
  __dirname,
80
80
  __require,
@@ -82,7 +82,7 @@ import {
82
82
  buildOtelReceiver,
83
83
  listenSteppingOtlp,
84
84
  readAuthEnv
85
- } from "./chunk-I4NZ7PSN.js";
85
+ } from "./chunk-BZ3AJVAC.js";
86
86
 
87
87
  // src/cli.ts
88
88
  import path10 from "path";
@@ -1185,9 +1185,12 @@ ${OTEL_ENDPOINT_RESOLVER_ESM}
1185
1185
  ${OTEL_OTLP_PROTOCOL_JS}
1186
1186
  ${OTEL_OTLP_HEADERS_JS}
1187
1187
 
1188
- import { NodeSDK } from '@opentelemetry/sdk-node'
1189
- import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'
1190
- import { trace, context } from '@opentelemetry/api'
1188
+ // Keep dependency loading inside the guard. Static ESM imports are evaluated
1189
+ // before any try/catch and would crash the host app when an install failed.
1190
+ try {
1191
+ const { NodeSDK } = await import('@opentelemetry/sdk-node')
1192
+ const { getNodeAutoInstrumentations } = await import('@opentelemetry/auto-instrumentations-node')
1193
+ const { trace, context } = await import('@opentelemetry/api')
1191
1194
 
1192
1195
  ${CALLSITE_PROCESSOR_JS}
1193
1196
 
@@ -1196,6 +1199,14 @@ __INSTRUMENTATION_BLOCK__
1196
1199
  const sdk = new NodeSDK({ instrumentations })
1197
1200
  sdk.start()
1198
1201
  ${neatWireCaptureSource(false)}
1202
+ } catch (__neatOtelErr) {
1203
+ const __neatMsg = String((__neatOtelErr && __neatOtelErr.message) || __neatOtelErr)
1204
+ if (/Cannot find (?:module|package)|MODULE_NOT_FOUND|ERR_MODULE_NOT_FOUND/.test(__neatMsg)) {
1205
+ 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.')
1206
+ } else {
1207
+ console.warn('[neat] OpenTelemetry failed to start; the app is running without OBSERVED tracing: ' + __neatMsg)
1208
+ }
1209
+ }
1199
1210
  `;
1200
1211
  var OTEL_INIT_TS = `${OTEL_INIT_HEADER}
1201
1212
  ${OTEL_INIT_STAMP}
@@ -1210,9 +1221,12 @@ ${OTEL_ENDPOINT_RESOLVER_ESM}
1210
1221
  ${OTEL_OTLP_PROTOCOL_JS}
1211
1222
  ${OTEL_OTLP_HEADERS_JS}
1212
1223
 
1213
- import { NodeSDK } from '@opentelemetry/sdk-node'
1214
- import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'
1215
- import { trace, context } from '@opentelemetry/api'
1224
+ // Top-level await preserves the static import's ordering: the host entry does
1225
+ // not run until instrumentation has started (or safely degraded).
1226
+ try {
1227
+ const { NodeSDK } = await import('@opentelemetry/sdk-node')
1228
+ const { getNodeAutoInstrumentations } = await import('@opentelemetry/auto-instrumentations-node')
1229
+ const { trace, context } = await import('@opentelemetry/api')
1216
1230
 
1217
1231
  ${CALLSITE_PROCESSOR_TS}
1218
1232
 
@@ -1221,6 +1235,14 @@ __INSTRUMENTATION_BLOCK__
1221
1235
  const sdk = new NodeSDK({ instrumentations })
1222
1236
  sdk.start()
1223
1237
  ${neatWireCaptureSource(true)}
1238
+ } catch (__neatOtelErr) {
1239
+ const __neatMsg = String((__neatOtelErr && __neatOtelErr.message) || __neatOtelErr)
1240
+ if (/Cannot find (?:module|package)|MODULE_NOT_FOUND|ERR_MODULE_NOT_FOUND/.test(__neatMsg)) {
1241
+ 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.')
1242
+ } else {
1243
+ console.warn('[neat] OpenTelemetry failed to start; the app is running without OBSERVED tracing: ' + __neatMsg)
1244
+ }
1245
+ }
1224
1246
  `;
1225
1247
  function renderNodeOtelInit(template, serviceName, projectName, registrations = []) {
1226
1248
  const block = registrations.length === 0 ? "" : `
@@ -3516,9 +3538,26 @@ function printSummary(result, graph, dashboardUrl, daemonLog) {
3516
3538
  } else {
3517
3539
  console.log("running locally \u2014 open the dashboard, no token needed");
3518
3540
  }
3541
+ const failedInstalls = (result.steps.apply.packageManagerInstalls ?? []).filter(
3542
+ (i) => i.exitCode !== 0
3543
+ );
3519
3544
  if (daemonLog !== null) {
3520
3545
  console.log("");
3521
3546
  console.log(`daemon running in the background (logs: ${daemonLog})`);
3547
+ }
3548
+ if (failedInstalls.length > 0) {
3549
+ if (daemonLog === null) console.log("");
3550
+ console.log(
3551
+ "instrumentation is wired into your manifests, but it is NOT yet active:"
3552
+ );
3553
+ console.log(
3554
+ "the dependency install did not complete, so the OTel SDK never landed and"
3555
+ );
3556
+ console.log("OBSERVED edges will stay empty until you finish the install. Fix it:");
3557
+ for (const i of failedInstalls) {
3558
+ console.log(` run \`${i.pm} install\` in ${i.cwd}`);
3559
+ }
3560
+ } else if (daemonLog !== null) {
3522
3561
  console.log(
3523
3562
  "next: run your app or your test suite \u2014 OBSERVED edges fill in as it executes,"
3524
3563
  );