@checkstack/healthcheck-backend 1.21.3 → 1.22.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/CHANGELOG.md +219 -0
- package/drizzle/0021_amazing_wolf_cub.sql +8 -0
- package/drizzle/meta/0021_snapshot.json +717 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +21 -20
- package/src/ai/system-signals-contributor.test.ts +1 -0
- package/src/cache.test.ts +3 -0
- package/src/effective-environments.test.ts +63 -2
- package/src/effective-environments.ts +34 -0
- package/src/health-entity.ts +8 -2
- package/src/health-state.ts +15 -6
- package/src/index.ts +23 -0
- package/src/queue-executor.ts +545 -565
- package/src/router-satellite-ingest.test.ts +136 -0
- package/src/router.ts +65 -4
- package/src/schema.ts +21 -0
- package/src/service-batching.test.ts +3 -1
- package/src/service-ingest-assertions.test.ts +33 -60
- package/src/service-paused-filter.test.ts +9 -4
- package/src/service-rollup-worst-wins.test.ts +147 -55
- package/src/service.ts +355 -148
- package/src/state-evaluator.test.ts +49 -0
- package/src/system-health-override.ts +6 -1
- package/tsconfig.json +3 -0
|
@@ -279,4 +279,53 @@ describe("evaluateHealthStatus", () => {
|
|
|
279
279
|
);
|
|
280
280
|
});
|
|
281
281
|
});
|
|
282
|
+
describe("interleaved streams (why callers must slice per environment AND source)", () => {
|
|
283
|
+
// This documents the MECHANISM behind a reported bug: a system whose local
|
|
284
|
+
// check passed and whose satellite check failed every time read HEALTHY.
|
|
285
|
+
// The evaluator is deliberately stream-agnostic - it assumes the runs it is
|
|
286
|
+
// handed come from ONE stream - so mixing two locations' runs into one call
|
|
287
|
+
// silently destroys the signal. `getSystemHealthStatus` must therefore
|
|
288
|
+
// evaluate one (environment, source) slice per call; these tests fail loudly
|
|
289
|
+
// if anyone re-collapses that slicing.
|
|
290
|
+
const thresholds: ConsecutiveThresholds = {
|
|
291
|
+
mode: "consecutive",
|
|
292
|
+
healthy: { minSuccessCount: 2 },
|
|
293
|
+
degraded: { minFailureCount: 2 },
|
|
294
|
+
unhealthy: { minFailureCount: 3 },
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
test("a permanently failing stream is MASKED when interleaved with a healthy one", () => {
|
|
298
|
+
// Local healthy alternating with satellite unhealthy: the streak breaks on
|
|
299
|
+
// every run, so neither threshold is ever met and evaluation falls through
|
|
300
|
+
// to its healthy default - even though one location has never succeeded.
|
|
301
|
+
const interleaved = createRuns([
|
|
302
|
+
"healthy",
|
|
303
|
+
"unhealthy",
|
|
304
|
+
"healthy",
|
|
305
|
+
"unhealthy",
|
|
306
|
+
"healthy",
|
|
307
|
+
"unhealthy",
|
|
308
|
+
]);
|
|
309
|
+
expect(evaluateHealthStatus({ runs: interleaved, thresholds })).toBe(
|
|
310
|
+
"healthy",
|
|
311
|
+
);
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
test("the same runs, sliced per source, report the failing location", () => {
|
|
315
|
+
// The fix: hand the evaluator one stream at a time.
|
|
316
|
+
expect(
|
|
317
|
+
evaluateHealthStatus({
|
|
318
|
+
runs: createRuns(["healthy", "healthy", "healthy"]),
|
|
319
|
+
thresholds,
|
|
320
|
+
}),
|
|
321
|
+
).toBe("healthy");
|
|
322
|
+
expect(
|
|
323
|
+
evaluateHealthStatus({
|
|
324
|
+
runs: createRuns(["unhealthy", "unhealthy", "unhealthy"]),
|
|
325
|
+
thresholds,
|
|
326
|
+
}),
|
|
327
|
+
).toBe("unhealthy");
|
|
328
|
+
// Worst-wins across the two slices then carries the check to unhealthy.
|
|
329
|
+
});
|
|
330
|
+
});
|
|
282
331
|
});
|
|
@@ -81,7 +81,12 @@ export function applySystemHealthOverrides({
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
// An override on an UNMEASURED system simply wins: there is no measured
|
|
85
|
+
// status to be worse than, and an incident is itself evidence of a problem.
|
|
86
|
+
const status =
|
|
87
|
+
base.status === "unknown"
|
|
88
|
+
? worst.status
|
|
89
|
+
: worstHealthStatus(base.status, worst.status);
|
|
85
90
|
const override: SystemHealthOverride = {
|
|
86
91
|
status: worst.status,
|
|
87
92
|
source: worst.source,
|