next-observer 0.3.18 → 0.3.20

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/README.md CHANGED
@@ -1,40 +1,101 @@
1
1
  # next-observer
2
2
 
3
- The observer for **[next-observe](https://www.npmjs.com/package/next-observe)**: an OTLP collector, a trace UI, an anomaly
4
- detector and AI agents (Google ADK) that investigate your Next.js app on their own. Run it with `npx` — it never goes
5
- into your app's dependencies.
3
+ The **observer** for Next.js: one process that receives your app's telemetry, shows it, and has **AI agents** investigate
4
+ it. A server, a UI, an anomaly detector and the agents — started with `npx`, never installed into your app.
6
5
 
7
6
  ```bash
8
- npx next-observer dev # observer + UI on http://127.0.0.1:4318, then `next dev` in the current directory
7
+ npx next-observer init # once: connects the app (installs the APM agent, next-observe, into it)
8
+ npm run observe # the observer + `next dev`; open http://127.0.0.1:4318
9
9
  ```
10
10
 
11
- - **Trace UI** — list + waterfall, no Docker, no external backend
12
- - **Chat with agents** that query your telemetry: slow operations, regressions between deployments, failing operations
13
- with exact errors, N+1 patterns — with evidence cards built from the data, not by the model
14
- - **Anomaly detector** that starts an investigation by itself when error rates or latency jump
15
- - **Cold starts are not regressions:** the first request of a route after a server start (in `next dev` it includes
16
- compiling the route) is left out of latency stats and the detector, and marked in traces (needs next-observe ≥ 0.2.2)
11
+ No app at hand? `npx next-observer collector --demo` starts the observer with a sample shop that has four things to
12
+ find: a deployment that made checkout slower, a failing endpoint, an N+1 query, and an error the last deployment brought.
17
13
 
18
- Requires Node.js 22.18+. The app is instrumented with `next-observe` (see its README).
14
+ ![Overview: requests, latency, errors, and a banner saying the last deployment looks like a regression](https://raw.githubusercontent.com/ataztech910/nextjs-observe/master/docs/screenshots/overview.png)
15
+
16
+ ## Two packages, one letter apart
17
+
18
+ | | [`next-observe`](https://www.npmjs.com/package/next-observe) | [`next-observer`](https://www.npmjs.com/package/next-observer) |
19
+ |---|---|---|
20
+ | **What it is** | the **APM agent** | the **observer** — a server with a UI and **AI agents** |
21
+ | **Where it runs** | inside your Next.js app (a dependency) | next to the app, started with `npx` (never a dependency) |
22
+ | **What it does** | collects telemetry and sends it | receives telemetry, shows it, investigates it |
23
+ | **Contains AI?** | no — OpenTelemetry only | yes — the AI agents live here |
24
+
25
+ ```
26
+ your Next.js app the observer
27
+ ┌──────────────────────────┐ ┌──────────────────────────────────┐
28
+ │ next-observe │ traces │ next-observer (port 4318) │
29
+ │ the APM agent │ ───────────▶ │ server · UI · anomaly detector │
30
+ │ collects and sends │ OTLP/HTTP │ AI agents that investigate │
31
+ └──────────────────────────┘ └──────────────────────────────────┘
32
+ ```
33
+
34
+ **Two kinds of "agent" — they are not the same thing:**
35
+
36
+ - **APM agent** = `next-observe`. The classic meaning from application performance monitoring: a library inside the app
37
+ that records what happens (requests, timings, errors) and ships it out. It decides nothing.
38
+ - **AI agents** = inside `next-observer`. Language models with tools that query the recorded telemetry and answer
39
+ "what is slow, since which deployment, and where in the code". They never run inside your app.
40
+
41
+ ## What you get
42
+
43
+ **Overview** — requests by status class, latency and 5xx rate, each compared with the period before; the slowest and
44
+ the busiest routes. When the latest deployment made a route slower or more error-prone, a banner says so with the
45
+ measured numbers, and **Investigate** hands the question to the AI agents.
46
+
47
+ **AI agents that investigate — asked or on their own.** The anomaly detector watches incoming traces; when errors or
48
+ latency jump it starts an investigation by itself. The agents get facts only from tools over your telemetry, and the
49
+ evidence cards under a report are built by code from those tool results, not written by the model.
50
+
51
+ ![Chat: the detector noticed slow requests and the AI agents traced them to a function and a deployment](https://raw.githubusercontent.com/ataztech910/nextjs-observe/master/docs/screenshots/chat.png)
52
+
53
+ **Errors as defects** — one entry per "this operation fails with this message", not per failed request: where the
54
+ error originated, which requests fail because of it, when it was first seen, and whether the last deployment brought it.
55
+
56
+ ![Errors: two defects, the first marked NEW IN V2](https://raw.githubusercontent.com/ataztech910/nextjs-observe/master/docs/screenshots/errors.png)
57
+
58
+ **Traces** — a waterfall, the critical path (the spans that decided the duration), each operation's own time, and how
59
+ this call compares with the others of its kind.
60
+
61
+ ![A trace with the critical path highlighted and a table of where the time went](https://raw.githubusercontent.com/ataztech910/nextjs-observe/master/docs/screenshots/trace.png)
62
+
63
+ **One operation up close** — its latency distribution, and a note when the calls fall into two clearly separate speeds
64
+ (a fast and a slow path, or the version before and after a deployment).
65
+
66
+ ![An operation page: details per version and a latency histogram with two speeds](https://raw.githubusercontent.com/ataztech910/nextjs-observe/master/docs/screenshots/operation.png)
67
+
68
+ **Copy prompt** — on a trace, a defect or a finished investigation: a ready prompt for a coding agent (Claude Code,
69
+ Cursor, …) with the measured facts and the task, so the fix starts from data instead of a retelling.
70
+
71
+ Also: cold starts are not regressions (the first request of a route after a server start is left out of latency and
72
+ marked), no Docker and no external backend, and it accepts OTLP/HTTP from any OpenTelemetry SDK — not only `next-observe`.
73
+
74
+ Requires Node.js 22.18+.
19
75
 
20
76
  ## Commands
21
77
 
22
78
  ```bash
23
79
  next-observer init [--root <dir>] [--proxy] # connect a Next.js app (see below)
24
- next-observer dev [--root <dir>] [--port <n>] [-- <next dev args>] # observer + next dev
25
- next-observer collector [--host <h>] [--port <n>] [--api-key <k>] [--ui-password <p>] [--demo]
80
+ next-observer dev [--root <dir>] [--port <n>] [-- <next dev args>] # the observer + your app's `next dev`
81
+ next-observer collector [--host <h>] [--port <n>] [--api-key <k>] [--ui-password <p>] [--demo] # the observer alone
26
82
  ```
27
83
 
28
84
  Run them with `npx next-observer <command>`; installed globally (`npm i -g next-observer`) the command is also
29
85
  available as `nxo`.
30
86
 
31
- `next-observer init` installs `next-observe` with the project's package manager, wraps the exported `next.config` in
87
+ `next-observer init` installs the APM agent, `next-observe`, with the project's package manager, wraps the exported `next.config` in
32
88
  `withObserve()`, creates `instrumentation.ts` and `instrumentation-client.ts` (in `src/` when the app lives there; `.js`
33
89
  without TypeScript) and adds an `observe` script. Already connected files stay untouched; an existing `register()` is
34
90
  never rewritten — init says what to add. `--proxy` also creates the runtime proxy route for browser spans.
35
91
 
36
- `next-observer collector` runs the observer alone — next to `next dev` in another terminal, or on a server for production.
37
- `--demo` preloads a sample "shop" scenario (a regression between versions, a failing endpoint, an N+1) and keeps sending live v2 traffic, so the detector and the agents have something to find without an app.
92
+ `next-observer dev` is a convenience for local work: it starts the observer and then your app's own `next dev` in the
93
+ same terminal. The app stays yours — the observer only launches it.
94
+
95
+ `next-observer collector` runs the observer alone — next to `next dev` in another terminal, or on a server for
96
+ production. ("Collector" is the OpenTelemetry word for the server that receives telemetry; here it comes with the UI,
97
+ the detector and the AI agents.) `--demo` preloads the sample shop and keeps sending live traffic, so the detector and
98
+ the AI agents have something to find without an app.
38
99
 
39
100
  ## On a server
40
101
 
@@ -47,16 +108,21 @@ next-observer collector --host 0.0.0.0 --api-key <ingest key> --ui-password <pas
47
108
  `--api-key` is for the apps sending traces (`OBSERVE_API_KEY` in the app), `--ui-password` for the people opening the
48
109
  UI and the chat (the browser asks for it). `/health` stays open for uptime checks. Without them the banner warns.
49
110
 
50
- ## Models
111
+ ## Models for the AI agents
51
112
 
52
113
  | `OBSERVE_AI` | Model |
53
114
  |---|---|
54
- | `mock` (default) | deterministic stand-in — the whole pipeline runs without tokens |
115
+ | `mock` (default) | deterministic stand-in — the whole pipeline runs without a model, tokens or a network |
55
116
  | `real` | Gemini when `GEMINI_API_KEY` + `GEMINI_MODEL` are set, otherwise [Kitana](https://www.npmjs.com/package/@kitana-sdk/adk) (Claude / Codex CLI, Ollama, API keys) |
56
117
 
57
- ## Your own specialists
118
+ One investigation makes 7–12 model calls. A call that hangs is started again once; "too many requests" (429) and
119
+ "overloaded" (5xx) are waited for and retried — up to a minute, as the provider asks. A free Gemini tier allows only a
120
+ few requests per minute, so an investigation may pause for that minute; a key without credits, a wrong key or a wrong
121
+ model name is explained in the chat in plain words.
122
+
123
+ ## Your own AI agents
58
124
 
59
- Put `observe.agents.ts` (or `.mts`, `.js`, `.mjs`) in the app root. A specialist with a built-in name
125
+ The built-in AI agents are an orchestrator and three specialists (latency, errors, traffic). To change them, put `observe.agents.ts` (or `.mts`, `.js`, `.mjs`) in the app root. A specialist with a built-in name
60
126
  (`latency_agent`, `error_agent`, `traffic_agent`) replaces it; a new name adds one. The orchestrator picks specialists by
61
127
  their `description`; the rules "facts from tools only" and "own tools only" are added to every instruction.
62
128
 
@@ -82,6 +148,7 @@ Tools: `get_services`, `get_operation_stats`, `compare_versions`, `get_errors`,
82
148
  |---|---|---|
83
149
  | `OBSERVE_AI` | `mock` | `mock` \| `real` |
84
150
  | `OBSERVE_DETECTOR` | on | `off` disables the anomaly detector |
151
+ | `OBSERVE_MODEL_TIMEOUT_MS` | `90000` | how long one model call may take before it is started again |
85
152
  | `OBSERVE_API_KEY` | — | require `x-api-key` on ingest (`/v1/traces`) |
86
153
  | `OBSERVE_UI_PASSWORD` | — | require a password for the UI, the query API and the chat (browser login, any user name) |
87
154
  | `OBSERVE_PORT`, `OBSERVE_HOST`, `OBSERVE_ROOT` | `4318`, `127.0.0.1`, `.` | same as `--port`, `--host`, `--root` |
@@ -67,7 +67,7 @@ export function createInvestigator(options) {
67
67
  compare_versions: tool(agent, 'compare_versions', 'Latest deployed version vs the previous one per operation: p95 ratio and error-rate delta. `errorRateChangeSignificant: false` means the error-rate difference is within random noise for that many requests. Use it to name the deployment that caused a regression.', z.object({ service, operation, sinceMinutes: since }), (a) => q.compareVersions(a)),
68
68
  get_errors: tool(agent, 'get_errors', 'Failing operations: error rate, top exception messages (each with when it was first seen and in which versions), example trace ids.', z.object({ service, operation, sinceMinutes: since }), (a) => q.getErrors(a)),
69
69
  search_traces: tool(agent, 'search_traces', 'Recent traces matching filters, to get example trace ids.', z.object({ service, operation, minDurationMs: z.number().optional(), hasError: z.boolean().optional(), sinceMinutes: since }), (a) => q.searchTraces(a)),
70
- get_trace: tool(agent, 'get_trace', 'One trace as a tree with self time, errors and code file paths; `repeated` lists ≥3 identical sibling calls (N+1); `nextInternalMs` is time inside Next.js itself (routing, rendering, dev compilation), not the app code.', z.object({ traceId: z.string().describe('32-char hex trace id from search_traces') }), (a) => q.getTrace(a)),
70
+ get_trace: tool(agent, 'get_trace', 'One trace as a tree with self time, errors and code file paths; `repeated` lists ≥3 identical sibling calls (N+1); `nextInternalMs` is time inside Next.js itself (routing, rendering, dev compilation), not the app code; `integrityCheck` on a span means it returned successfully, quickly, and still the wrong data — the span has no error and may not even be slow, so check this field specifically rather than assuming a clean-looking span is fine.', z.object({ traceId: z.string().describe('32-char hex trace id from search_traces, or from an anomaly question') }), (a) => q.getTrace(a)),
71
71
  });
72
72
  const agents = specialists.map((spec) => {
73
73
  const available = tools(spec.name);
@@ -1 +1 @@
1
- {"version":3,"file":"investigator.js","sourceRoot":"","sources":["../../src/agents/investigator.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,EAAgB,MAAM,aAAa,CAAA;AAC7G,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,kBAAkB,EAAqB,MAAM,qBAAqB,CAAA;AAC3E,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,qBAAqB,EAAsC,MAAM,kBAAkB,CAAA;AAyB3I,wHAAwH;AACxH,sHAAsH;AACtH,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6DAA6D,CAAC,CAAA;AAC3G,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAA;AACpE,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC,CAAA;AAErG;;;;GAIG;AACH,gGAAgG;AAChG,SAAS,aAAa,CAAC,OAAe;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OA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 'error_agent',
37
- description: 'Error specialist: failing operations, error rates, exact exception messages, source vs downstream victims, whether an error is new.',
37
+ description: 'Error specialist: failing operations, error rates, exact exception messages, source vs downstream victims, whether an error is new — and data-integrity problems (a response that came back successfully and quickly but with the wrong data, no exception at all).',
38
38
  instruction: `You are an error specialist. Report the failing operation, its error rate and the exact exception message.
39
39
  Use get_trace on an example trace to separate the source span from its downstream victims and to find the code file.
40
40
  Say whether the error is new: get_errors tells when each message was first seen and in which versions; compare_versions
41
- tells whether the error rate changed with the latest deployment (errorRateChangeSignificant). Max 4 sentences.`,
41
+ tells whether the error rate changed with the latest deployment (errorRateChangeSignificant).
42
+ A trace can look completely clean — no error, not slow — and still be wrong: get_trace's \`integrityCheck\` field on a
43
+ span means that span's response did not match what was requested. get_errors will not find these (their status is not
44
+ "error"); you only see them by opening the trace. Report this as a data-integrity problem, distinct from an exception,
45
+ and name what the mismatched spans share (same operation? same deployment version?). Max 4 sentences.`,
42
46
  tools: ['get_errors', 'compare_versions', 'search_traces', 'get_trace'],
43
47
  },
44
48
  {
@@ -1 +1 @@
1
- {"version":3,"file":"specialists.js","sourceRoot":"","sources":["../../src/agents/specialists.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,2HAA2H;AAE3H,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,cAAc,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,CAAU,CAAA;AAa1I,MAAM,IAAI,GAAG,wBAAwB,CAAA;AAErC,wGAAwG;AACxG,MAAM,UAAU,gBAAgB,CAAC,IAAoB;IACnD,MAAM,KAAK,GAAG,OAAO,IAAI,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,eAAe,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,YAAY,CAAA;IACzF,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAA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U,EAAE,CAAA;AAC1G,CAAC"}
@@ -1,5 +1,5 @@
1
- import type { NormalizedSpan } from '../collector/types.js';
2
- export type AnomalyType = 'high_error_rate' | 'high_latency' | 'no_traffic';
1
+ import type { NormalizedSpan, SpanEvent } from '../collector/types.js';
2
+ export type AnomalyType = 'high_error_rate' | 'high_latency' | 'no_traffic' | 'data_integrity';
3
3
  export interface Anomaly {
4
4
  id: string;
5
5
  type: AnomalyType;
@@ -11,7 +11,7 @@ export interface Anomaly {
11
11
  };
12
12
  severity: 'warning' | 'critical';
13
13
  detectedAtMs: number;
14
- /** What was measured: error share, slow share, or seconds of silence. */
14
+ /** What was measured: error share, slow share, seconds of silence, or (data_integrity) a raw failure count. */
15
15
  value: number;
16
16
  threshold: number;
17
17
  /** Server requests in the window the value is based on (0 for no_traffic). */
@@ -25,6 +25,17 @@ export interface Anomaly {
25
25
  errors: number;
26
26
  slow: number;
27
27
  }[];
28
+ /**
29
+ * `data_integrity` only: the specific checks that failed, each one evidence a latency/error-rate chart can never
30
+ * show — the response came back fast, with a 2xx, and still was not the one that was asked for.
31
+ */
32
+ integrityFailures?: {
33
+ service: string;
34
+ operation: string;
35
+ traceId: string;
36
+ expected: unknown;
37
+ actual: unknown;
38
+ }[];
28
39
  }
29
40
  export interface DetectorOptions {
30
41
  /** Window for the app-wide rule. */
@@ -48,6 +59,16 @@ export interface DetectorOptions {
48
59
  cooldownMs?: number;
49
60
  now?: () => number;
50
61
  }
62
+ /**
63
+ * A span whose own status/duration are both unremarkable — fast, 2xx — can still carry proof that the data inside it
64
+ * was wrong: code that verified "did I get back what I asked for" records that verdict as this event, independent of
65
+ * whether the span threw. See docs/APM_FINDINGS.md, incident F: a connection pooler in transaction-pooling mode can
66
+ * return another concurrent query's result instead of erroring or hanging — nothing about status or latency shows it.
67
+ */
68
+ export declare const INTEGRITY_CHECK_EVENT = "integrity_check";
69
+ /** Exported so agent tools (debug/queries.ts: getTrace) can show the same evidence the detector acted on — an
70
+ * anomaly whose question names a trace id is only as trustworthy as the agent's own ability to go look at it. */
71
+ export declare function integrityFailureEvent(s: NormalizedSpan): SpanEvent | undefined;
51
72
  export declare class AnomalyDetector {
52
73
  readonly options: Required<Omit<DetectorOptions, 'now'>>;
53
74
  private readonly now;
@@ -59,7 +80,11 @@ export declare class AnomalyDetector {
59
80
  private reported;
60
81
  private seq;
61
82
  constructor(options?: DetectorOptions);
62
- /** Feed spans as they are ingested. */
83
+ /**
84
+ * Feed spans as they are ingested. Kept beyond server-entry spans: any span carrying a failed `integrity_check`
85
+ * event, since that check naturally lives on the call that did the verifying (e.g. a `db.query` child span) —
86
+ * dropping non-server spans here would make the data_integrity rule below unable to ever see its own evidence.
87
+ */
63
88
  observe(spans: NormalizedSpan[]): void;
64
89
  /** Evaluate the window now; returns new anomalies (respecting cooldowns). */
65
90
  check(): Anomaly[];
@@ -71,6 +96,11 @@ export declare class AnomalyDetector {
71
96
  */
72
97
  private alreadyExplained;
73
98
  private anomaly;
99
+ /**
100
+ * `bad` are spans whose own status/duration passed every other rule and still carry proof they returned the wrong
101
+ * data (see `integrityFailureEvent`) — always `critical`, there is no "warning" tier for a response that lied.
102
+ */
103
+ private integrityAnomaly;
74
104
  }
75
105
  /** The question the agents get when an anomaly fires — carries the evidence so they know where to start. */
76
106
  export declare function questionFor(anomaly: Anomaly): string;
@@ -1,7 +1,19 @@
1
1
  const DEFAULTS = { windowMs: 10_000, operationWindowMs: 30_000, errorRate: 0.2, slowMs: 1000, slowRate: 0.3, noTrafficMs: 120_000, minSamples: 5, cooldownMs: 300_000 };
2
- // Only server entry spans count: Next emits ~7 internal spans per request, which would dilute a 30% error rate below
3
- // any threshold. Browser and internal spans are ignored.
2
+ // Only server entry spans count for the rate-based rules below: Next emits ~7 internal spans per request, which
3
+ // would dilute a 30% error rate below any threshold. Browser and internal spans are ignored there.
4
4
  const isServerRequest = (s) => s.kind === 'server';
5
+ /**
6
+ * A span whose own status/duration are both unremarkable — fast, 2xx — can still carry proof that the data inside it
7
+ * was wrong: code that verified "did I get back what I asked for" records that verdict as this event, independent of
8
+ * whether the span threw. See docs/APM_FINDINGS.md, incident F: a connection pooler in transaction-pooling mode can
9
+ * return another concurrent query's result instead of erroring or hanging — nothing about status or latency shows it.
10
+ */
11
+ export const INTEGRITY_CHECK_EVENT = 'integrity_check';
12
+ /** Exported so agent tools (debug/queries.ts: getTrace) can show the same evidence the detector acted on — an
13
+ * anomaly whose question names a trace id is only as trustworthy as the agent's own ability to go look at it. */
14
+ export function integrityFailureEvent(s) {
15
+ return s.events.find((e) => e.name === INTEGRITY_CHECK_EVENT && e.attributes.ok === false);
16
+ }
5
17
  export class AnomalyDetector {
6
18
  options;
7
19
  now;
@@ -17,13 +29,17 @@ export class AnomalyDetector {
17
29
  this.options = { ...DEFAULTS, ...rest };
18
30
  this.now = now ?? Date.now;
19
31
  }
20
- /** Feed spans as they are ingested. */
32
+ /**
33
+ * Feed spans as they are ingested. Kept beyond server-entry spans: any span carrying a failed `integrity_check`
34
+ * event, since that check naturally lives on the call that did the verifying (e.g. a `db.query` child span) —
35
+ * dropping non-server spans here would make the data_integrity rule below unable to ever see its own evidence.
36
+ */
21
37
  observe(spans) {
22
38
  const atMs = this.now();
23
39
  if (spans.length > 0)
24
40
  this.lastSeenMs = atMs;
25
41
  for (const span of spans)
26
- if (isServerRequest(span))
42
+ if (isServerRequest(span) || integrityFailureEvent(span))
27
43
  this.window.push({ atMs, span });
28
44
  }
29
45
  /** Evaluate the window now; returns new anomalies (respecting cooldowns). */
@@ -31,7 +47,10 @@ export class AnomalyDetector {
31
47
  const now = this.now();
32
48
  const o = this.options;
33
49
  this.window = this.window.filter((w) => now - w.atMs <= Math.max(o.windowMs, o.operationWindowMs));
50
+ // `within` includes the non-server spans kept only for their integrity-check event (see `observe`); the
51
+ // rate-based rules must not see those, so they go through `serverWithin` instead.
34
52
  const within = (ms) => this.window.filter((w) => now - w.atMs <= ms).map((w) => w.span);
53
+ const serverWithin = (ms) => within(ms).filter(isServerRequest);
35
54
  const found = [];
36
55
  const judge = (list, windowMs, subject) => {
37
56
  if (list.length < o.minSamples)
@@ -47,16 +66,37 @@ export class AnomalyDetector {
47
66
  found.push(this.anomaly('high_latency', slowRate, o.slowRate, list, now, slowRate >= 2 * o.slowRate, windowMs, subject));
48
67
  }
49
68
  };
50
- judge(within(o.windowMs), o.windowMs);
69
+ judge(serverWithin(o.windowMs), o.windowMs);
51
70
  // Per operation: on a realistic route mix one broken endpoint (30% errors) is only ~10% of all requests —
52
71
  // below the app-wide threshold, yet clearly an incident.
53
72
  const byOperation = new Map();
54
- for (const s of within(o.operationWindowMs)) {
73
+ for (const s of serverWithin(o.operationWindowMs)) {
55
74
  const key = `${s.service}\u0000${s.name}`;
56
75
  byOperation.set(key, [...(byOperation.get(key) ?? []), s]);
57
76
  }
58
77
  for (const list of byOperation.values())
59
78
  judge(list, o.operationWindowMs, { service: list[0].service, operation: list[0].name });
79
+ // Zero-tolerance, unlike the two rate-based rules above: a wrong-data response is never acceptable even once, so
80
+ // this does not wait for a share to cross a threshold (and does not need minSamples — one occurrence among two
81
+ // requests is already the whole story, not noise). Scans `within`, not `serverWithin`: the check naturally lives
82
+ // on the span that did the verifying (often a db.query child span, not the server entry span), so excluding
83
+ // non-server spans here would make this rule unable to ever see its own evidence.
84
+ const byOperationAny = new Map();
85
+ for (const s of within(o.operationWindowMs)) {
86
+ const key = `${s.service}\u0000${s.name}`;
87
+ byOperationAny.set(key, [...(byOperationAny.get(key) ?? []), s]);
88
+ }
89
+ const judgeIntegrity = (list, windowMs, subject) => {
90
+ const bad = list.filter((s) => integrityFailureEvent(s) !== undefined);
91
+ if (bad.length === 0)
92
+ return;
93
+ if (subject && found.some((a) => a.type === 'data_integrity' && a.scope === 'all'))
94
+ return;
95
+ found.push(this.integrityAnomaly(bad, now, windowMs, subject));
96
+ };
97
+ judgeIntegrity(within(o.windowMs), o.windowMs);
98
+ for (const list of byOperationAny.values())
99
+ judgeIntegrity(list, o.operationWindowMs, { service: list[0].service, operation: list[0].name });
60
100
  if (this.lastSeenMs !== null && now - this.lastSeenMs > o.noTrafficMs) {
61
101
  found.push(this.anomaly('no_traffic', Math.round((now - this.lastSeenMs) / 1000), o.noTrafficMs / 1000, [], now, true, o.windowMs));
62
102
  }
@@ -122,6 +162,38 @@ export class AnomalyDetector {
122
162
  operations,
123
163
  };
124
164
  }
165
+ /**
166
+ * `bad` are spans whose own status/duration passed every other rule and still carry proof they returned the wrong
167
+ * data (see `integrityFailureEvent`) — always `critical`, there is no "warning" tier for a response that lied.
168
+ */
169
+ integrityAnomaly(bad, now, windowMs, subject) {
170
+ const byOperation = new Map();
171
+ for (const s of bad) {
172
+ const key = `${s.service}\u0000${s.name}`;
173
+ const entry = byOperation.get(key) ?? { service: s.service, operation: s.name, count: 0, errors: 0, slow: 0 };
174
+ entry.count++;
175
+ entry.errors++; // reuses `errors` as "failures" so existing operations-sorting/display code needs no new field
176
+ byOperation.set(key, entry);
177
+ }
178
+ const integrityFailures = bad.slice(0, 5).map((s) => {
179
+ const event = integrityFailureEvent(s);
180
+ return { service: s.service, operation: s.name, traceId: s.traceId, expected: event.attributes.expected, actual: event.attributes.actual };
181
+ });
182
+ return {
183
+ id: `data_integrity-${now}-${++this.seq}`,
184
+ type: 'data_integrity',
185
+ scope: subject ? 'operation' : 'all',
186
+ ...(subject ? { subject } : {}),
187
+ severity: 'critical',
188
+ detectedAtMs: now,
189
+ value: bad.length,
190
+ threshold: 0,
191
+ sampleSize: bad.length,
192
+ windowMs,
193
+ operations: [...byOperation.values()].sort((a, b) => b.errors - a.errors).slice(0, 3),
194
+ integrityFailures,
195
+ };
196
+ }
125
197
  }
126
198
  /** The question the agents get when an anomaly fires — carries the evidence so they know where to start. */
127
199
  export function questionFor(anomaly) {
@@ -133,6 +205,11 @@ export function questionFor(anomaly) {
133
205
  return `Anomaly detected: ${Math.round(anomaly.value * 100)}% of ${what} failed in the last ${seconds}s (${anomaly.sampleSize} requests). Most affected: ${ops}. Find the failing operation, the exact error and its source.`;
134
206
  case 'high_latency':
135
207
  return `Anomaly detected: ${Math.round(anomaly.value * 100)}% of ${what} were slower than threshold in the last ${seconds}s (${anomaly.sampleSize} requests). Most affected: ${ops}. Find what is slow and which deployment introduced it.`;
208
+ case 'data_integrity': {
209
+ const sample = anomaly.integrityFailures?.[0];
210
+ const evidence = sample ? ` Example: asked for ${JSON.stringify(sample.expected)}, got back ${JSON.stringify(sample.actual)} (trace ${sample.traceId}).` : '';
211
+ return `Anomaly detected: ${anomaly.sampleSize} response(s) to ${what} in the last ${seconds}s did not match what was requested — not an error, not slow, just wrong.${evidence} This is not a latency or error-rate problem: find what these requests share (same connection pool? same deployment?) and whether it is still happening.`;
212
+ }
136
213
  case 'no_traffic':
137
214
  return `Anomaly detected: no spans received for ${anomaly.value}s after traffic was flowing. Check which services went silent.`;
138
215
  }
@@ -1 +1 @@
1
- {"version":3,"file":"detector.js","sourceRoot":"","sources":["../../src/debug/detector.ts"],"names":[],"mappings":"AA+CA,MAAM,QAAQ,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAA;AAEvK,qHAAqH;AACrH,yDAAyD;AACzD,MAAM,eAAe,GAAG,CAAC,CAAiB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAA;AAElE,MAAM,OAAO,eAAe;IACjB,OAAO,CAAwC;IACvC,GAAG,CAAc;IAC1B,MAAM,GAA6C,EAAE,CAAA;IACrD,UAAU,GAAkB,IAAI,CAAA;IACxC,4DAA4D;IAC3C,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAA;IAC3D,sGAAsG;IAC9F,QAAQ,GAAc,EAAE,CAAA;IACxB,GAAG,GAAG,CAAC,CAAA;IAEf,YAAY,OA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J,CAAA;QAC3U,CAAC;QACD,KAAK,YAAY;YACf,OAAO,2CAA2C,OAAO,CAAC,KAAK,gEAAgE,CAAA;IACnI,CAAC;AACH,CAAC"}
@@ -19,6 +19,12 @@ export interface TraceRow {
19
19
  /** Self time of hidden Next.js internal spans under this one (routing, rendering, dev compilation) — not user code. */
20
20
  nextInternalMs?: number;
21
21
  error?: string;
22
+ /** A verified wrong-data response (incident F) — distinct from `error`: status was fine, duration was fine, the
23
+ * data inside was not what was asked for. Only an app that instruments its own identity check can ever report this. */
24
+ integrityCheck?: {
25
+ expected: unknown;
26
+ actual: unknown;
27
+ };
22
28
  attributes?: Record<string, unknown>;
23
29
  }
24
30
  export declare function createAgentQueries(storage: StorageAdapter, options?: QueryOptions): {
@@ -3,6 +3,7 @@
3
3
  // Rules for every tool: compact, token-cheap output (aggregates, not raw spans), rounded numbers, and a `note`
4
4
  // instead of an empty result when a name filter matches nothing (users say "checkout", spans say "chargePayment").
5
5
  import { isFrameworkSpan } from '../collector/framework.js';
6
+ import { integrityFailureEvent } from './detector.js';
6
7
  import { errorRateChangeIsSignificant } from './stats.js';
7
8
  const round = (n) => Math.round(n * 10) / 10;
8
9
  const ago = (now, ms) => Math.max(0, Math.round((now - ms) / 1000));
@@ -280,6 +281,7 @@ export function createAgentQueries(storage, options = {}) {
280
281
  for (const s of kids) {
281
282
  const internalMs = nextInternalMs.get(s.spanId);
282
283
  const attributes = Object.fromEntries(KEY_ATTRIBUTES.filter((k) => s.attributes[k] !== undefined).map((k) => [k, s.attributes[k]]));
284
+ const integrityEvent = integrityFailureEvent(s);
283
285
  rows.push({
284
286
  depth,
285
287
  name: s.name,
@@ -289,6 +291,9 @@ export function createAgentQueries(storage, options = {}) {
289
291
  ...(storage.isColdStart(s) ? { coldStart: true } : {}),
290
292
  ...(internalMs ? { nextInternalMs: round(internalMs) } : {}),
291
293
  ...(s.status === 'error' ? { error: exceptionMessage(s) ?? 'error' } : {}),
294
+ // Checked independent of `status`: incident F's whole point is that this fires on spans that are
295
+ // otherwise fine — fast, no error — so it is never conditioned on one already being set above.
296
+ ...(integrityEvent ? { integrityCheck: { expected: integrityEvent.attributes.expected, actual: integrityEvent.attributes.actual } } : {}),
292
297
  ...(Object.keys(attributes).length ? { attributes } : {}),
293
298
  });
294
299
  visit(s.spanId, s.name, depth + 1);