@neat.is/core 0.9.1 → 0.9.2-dev.20260822
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/{chunk-FCO5Z3RW.js → chunk-ERE47MCR.js} +2 -2
- package/dist/{chunk-UUYCTH2E.js → chunk-GDGUY4T6.js} +34 -2
- package/dist/chunk-GDGUY4T6.js.map +1 -0
- package/dist/{chunk-YKQB622D.js → chunk-L4SZIIER.js} +3 -3
- package/dist/{chunk-UN7VFA4H.js → chunk-RQQUI3NQ.js} +29 -3
- package/dist/chunk-RQQUI3NQ.js.map +1 -0
- package/dist/cli.cjs +60 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +4 -4
- package/dist/index.cjs +60 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -4
- package/dist/neatd.cjs +60 -2
- package/dist/neatd.cjs.map +1 -1
- package/dist/neatd.js +3 -3
- package/dist/{otel-grpc-CO47JRIN.js → otel-grpc-Y5K4WGWO.js} +3 -3
- package/dist/server.cjs +60 -2
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +3 -3
- package/package.json +2 -2
- package/dist/chunk-UN7VFA4H.js.map +0 -1
- package/dist/chunk-UUYCTH2E.js.map +0 -1
- /package/dist/{chunk-FCO5Z3RW.js.map → chunk-ERE47MCR.js.map} +0 -0
- /package/dist/{chunk-YKQB622D.js.map → chunk-L4SZIIER.js.map} +0 -0
- /package/dist/{otel-grpc-CO47JRIN.js.map → otel-grpc-Y5K4WGWO.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
resolveHost,
|
|
7
7
|
resolveNeatVersion,
|
|
8
8
|
writeDaemonRecord
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-L4SZIIER.js";
|
|
10
10
|
import {
|
|
11
11
|
buildSearchIndex
|
|
12
12
|
} from "./chunk-BC53SCT7.js";
|
|
@@ -74,10 +74,10 @@ import {
|
|
|
74
74
|
startStalenessLoop,
|
|
75
75
|
upsertConnectorEntry,
|
|
76
76
|
validateConnectorEntry
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-RQQUI3NQ.js";
|
|
78
78
|
import {
|
|
79
79
|
startOtelGrpcReceiver
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-ERE47MCR.js";
|
|
81
81
|
import {
|
|
82
82
|
__dirname,
|
|
83
83
|
__require,
|
|
@@ -85,7 +85,7 @@ import {
|
|
|
85
85
|
buildOtelReceiver,
|
|
86
86
|
listenSteppingOtlp,
|
|
87
87
|
readAuthEnv
|
|
88
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-GDGUY4T6.js";
|
|
89
89
|
|
|
90
90
|
// src/cli.ts
|
|
91
91
|
import path15 from "path";
|
package/dist/index.cjs
CHANGED
|
@@ -525,11 +525,42 @@ async function decodeProtobufBody(buf) {
|
|
|
525
525
|
const { reshapeGrpcRequest: reshapeGrpcRequest2 } = await Promise.resolve().then(() => (init_otel_grpc(), otel_grpc_exports));
|
|
526
526
|
return reshapeGrpcRequest2(decoded);
|
|
527
527
|
}
|
|
528
|
+
function decompressorForEncoding(encoding) {
|
|
529
|
+
switch (encoding) {
|
|
530
|
+
case "gzip":
|
|
531
|
+
case "x-gzip":
|
|
532
|
+
return import_node_zlib.default.createGunzip();
|
|
533
|
+
case "deflate":
|
|
534
|
+
return import_node_zlib.default.createInflate();
|
|
535
|
+
default:
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
528
539
|
async function buildOtelReceiver(opts) {
|
|
529
540
|
const app = (0, import_fastify.default)({
|
|
530
541
|
logger: false,
|
|
531
542
|
bodyLimit: opts.bodyLimit ?? 16 * 1024 * 1024
|
|
532
543
|
});
|
|
544
|
+
app.addHook("preParsing", (req, _reply, payload, done) => {
|
|
545
|
+
const encoding = (req.headers["content-encoding"] ?? "").toString().trim().toLowerCase();
|
|
546
|
+
if (encoding === "" || encoding === "identity") {
|
|
547
|
+
done(null, payload);
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
const decompressor = decompressorForEncoding(encoding);
|
|
551
|
+
if (!decompressor) {
|
|
552
|
+
done(null, payload);
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
const tracked = decompressor;
|
|
556
|
+
tracked.receivedEncodedLength = 0;
|
|
557
|
+
payload.on("data", (chunk) => {
|
|
558
|
+
tracked.receivedEncodedLength = (tracked.receivedEncodedLength ?? 0) + chunk.length;
|
|
559
|
+
});
|
|
560
|
+
payload.on("error", (err) => decompressor.destroy(err));
|
|
561
|
+
payload.pipe(decompressor);
|
|
562
|
+
done(null, decompressor);
|
|
563
|
+
});
|
|
533
564
|
const REJECT_WARN_INTERVAL_MS = 6e4;
|
|
534
565
|
let lastRejectWarnAt = 0;
|
|
535
566
|
const warnRejectedOtlp = () => {
|
|
@@ -735,13 +766,14 @@ function logSpanHandler(span) {
|
|
|
735
766
|
`otel: ${span.service} ${span.name} parent=${parent} status=${status2}${db}`
|
|
736
767
|
);
|
|
737
768
|
}
|
|
738
|
-
var import_node_path53, import_node_url2, import_fastify, import_protobufjs, ENV_ATTR_CANONICAL, ENV_ATTR_COMPAT, ENV_FALLBACK, exportTraceServiceRequestType, exportTraceServiceResponseType, cachedProtobufResponseBody, OTLP_STEP_ATTEMPTS, OTLP_STEP_STRIDE;
|
|
769
|
+
var import_node_path53, import_node_url2, import_node_zlib, import_fastify, import_protobufjs, ENV_ATTR_CANONICAL, ENV_ATTR_COMPAT, ENV_FALLBACK, exportTraceServiceRequestType, exportTraceServiceResponseType, cachedProtobufResponseBody, OTLP_STEP_ATTEMPTS, OTLP_STEP_STRIDE;
|
|
739
770
|
var init_otel = __esm({
|
|
740
771
|
"src/otel.ts"() {
|
|
741
772
|
"use strict";
|
|
742
773
|
init_cjs_shims();
|
|
743
774
|
import_node_path53 = __toESM(require("path"), 1);
|
|
744
775
|
import_node_url2 = require("url");
|
|
776
|
+
import_node_zlib = __toESM(require("zlib"), 1);
|
|
745
777
|
import_fastify = __toESM(require("fastify"), 1);
|
|
746
778
|
import_protobufjs = __toESM(require("protobufjs"), 1);
|
|
747
779
|
init_auth();
|
|
@@ -5522,6 +5554,14 @@ function grpcStatusCodeFromAttrs(attrs) {
|
|
|
5522
5554
|
}
|
|
5523
5555
|
return void 0;
|
|
5524
5556
|
}
|
|
5557
|
+
function spanRecordsError(span) {
|
|
5558
|
+
if (span.statusCode === 2) return true;
|
|
5559
|
+
const grpc2 = grpcStatusCodeFromAttrs(span.attributes);
|
|
5560
|
+
if (grpc2 !== void 0 && grpc2 !== 0) return true;
|
|
5561
|
+
const httpStatus = httpResponseStatusFromAttrs(span.attributes);
|
|
5562
|
+
if (httpStatus !== void 0 && httpStatus >= 500) return true;
|
|
5563
|
+
return false;
|
|
5564
|
+
}
|
|
5525
5565
|
function nonHttpFailureMessageFromAttrs(attrs) {
|
|
5526
5566
|
const grpc2 = grpcStatusCodeFromAttrs(attrs);
|
|
5527
5567
|
if (grpc2 !== void 0 && grpc2 !== 0) {
|
|
@@ -6320,6 +6360,21 @@ async function recordExceptionIncident(ctx, span, ts) {
|
|
|
6320
6360
|
};
|
|
6321
6361
|
await appendErrorEvent(ctx, ev);
|
|
6322
6362
|
}
|
|
6363
|
+
async function recordGrpcFailureIncident(ctx, span, ts) {
|
|
6364
|
+
const attrs = sanitizeAttributes(span.attributes);
|
|
6365
|
+
const ev = {
|
|
6366
|
+
id: `${span.traceId}:${span.spanId}`,
|
|
6367
|
+
timestamp: ts,
|
|
6368
|
+
service: span.service,
|
|
6369
|
+
traceId: span.traceId,
|
|
6370
|
+
spanId: span.spanId,
|
|
6371
|
+
errorType: "grpc-failure",
|
|
6372
|
+
errorMessage: incidentMessage(span),
|
|
6373
|
+
...Object.keys(attrs).length > 0 ? { attributes: attrs } : {},
|
|
6374
|
+
affectedNode: incidentAffectedNode(span, ctx.graph, ctx.scanPath)
|
|
6375
|
+
};
|
|
6376
|
+
await appendErrorEvent(ctx, ev);
|
|
6377
|
+
}
|
|
6323
6378
|
async function advance4xxBurst(ctx, span, affectedNode, ts, nowMs, status2) {
|
|
6324
6379
|
const { threshold, windowMs } = loadIncidentThresholdsFromEnv();
|
|
6325
6380
|
if (!ctx.burstState) ctx.burstState = /* @__PURE__ */ new Map();
|
|
@@ -6390,7 +6445,7 @@ async function handleSpan(ctx, span) {
|
|
|
6390
6445
|
warnUnidentifiedSpan(ctx.project ?? DEFAULT_PROJECT);
|
|
6391
6446
|
}
|
|
6392
6447
|
const sourceId = ensureServiceNode(ctx.graph, span.service, env);
|
|
6393
|
-
const isError = span
|
|
6448
|
+
const isError = spanRecordsError(span);
|
|
6394
6449
|
const durationMs = span.durationNanos > 0n && !spanIsStreaming(span) ? Number(span.durationNanos) / 1e6 : void 0;
|
|
6395
6450
|
const sourceServiceNode = ctx.graph.getNodeAttributes(sourceId);
|
|
6396
6451
|
const callSite = callSiteFromSpan(span, sourceServiceNode, ctx.scanPath);
|
|
@@ -6626,10 +6681,13 @@ async function handleSpan(ctx, span) {
|
|
|
6626
6681
|
}
|
|
6627
6682
|
if (span.statusCode !== 2) {
|
|
6628
6683
|
const status2 = httpResponseStatus(span);
|
|
6684
|
+
const grpcStatus = grpcStatusCodeFromAttrs(span.attributes);
|
|
6629
6685
|
if (span.exception) {
|
|
6630
6686
|
await recordExceptionIncident(ctx, span, ts);
|
|
6631
6687
|
} else if (status2 !== void 0 && status2 >= 500) {
|
|
6632
6688
|
await recordFailingResponseIncident(ctx, span, sourceId, ts, status2, 1);
|
|
6689
|
+
} else if (grpcStatus !== void 0 && grpcStatus !== 0) {
|
|
6690
|
+
await recordGrpcFailureIncident(ctx, span, ts);
|
|
6633
6691
|
} else if (status2 !== void 0 && status2 >= 400 && spanMintsObservedEdge(span.kind)) {
|
|
6634
6692
|
await advance4xxBurst(ctx, span, sourceId, ts, nowMs, status2);
|
|
6635
6693
|
}
|