@neat.is/core 0.4.22 → 0.4.24-dev.20260701

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
@@ -2643,6 +2643,22 @@ async function recordFailingResponseIncident(ctx, span, affectedNode, timestamp,
2643
2643
  };
2644
2644
  await appendErrorEvent(ctx, ev);
2645
2645
  }
2646
+ async function recordExceptionIncident(ctx, span, ts) {
2647
+ const attrs = sanitizeAttributes(span.attributes);
2648
+ const ev = {
2649
+ id: `${span.traceId}:${span.spanId}`,
2650
+ timestamp: ts,
2651
+ service: span.service,
2652
+ traceId: span.traceId,
2653
+ spanId: span.spanId,
2654
+ errorMessage: incidentMessage(span),
2655
+ ...span.exception?.type ? { exceptionType: span.exception.type } : {},
2656
+ ...span.exception?.stacktrace ? { exceptionStacktrace: span.exception.stacktrace } : {},
2657
+ ...Object.keys(attrs).length > 0 ? { attributes: attrs } : {},
2658
+ affectedNode: incidentAffectedNode(span, ctx.graph, ctx.scanPath)
2659
+ };
2660
+ await appendErrorEvent(ctx, ev);
2661
+ }
2646
2662
  async function advance4xxBurst(ctx, span, affectedNode, ts, nowMs, status2) {
2647
2663
  const { threshold, windowMs } = loadIncidentThresholdsFromEnv();
2648
2664
  if (!ctx.burstState) ctx.burstState = /* @__PURE__ */ new Map();
@@ -2799,7 +2815,9 @@ async function handleSpan(ctx, span) {
2799
2815
  }
2800
2816
  if (span.statusCode !== 2) {
2801
2817
  const status2 = httpResponseStatus(span);
2802
- if (status2 !== void 0 && status2 >= 500) {
2818
+ if (span.exception) {
2819
+ await recordExceptionIncident(ctx, span, ts);
2820
+ } else if (status2 !== void 0 && status2 >= 500) {
2803
2821
  await recordFailingResponseIncident(ctx, span, sourceId, ts, status2, 1);
2804
2822
  } else if (status2 !== void 0 && status2 >= 400 && spanMintsObservedEdge(span.kind)) {
2805
2823
  await advance4xxBurst(ctx, span, sourceId, ts, nowMs, status2);