@checkstack/healthcheck-common 0.10.1 → 0.12.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 +72 -0
- package/package.json +3 -3
- package/src/routes.ts +1 -0
- package/src/rpc-contract.ts +97 -0
- package/src/schemas.ts +31 -0
- package/src/zod-health-result.test.ts +4 -4
- package/src/zod-health-result.ts +15 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,77 @@
|
|
|
1
1
|
# @checkstack/healthcheck-common
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8d1ef12: ## Downstream consumer bumps for the anomaly detection + cache system rollout
|
|
8
|
+
|
|
9
|
+
Packages on this branch were updated as part of the anomaly detection feature (schema annotations on result fields, plugin metadata for the modular cache system) but were not listed in the upstream changesets.
|
|
10
|
+
|
|
11
|
+
- **`@checkstack/healthcheck-common`** (minor) — new RPC contract additions and schema changes supporting per-field anomaly metadata.
|
|
12
|
+
- **`@checkstack/cache-memory-common`** (minor) — new package providing access rules + plugin metadata for the in-memory cache backend.
|
|
13
|
+
- **healthcheck plugins** (patch) — adopt the new `x-anomaly-*` schema annotations on their result fields so anomaly detection works automatically against their checks. No public API changes.
|
|
14
|
+
- **integration / notification / auth / queue / collector plugins** (patch) — minor internal updates as consumers of upstream API changes (cache plugin registry, schema additions). No public API changes.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [8d1ef12]
|
|
19
|
+
- @checkstack/common@0.7.0
|
|
20
|
+
- @checkstack/signal-common@0.1.10
|
|
21
|
+
|
|
22
|
+
## 0.11.0
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- 26d8bae: Distributed satellite health checks and Assignment IDE page
|
|
27
|
+
|
|
28
|
+
**Satellite System**
|
|
29
|
+
|
|
30
|
+
- New `satellite-backend`, `satellite-common`, `satellite-frontend`, and `satellite` agent packages for distributed health check execution
|
|
31
|
+
- WebSocket-based satellite connectivity with authentication, heartbeats, and live configuration push
|
|
32
|
+
- Satellite management UI with create dialog, status badges, and list page
|
|
33
|
+
|
|
34
|
+
**Live Configuration Updates**
|
|
35
|
+
|
|
36
|
+
- Added `assignmentChanged` hook to `healthcheck-backend` for cross-plugin communication
|
|
37
|
+
- `satellite-backend` subscribes to assignment changes and pushes config updates to connected satellites in real-time
|
|
38
|
+
|
|
39
|
+
**Assignment IDE Page**
|
|
40
|
+
|
|
41
|
+
- Replaced the 1028-line modal-based `SystemHealthCheckAssignment` component with a full-page IDE layout
|
|
42
|
+
- New modular components: `AssignmentTree`, `GeneralPanel`, `ThresholdsPanel`, `RetentionPanel`, `ExecutionPanel`
|
|
43
|
+
- Added unassign capability and sorted assignment lists for stable ordering
|
|
44
|
+
|
|
45
|
+
**Shared IDE Primitives**
|
|
46
|
+
|
|
47
|
+
- Extracted `IDETreeNode`, `IDETreeSection`, `IDEStatusBar`, `IDELayout` to `@checkstack/ui` for cross-plugin reuse
|
|
48
|
+
- Migrated existing health check IDE editor to use shared primitives
|
|
49
|
+
|
|
50
|
+
**Infrastructure**
|
|
51
|
+
|
|
52
|
+
- Added `Dockerfile.satellite` for containerized satellite deployment
|
|
53
|
+
- WebSocket route registry in `@checkstack/backend` and `@checkstack/backend-api`
|
|
54
|
+
|
|
55
|
+
- 26d8bae: Source attribution and filtering for satellite health checks
|
|
56
|
+
|
|
57
|
+
**Source Attribution**
|
|
58
|
+
|
|
59
|
+
- Fixed satellite result attribution: runs from satellites now correctly display their source instead of defaulting to "Local"
|
|
60
|
+
- Added `sourceId` and `sourceLabel` to both public and detailed history API responses
|
|
61
|
+
|
|
62
|
+
**Source Filtering**
|
|
63
|
+
|
|
64
|
+
- Added `sourceFilter` parameter to `getHistory`, `getDetailedHistory`, and `getDetailedAggregatedHistory` RPC endpoints
|
|
65
|
+
- Source filter supports "local" (core-only), specific satellite UUID, or all sources
|
|
66
|
+
- Filter applies to all three aggregation tiers (raw, hourly, daily)
|
|
67
|
+
|
|
68
|
+
**Frontend**
|
|
69
|
+
|
|
70
|
+
- System detail accordion shows source filter buttons (All / Local / per-satellite) next to date range filter
|
|
71
|
+
- Filter applies to both charts and recent runs table
|
|
72
|
+
- Source column added to the recent runs table with Local/Remote badges
|
|
73
|
+
- Health check history detail page includes per-satellite source filter buttons
|
|
74
|
+
|
|
3
75
|
## 0.10.1
|
|
4
76
|
|
|
5
77
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/healthcheck-common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
}
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@checkstack/common": "0.6.
|
|
12
|
-
"@checkstack/signal-common": "0.1.
|
|
11
|
+
"@checkstack/common": "0.6.5",
|
|
12
|
+
"@checkstack/signal-common": "0.1.9",
|
|
13
13
|
"zod": "^4.2.1"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
package/src/routes.ts
CHANGED
|
@@ -7,6 +7,7 @@ export const healthcheckRoutes = createRoutes("healthcheck", {
|
|
|
7
7
|
config: "/config",
|
|
8
8
|
create: "/config/create",
|
|
9
9
|
edit: "/config/:configId/edit",
|
|
10
|
+
assignments: "/assignments/:systemId",
|
|
10
11
|
history: "/history",
|
|
11
12
|
historyDetail: "/history/:systemId/:configurationId",
|
|
12
13
|
historyRun: "/history/:systemId/:configurationId/:runId",
|
package/src/rpc-contract.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
HealthCheckRunSchema,
|
|
13
13
|
HealthCheckRunPublicSchema,
|
|
14
14
|
HealthCheckStatusSchema,
|
|
15
|
+
HealthCheckRunResultSchema,
|
|
15
16
|
StateThresholdsSchema,
|
|
16
17
|
RetentionConfigSchema,
|
|
17
18
|
AggregatedBucketBaseSchema,
|
|
@@ -148,6 +149,10 @@ export const healthCheckContract = {
|
|
|
148
149
|
configurationName: z.string(),
|
|
149
150
|
enabled: z.boolean(),
|
|
150
151
|
stateThresholds: StateThresholdsSchema.optional(),
|
|
152
|
+
/** IDs of satellites assigned to execute this health check */
|
|
153
|
+
satelliteIds: z.array(z.string()).optional(),
|
|
154
|
+
/** Whether to also run this check locally on the core (default: true) */
|
|
155
|
+
includeLocal: z.boolean(),
|
|
151
156
|
}),
|
|
152
157
|
),
|
|
153
158
|
),
|
|
@@ -228,6 +233,8 @@ export const healthCheckContract = {
|
|
|
228
233
|
configurationId: z.string().optional(),
|
|
229
234
|
startDate: z.date().optional(),
|
|
230
235
|
endDate: z.date().optional(),
|
|
236
|
+
/** Filter by source: "local" = core only, satellite UUID = specific satellite, undefined = all */
|
|
237
|
+
sourceFilter: z.string().optional(),
|
|
231
238
|
limit: z.number().optional().default(10),
|
|
232
239
|
offset: z.number().optional().default(0),
|
|
233
240
|
sortOrder: z.enum(["asc", "desc"]),
|
|
@@ -251,6 +258,8 @@ export const healthCheckContract = {
|
|
|
251
258
|
configurationId: z.string().optional(),
|
|
252
259
|
startDate: z.date().optional(),
|
|
253
260
|
endDate: z.date().optional(),
|
|
261
|
+
/** Filter by source: "local" = core only, satellite UUID = specific satellite, undefined = all */
|
|
262
|
+
sourceFilter: z.string().optional(),
|
|
254
263
|
limit: z.number().optional().default(10),
|
|
255
264
|
offset: z.number().optional().default(0),
|
|
256
265
|
sortOrder: z.enum(["asc", "desc"]),
|
|
@@ -309,6 +318,8 @@ export const healthCheckContract = {
|
|
|
309
318
|
configurationId: z.string(),
|
|
310
319
|
startDate: z.date(),
|
|
311
320
|
endDate: z.date(),
|
|
321
|
+
/** Filter by source: "local" = core only, satellite UUID = specific satellite, undefined = all */
|
|
322
|
+
sourceFilter: z.string().optional(),
|
|
312
323
|
/** Target number of data points (default: 500). Bucket interval is calculated as (endDate - startDate) / targetPoints */
|
|
313
324
|
targetPoints: z.number().min(10).max(2000).default(500),
|
|
314
325
|
}),
|
|
@@ -371,6 +382,92 @@ export const healthCheckContract = {
|
|
|
371
382
|
),
|
|
372
383
|
}),
|
|
373
384
|
),
|
|
385
|
+
|
|
386
|
+
// ==========================================================================
|
|
387
|
+
// SERVICE INTERFACE (userType: "service" — backend-to-backend only)
|
|
388
|
+
// Used by satellite-backend to fetch assignments and submit results.
|
|
389
|
+
// ==========================================================================
|
|
390
|
+
|
|
391
|
+
getAssignmentsForSatellite: proc({
|
|
392
|
+
operationType: "query",
|
|
393
|
+
userType: "service",
|
|
394
|
+
access: [],
|
|
395
|
+
})
|
|
396
|
+
.input(z.object({ satelliteId: z.string() }))
|
|
397
|
+
.output(
|
|
398
|
+
z.array(
|
|
399
|
+
z.object({
|
|
400
|
+
configId: z.string(),
|
|
401
|
+
systemId: z.string(),
|
|
402
|
+
strategyId: z.string(),
|
|
403
|
+
config: z.record(z.string(), z.unknown()),
|
|
404
|
+
collectors: z
|
|
405
|
+
.array(
|
|
406
|
+
z.object({
|
|
407
|
+
id: z.string(),
|
|
408
|
+
collectorId: z.string(),
|
|
409
|
+
config: z.record(z.string(), z.unknown()),
|
|
410
|
+
assertions: z
|
|
411
|
+
.array(
|
|
412
|
+
z.object({
|
|
413
|
+
field: z.string(),
|
|
414
|
+
jsonPath: z.string().optional(),
|
|
415
|
+
operator: z.string(),
|
|
416
|
+
value: z.unknown().optional(),
|
|
417
|
+
}),
|
|
418
|
+
)
|
|
419
|
+
.optional(),
|
|
420
|
+
}),
|
|
421
|
+
)
|
|
422
|
+
.optional(),
|
|
423
|
+
intervalSeconds: z.number(),
|
|
424
|
+
}),
|
|
425
|
+
),
|
|
426
|
+
),
|
|
427
|
+
|
|
428
|
+
ingestSatelliteResult: proc({
|
|
429
|
+
operationType: "mutation",
|
|
430
|
+
userType: "service",
|
|
431
|
+
access: [],
|
|
432
|
+
})
|
|
433
|
+
.input(
|
|
434
|
+
z.object({
|
|
435
|
+
configId: z.string(),
|
|
436
|
+
systemId: z.string(),
|
|
437
|
+
status: HealthCheckStatusSchema,
|
|
438
|
+
latencyMs: z.number().optional(),
|
|
439
|
+
result: HealthCheckRunResultSchema.optional(),
|
|
440
|
+
executedAt: z.string(),
|
|
441
|
+
sourceId: z.string(),
|
|
442
|
+
sourceLabel: z.string(),
|
|
443
|
+
}),
|
|
444
|
+
)
|
|
445
|
+
.output(z.void()),
|
|
446
|
+
|
|
447
|
+
getRunsForAnalysis: proc({
|
|
448
|
+
operationType: "query",
|
|
449
|
+
userType: "service",
|
|
450
|
+
access: [],
|
|
451
|
+
})
|
|
452
|
+
.input(
|
|
453
|
+
z.object({
|
|
454
|
+
startDate: z.date(),
|
|
455
|
+
limitPerAssignment: z.number().optional().default(200),
|
|
456
|
+
}),
|
|
457
|
+
)
|
|
458
|
+
.output(
|
|
459
|
+
z.array(
|
|
460
|
+
z.object({
|
|
461
|
+
systemId: z.string(),
|
|
462
|
+
configurationId: z.string(),
|
|
463
|
+
runs: z.array(
|
|
464
|
+
z.object({
|
|
465
|
+
result: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
466
|
+
}),
|
|
467
|
+
),
|
|
468
|
+
}),
|
|
469
|
+
),
|
|
470
|
+
),
|
|
374
471
|
};
|
|
375
472
|
// Export contract type
|
|
376
473
|
export type HealthCheckContract = typeof healthCheckContract;
|
package/src/schemas.ts
CHANGED
|
@@ -124,6 +124,25 @@ export const HealthCheckStatusSchema = z.enum([
|
|
|
124
124
|
|
|
125
125
|
export type HealthCheckStatus = z.infer<typeof HealthCheckStatusSchema>;
|
|
126
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Canonical shape for a single health check run result.
|
|
129
|
+
* Both the local queue-executor and satellite agent MUST produce this shape
|
|
130
|
+
* to ensure the frontend (auto-charts, history detail) renders correctly.
|
|
131
|
+
*/
|
|
132
|
+
export const HealthCheckRunResultSchema = z.object({
|
|
133
|
+
status: HealthCheckStatusSchema,
|
|
134
|
+
latencyMs: z.number(),
|
|
135
|
+
message: z.string().optional(),
|
|
136
|
+
metadata: z.object({
|
|
137
|
+
connected: z.boolean(),
|
|
138
|
+
connectionTimeMs: z.number().optional(),
|
|
139
|
+
collectors: z.record(z.string(), z.unknown()).optional(),
|
|
140
|
+
error: z.string().optional(),
|
|
141
|
+
}),
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
export type HealthCheckRunResult = z.infer<typeof HealthCheckRunResultSchema>;
|
|
145
|
+
|
|
127
146
|
// --- State Threshold Schemas ---
|
|
128
147
|
|
|
129
148
|
/**
|
|
@@ -192,6 +211,10 @@ export const AssociateHealthCheckSchema = z.object({
|
|
|
192
211
|
configurationId: z.string().uuid(),
|
|
193
212
|
enabled: z.boolean().default(true),
|
|
194
213
|
stateThresholds: StateThresholdsSchema.optional(),
|
|
214
|
+
/** IDs of satellites assigned to execute this health check */
|
|
215
|
+
satelliteIds: z.array(z.string()).optional(),
|
|
216
|
+
/** Whether to also run this check locally on the core instance (default: true) */
|
|
217
|
+
includeLocal: z.boolean().default(true),
|
|
195
218
|
});
|
|
196
219
|
|
|
197
220
|
export type AssociateHealthCheck = z.infer<typeof AssociateHealthCheckSchema>;
|
|
@@ -210,6 +233,10 @@ export const HealthCheckRunSchema = z.object({
|
|
|
210
233
|
result: z.record(z.string(), z.unknown()),
|
|
211
234
|
timestamp: z.date(),
|
|
212
235
|
latencyMs: z.number().optional(),
|
|
236
|
+
/** Source ID for result attribution (null = local core, UUID = satellite) */
|
|
237
|
+
sourceId: z.string().optional(),
|
|
238
|
+
/** Human-readable source label (e.g. "Local" or "EU West (eu-west-1)") */
|
|
239
|
+
sourceLabel: z.string().optional(),
|
|
213
240
|
});
|
|
214
241
|
|
|
215
242
|
export type HealthCheckRun = z.infer<typeof HealthCheckRunSchema>;
|
|
@@ -246,6 +273,10 @@ export const HealthCheckRunPublicSchema = z.object({
|
|
|
246
273
|
status: HealthCheckStatusSchema,
|
|
247
274
|
timestamp: z.date(),
|
|
248
275
|
latencyMs: z.number().optional(),
|
|
276
|
+
/** Source ID for result attribution (null = local core, UUID = satellite) */
|
|
277
|
+
sourceId: z.string().optional(),
|
|
278
|
+
/** Human-readable source label (e.g. "Local" or "EU West (eu-west-1)") */
|
|
279
|
+
sourceLabel: z.string().optional(),
|
|
249
280
|
});
|
|
250
281
|
|
|
251
282
|
export type HealthCheckRunPublic = z.infer<typeof HealthCheckRunPublicSchema>;
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
describe("stripEphemeralFields", () => {
|
|
13
13
|
it("should strip fields marked with x-ephemeral", () => {
|
|
14
14
|
const schema = healthResultSchema({
|
|
15
|
-
statusCode: healthResultNumber({ "x-chart-type": "counter" }),
|
|
15
|
+
statusCode: healthResultNumber({ "x-chart-type": "counter", "x-anomaly-enabled": false }),
|
|
16
16
|
body: healthResultJSONPath({ "x-ephemeral": true }), // Explicitly marked ephemeral
|
|
17
17
|
});
|
|
18
18
|
|
|
@@ -29,8 +29,8 @@ describe("stripEphemeralFields", () => {
|
|
|
29
29
|
|
|
30
30
|
it("should preserve non-ephemeral fields", () => {
|
|
31
31
|
const schema = healthResultSchema({
|
|
32
|
-
responseTimeMs: healthResultNumber({ "x-chart-type": "line" }),
|
|
33
|
-
statusText: healthResultString({ "x-chart-type": "text" }),
|
|
32
|
+
responseTimeMs: healthResultNumber({ "x-chart-type": "line", "x-anomaly-enabled": false }),
|
|
33
|
+
statusText: healthResultString({ "x-chart-type": "text", "x-anomaly-enabled": false }),
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
const result = {
|
|
@@ -45,7 +45,7 @@ describe("stripEphemeralFields", () => {
|
|
|
45
45
|
|
|
46
46
|
it("should preserve unknown fields like _collectorId", () => {
|
|
47
47
|
const schema = healthResultSchema({
|
|
48
|
-
value: healthResultNumber({ "x-chart-type": "counter" }),
|
|
48
|
+
value: healthResultNumber({ "x-chart-type": "counter", "x-anomaly-enabled": false }),
|
|
49
49
|
body: healthResultJSONPath({ "x-ephemeral": true }),
|
|
50
50
|
});
|
|
51
51
|
|
package/src/zod-health-result.ts
CHANGED
|
@@ -96,7 +96,8 @@ export function healthResultSchema<T extends HealthResultShape>(
|
|
|
96
96
|
// ============================================================================
|
|
97
97
|
|
|
98
98
|
/** Chart metadata (excludes x-jsonpath, use healthResultJSONPath for that) */
|
|
99
|
-
type
|
|
99
|
+
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
100
|
+
type ChartMeta = DistributiveOmit<HealthResultMeta, "x-jsonpath">;
|
|
100
101
|
|
|
101
102
|
/**
|
|
102
103
|
* Create a health result string field with typed chart metadata.
|
|
@@ -114,7 +115,8 @@ export function healthResultString(
|
|
|
114
115
|
meta: ChartMeta,
|
|
115
116
|
): HealthResultField<z.ZodString> {
|
|
116
117
|
const schema = z.string();
|
|
117
|
-
|
|
118
|
+
const finalMeta = (meta["x-ephemeral"] ? { ...meta, "x-anomaly-enabled": false as const } : meta) as HealthResultMeta;
|
|
119
|
+
schema.register(healthResultRegistry, finalMeta);
|
|
118
120
|
return schema as HealthResultField<z.ZodString>;
|
|
119
121
|
}
|
|
120
122
|
|
|
@@ -125,7 +127,8 @@ export function healthResultNumber(
|
|
|
125
127
|
meta: ChartMeta,
|
|
126
128
|
): HealthResultField<z.ZodNumber> {
|
|
127
129
|
const schema = z.number();
|
|
128
|
-
|
|
130
|
+
const finalMeta = (meta["x-ephemeral"] ? { ...meta, "x-anomaly-enabled": false as const } : meta) as HealthResultMeta;
|
|
131
|
+
schema.register(healthResultRegistry, finalMeta);
|
|
129
132
|
return schema as HealthResultField<z.ZodNumber>;
|
|
130
133
|
}
|
|
131
134
|
|
|
@@ -136,7 +139,8 @@ export function healthResultBoolean(
|
|
|
136
139
|
meta: ChartMeta,
|
|
137
140
|
): HealthResultField<z.ZodBoolean> {
|
|
138
141
|
const schema = z.boolean();
|
|
139
|
-
|
|
142
|
+
const finalMeta = (meta["x-ephemeral"] ? { ...meta, "x-anomaly-enabled": false as const } : meta) as HealthResultMeta;
|
|
143
|
+
schema.register(healthResultRegistry, finalMeta);
|
|
140
144
|
return schema as HealthResultField<z.ZodBoolean>;
|
|
141
145
|
}
|
|
142
146
|
|
|
@@ -155,7 +159,8 @@ export function healthResultArray(
|
|
|
155
159
|
meta: ChartMeta,
|
|
156
160
|
): HealthResultField<z.ZodArray<z.ZodString>> {
|
|
157
161
|
const schema = z.array(z.string());
|
|
158
|
-
|
|
162
|
+
const finalMeta = (meta["x-ephemeral"] ? { ...meta, "x-anomaly-enabled": false as const } : meta) as HealthResultMeta;
|
|
163
|
+
schema.register(healthResultRegistry, finalMeta);
|
|
159
164
|
return schema as HealthResultField<z.ZodArray<z.ZodString>>;
|
|
160
165
|
}
|
|
161
166
|
|
|
@@ -176,7 +181,11 @@ export function healthResultJSONPath(
|
|
|
176
181
|
meta: ChartMeta,
|
|
177
182
|
): HealthResultField<z.ZodString> {
|
|
178
183
|
const schema = z.string();
|
|
179
|
-
schema.register(healthResultRegistry, {
|
|
184
|
+
schema.register(healthResultRegistry, {
|
|
185
|
+
...meta,
|
|
186
|
+
"x-jsonpath": true,
|
|
187
|
+
"x-anomaly-enabled": false as const // Always disable anomaly detection for raw body payloads
|
|
188
|
+
} as HealthResultMeta);
|
|
180
189
|
return schema as HealthResultField<z.ZodString>;
|
|
181
190
|
}
|
|
182
191
|
|