@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/neatd.js CHANGED
@@ -2,15 +2,15 @@
2
2
  import {
3
3
  reconcileDaemonRecordSync,
4
4
  startDaemon
5
- } from "./chunk-VR73QNJD.js";
5
+ } from "./chunk-5PVQJLPR.js";
6
6
  import {
7
7
  listProjects,
8
8
  registryPath
9
- } from "./chunk-PEFX3DBR.js";
9
+ } from "./chunk-CS4GHQO3.js";
10
10
  import {
11
11
  BindAuthorityError,
12
12
  __require
13
- } from "./chunk-I4NZ7PSN.js";
13
+ } from "./chunk-BZ3AJVAC.js";
14
14
 
15
15
  // src/neatd.ts
16
16
  import { promises as fs } from "fs";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  reshapeGrpcRequest,
3
3
  startOtelGrpcReceiver
4
- } from "./chunk-4RU3AAOI.js";
5
- import "./chunk-I4NZ7PSN.js";
4
+ } from "./chunk-MVINCLQM.js";
5
+ import "./chunk-BZ3AJVAC.js";
6
6
  export {
7
7
  reshapeGrpcRequest,
8
8
  startOtelGrpcReceiver
9
9
  };
10
- //# sourceMappingURL=otel-grpc-TEGOXE6T.js.map
10
+ //# sourceMappingURL=otel-grpc-XS45HBET.js.map
package/dist/server.cjs CHANGED
@@ -340,6 +340,11 @@ function pickEnv(spanAttrs, resourceAttrs) {
340
340
  }
341
341
  return ENV_FALLBACK;
342
342
  }
343
+ function normalizeDbSystem(attrs) {
344
+ const raw = attrs["db.system"];
345
+ if (typeof raw !== "string") return void 0;
346
+ return raw === "mongoose" ? "mongodb" : raw;
347
+ }
343
348
  function messagingDestinationOf(attrs) {
344
349
  for (const key of ["messaging.destination.name", "messaging.destination"]) {
345
350
  const v = attrs[key];
@@ -394,7 +399,7 @@ function parseOtlpRequest(body) {
394
399
  durationNanos: durationNanos(span.startTimeUnixNano, span.endTimeUnixNano),
395
400
  env: pickEnv(attrs, resourceAttrs),
396
401
  attributes: attrs,
397
- dbSystem: typeof attrs["db.system"] === "string" ? attrs["db.system"] : void 0,
402
+ dbSystem: normalizeDbSystem(attrs),
398
403
  dbName: typeof attrs["db.name"] === "string" ? attrs["db.name"] : void 0,
399
404
  dbCollection: typeof attrs["db.collection.name"] === "string" ? attrs["db.collection.name"] : typeof attrs["db.mongodb.collection"] === "string" ? attrs["db.mongodb.collection"] : void 0,
400
405
  messagingSystem: typeof attrs["messaging.system"] === "string" ? attrs["messaging.system"] : void 0,
@@ -9426,6 +9431,42 @@ function registerRoutes(scope, ctx) {
9426
9431
  return reply.code(500).send({ error: err.message });
9427
9432
  }
9428
9433
  });
9434
+ scope.get("/instrumentation", async (req, reply) => {
9435
+ const proj = resolveProject(registry, req, reply, ctx.bootstrap, ctx.singleProject);
9436
+ if (!proj) return;
9437
+ if (!proj.scanPath) {
9438
+ return { engaged: null };
9439
+ }
9440
+ try {
9441
+ const state = await describeProjectInstrumentation({ project: proj.name, scanPath: proj.scanPath });
9442
+ const uninstrumented = await listUninstrumented({ project: proj.name, scanPath: proj.scanPath });
9443
+ if (state.hookFiles.length === 0) {
9444
+ return {
9445
+ engaged: false,
9446
+ diagnosis: {
9447
+ reason: "No instrumented entry point found \u2014 NEAT hasn't written an OTel init hook for this project.",
9448
+ fixCommand: "neat init",
9449
+ detail: "Run `neat init` so NEAT writes the instrumentation hook next to your entry point, then run your app."
9450
+ }
9451
+ };
9452
+ }
9453
+ if (uninstrumented.length > 0) {
9454
+ const names = uninstrumented.map((u) => u.library);
9455
+ const more = names.length > 1 ? ` (and ${names.length - 1} more)` : "";
9456
+ return {
9457
+ engaged: false,
9458
+ diagnosis: {
9459
+ reason: `\`${names[0]}\`${more} isn't in the auto-instrumentation set, so spans from it won't reach the graph.`,
9460
+ fixCommand: "neat extend",
9461
+ detail: `Uninstrumented on your hot path: ${names.join(", ")}. Run \`neat extend\` to wire the missing instrumentation.`
9462
+ }
9463
+ };
9464
+ }
9465
+ return { engaged: true };
9466
+ } catch {
9467
+ return { engaged: null };
9468
+ }
9469
+ });
9429
9470
  scope.post("/extend/apply", async (req, reply) => {
9430
9471
  const proj = resolveProject(registry, req, reply, ctx.bootstrap, ctx.singleProject);
9431
9472
  if (!proj) return;