@checkstack/healthcheck-backend 0.0.2
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 +181 -0
- package/drizzle/0000_stormy_slayback.sql +33 -0
- package/drizzle/0001_thin_shotgun.sql +1 -0
- package/drizzle/0002_closed_lucky_pierre.sql +19 -0
- package/drizzle/0003_powerful_rage.sql +1 -0
- package/drizzle/0004_short_ezekiel.sql +1 -0
- package/drizzle/0005_glossy_longshot.sql +1 -0
- package/drizzle/meta/0000_snapshot.json +234 -0
- package/drizzle/meta/0001_snapshot.json +240 -0
- package/drizzle/meta/0002_snapshot.json +361 -0
- package/drizzle/meta/0003_snapshot.json +367 -0
- package/drizzle/meta/0004_snapshot.json +401 -0
- package/drizzle/meta/0005_snapshot.json +401 -0
- package/drizzle/meta/_journal.json +48 -0
- package/drizzle.config.ts +7 -0
- package/package.json +37 -0
- package/src/aggregation.test.ts +373 -0
- package/src/hooks.test.ts +16 -0
- package/src/hooks.ts +35 -0
- package/src/index.ts +195 -0
- package/src/queue-executor.test.ts +229 -0
- package/src/queue-executor.ts +569 -0
- package/src/retention-job.ts +404 -0
- package/src/router.test.ts +81 -0
- package/src/router.ts +157 -0
- package/src/schema.ts +153 -0
- package/src/service.ts +718 -0
- package/src/state-evaluator.test.ts +237 -0
- package/src/state-evaluator.ts +105 -0
- package/src/state-thresholds-migrations.ts +15 -0
- package/tsconfig.json +6 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "065ad01c-dad9-40ea-b099-1959e1e25e93",
|
|
3
|
+
"prevId": "2f783db3-de1c-4bff-8e7d-1408be721a0e",
|
|
4
|
+
"version": "7",
|
|
5
|
+
"dialect": "postgresql",
|
|
6
|
+
"tables": {
|
|
7
|
+
"public.health_check_aggregates": {
|
|
8
|
+
"name": "health_check_aggregates",
|
|
9
|
+
"schema": "",
|
|
10
|
+
"columns": {
|
|
11
|
+
"id": {
|
|
12
|
+
"name": "id",
|
|
13
|
+
"type": "uuid",
|
|
14
|
+
"primaryKey": true,
|
|
15
|
+
"notNull": true,
|
|
16
|
+
"default": "gen_random_uuid()"
|
|
17
|
+
},
|
|
18
|
+
"configuration_id": {
|
|
19
|
+
"name": "configuration_id",
|
|
20
|
+
"type": "uuid",
|
|
21
|
+
"primaryKey": false,
|
|
22
|
+
"notNull": true
|
|
23
|
+
},
|
|
24
|
+
"system_id": {
|
|
25
|
+
"name": "system_id",
|
|
26
|
+
"type": "text",
|
|
27
|
+
"primaryKey": false,
|
|
28
|
+
"notNull": true
|
|
29
|
+
},
|
|
30
|
+
"bucket_start": {
|
|
31
|
+
"name": "bucket_start",
|
|
32
|
+
"type": "timestamp",
|
|
33
|
+
"primaryKey": false,
|
|
34
|
+
"notNull": true
|
|
35
|
+
},
|
|
36
|
+
"bucket_size": {
|
|
37
|
+
"name": "bucket_size",
|
|
38
|
+
"type": "bucket_size",
|
|
39
|
+
"typeSchema": "public",
|
|
40
|
+
"primaryKey": false,
|
|
41
|
+
"notNull": true
|
|
42
|
+
},
|
|
43
|
+
"run_count": {
|
|
44
|
+
"name": "run_count",
|
|
45
|
+
"type": "integer",
|
|
46
|
+
"primaryKey": false,
|
|
47
|
+
"notNull": true
|
|
48
|
+
},
|
|
49
|
+
"healthy_count": {
|
|
50
|
+
"name": "healthy_count",
|
|
51
|
+
"type": "integer",
|
|
52
|
+
"primaryKey": false,
|
|
53
|
+
"notNull": true
|
|
54
|
+
},
|
|
55
|
+
"degraded_count": {
|
|
56
|
+
"name": "degraded_count",
|
|
57
|
+
"type": "integer",
|
|
58
|
+
"primaryKey": false,
|
|
59
|
+
"notNull": true
|
|
60
|
+
},
|
|
61
|
+
"unhealthy_count": {
|
|
62
|
+
"name": "unhealthy_count",
|
|
63
|
+
"type": "integer",
|
|
64
|
+
"primaryKey": false,
|
|
65
|
+
"notNull": true
|
|
66
|
+
},
|
|
67
|
+
"avg_latency_ms": {
|
|
68
|
+
"name": "avg_latency_ms",
|
|
69
|
+
"type": "integer",
|
|
70
|
+
"primaryKey": false,
|
|
71
|
+
"notNull": false
|
|
72
|
+
},
|
|
73
|
+
"min_latency_ms": {
|
|
74
|
+
"name": "min_latency_ms",
|
|
75
|
+
"type": "integer",
|
|
76
|
+
"primaryKey": false,
|
|
77
|
+
"notNull": false
|
|
78
|
+
},
|
|
79
|
+
"max_latency_ms": {
|
|
80
|
+
"name": "max_latency_ms",
|
|
81
|
+
"type": "integer",
|
|
82
|
+
"primaryKey": false,
|
|
83
|
+
"notNull": false
|
|
84
|
+
},
|
|
85
|
+
"p95_latency_ms": {
|
|
86
|
+
"name": "p95_latency_ms",
|
|
87
|
+
"type": "integer",
|
|
88
|
+
"primaryKey": false,
|
|
89
|
+
"notNull": false
|
|
90
|
+
},
|
|
91
|
+
"aggregated_metadata": {
|
|
92
|
+
"name": "aggregated_metadata",
|
|
93
|
+
"type": "jsonb",
|
|
94
|
+
"primaryKey": false,
|
|
95
|
+
"notNull": false
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"indexes": {
|
|
99
|
+
"health_check_aggregates_bucket_unique": {
|
|
100
|
+
"name": "health_check_aggregates_bucket_unique",
|
|
101
|
+
"columns": [
|
|
102
|
+
{
|
|
103
|
+
"expression": "configuration_id",
|
|
104
|
+
"isExpression": false,
|
|
105
|
+
"asc": true,
|
|
106
|
+
"nulls": "last"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"expression": "system_id",
|
|
110
|
+
"isExpression": false,
|
|
111
|
+
"asc": true,
|
|
112
|
+
"nulls": "last"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"expression": "bucket_start",
|
|
116
|
+
"isExpression": false,
|
|
117
|
+
"asc": true,
|
|
118
|
+
"nulls": "last"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"expression": "bucket_size",
|
|
122
|
+
"isExpression": false,
|
|
123
|
+
"asc": true,
|
|
124
|
+
"nulls": "last"
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"isUnique": true,
|
|
128
|
+
"concurrently": false,
|
|
129
|
+
"method": "btree",
|
|
130
|
+
"with": {}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"foreignKeys": {
|
|
134
|
+
"health_check_aggregates_configuration_id_health_check_configurations_id_fk": {
|
|
135
|
+
"name": "health_check_aggregates_configuration_id_health_check_configurations_id_fk",
|
|
136
|
+
"tableFrom": "health_check_aggregates",
|
|
137
|
+
"tableTo": "health_check_configurations",
|
|
138
|
+
"columnsFrom": [
|
|
139
|
+
"configuration_id"
|
|
140
|
+
],
|
|
141
|
+
"columnsTo": [
|
|
142
|
+
"id"
|
|
143
|
+
],
|
|
144
|
+
"onDelete": "cascade",
|
|
145
|
+
"onUpdate": "no action"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"compositePrimaryKeys": {},
|
|
149
|
+
"uniqueConstraints": {},
|
|
150
|
+
"policies": {},
|
|
151
|
+
"checkConstraints": {},
|
|
152
|
+
"isRLSEnabled": false
|
|
153
|
+
},
|
|
154
|
+
"public.health_check_configurations": {
|
|
155
|
+
"name": "health_check_configurations",
|
|
156
|
+
"schema": "",
|
|
157
|
+
"columns": {
|
|
158
|
+
"id": {
|
|
159
|
+
"name": "id",
|
|
160
|
+
"type": "uuid",
|
|
161
|
+
"primaryKey": true,
|
|
162
|
+
"notNull": true,
|
|
163
|
+
"default": "gen_random_uuid()"
|
|
164
|
+
},
|
|
165
|
+
"name": {
|
|
166
|
+
"name": "name",
|
|
167
|
+
"type": "text",
|
|
168
|
+
"primaryKey": false,
|
|
169
|
+
"notNull": true
|
|
170
|
+
},
|
|
171
|
+
"strategy_id": {
|
|
172
|
+
"name": "strategy_id",
|
|
173
|
+
"type": "text",
|
|
174
|
+
"primaryKey": false,
|
|
175
|
+
"notNull": true
|
|
176
|
+
},
|
|
177
|
+
"config": {
|
|
178
|
+
"name": "config",
|
|
179
|
+
"type": "jsonb",
|
|
180
|
+
"primaryKey": false,
|
|
181
|
+
"notNull": true
|
|
182
|
+
},
|
|
183
|
+
"interval_seconds": {
|
|
184
|
+
"name": "interval_seconds",
|
|
185
|
+
"type": "integer",
|
|
186
|
+
"primaryKey": false,
|
|
187
|
+
"notNull": true
|
|
188
|
+
},
|
|
189
|
+
"is_template": {
|
|
190
|
+
"name": "is_template",
|
|
191
|
+
"type": "boolean",
|
|
192
|
+
"primaryKey": false,
|
|
193
|
+
"notNull": false,
|
|
194
|
+
"default": false
|
|
195
|
+
},
|
|
196
|
+
"created_at": {
|
|
197
|
+
"name": "created_at",
|
|
198
|
+
"type": "timestamp",
|
|
199
|
+
"primaryKey": false,
|
|
200
|
+
"notNull": true,
|
|
201
|
+
"default": "now()"
|
|
202
|
+
},
|
|
203
|
+
"updated_at": {
|
|
204
|
+
"name": "updated_at",
|
|
205
|
+
"type": "timestamp",
|
|
206
|
+
"primaryKey": false,
|
|
207
|
+
"notNull": true,
|
|
208
|
+
"default": "now()"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"indexes": {},
|
|
212
|
+
"foreignKeys": {},
|
|
213
|
+
"compositePrimaryKeys": {},
|
|
214
|
+
"uniqueConstraints": {},
|
|
215
|
+
"policies": {},
|
|
216
|
+
"checkConstraints": {},
|
|
217
|
+
"isRLSEnabled": false
|
|
218
|
+
},
|
|
219
|
+
"public.health_check_runs": {
|
|
220
|
+
"name": "health_check_runs",
|
|
221
|
+
"schema": "",
|
|
222
|
+
"columns": {
|
|
223
|
+
"id": {
|
|
224
|
+
"name": "id",
|
|
225
|
+
"type": "uuid",
|
|
226
|
+
"primaryKey": true,
|
|
227
|
+
"notNull": true,
|
|
228
|
+
"default": "gen_random_uuid()"
|
|
229
|
+
},
|
|
230
|
+
"configuration_id": {
|
|
231
|
+
"name": "configuration_id",
|
|
232
|
+
"type": "uuid",
|
|
233
|
+
"primaryKey": false,
|
|
234
|
+
"notNull": true
|
|
235
|
+
},
|
|
236
|
+
"system_id": {
|
|
237
|
+
"name": "system_id",
|
|
238
|
+
"type": "text",
|
|
239
|
+
"primaryKey": false,
|
|
240
|
+
"notNull": true
|
|
241
|
+
},
|
|
242
|
+
"status": {
|
|
243
|
+
"name": "status",
|
|
244
|
+
"type": "health_check_status",
|
|
245
|
+
"typeSchema": "public",
|
|
246
|
+
"primaryKey": false,
|
|
247
|
+
"notNull": true
|
|
248
|
+
},
|
|
249
|
+
"latency_ms": {
|
|
250
|
+
"name": "latency_ms",
|
|
251
|
+
"type": "integer",
|
|
252
|
+
"primaryKey": false,
|
|
253
|
+
"notNull": false
|
|
254
|
+
},
|
|
255
|
+
"result": {
|
|
256
|
+
"name": "result",
|
|
257
|
+
"type": "jsonb",
|
|
258
|
+
"primaryKey": false,
|
|
259
|
+
"notNull": false
|
|
260
|
+
},
|
|
261
|
+
"timestamp": {
|
|
262
|
+
"name": "timestamp",
|
|
263
|
+
"type": "timestamp",
|
|
264
|
+
"primaryKey": false,
|
|
265
|
+
"notNull": true,
|
|
266
|
+
"default": "now()"
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
"indexes": {},
|
|
270
|
+
"foreignKeys": {
|
|
271
|
+
"health_check_runs_configuration_id_health_check_configurations_id_fk": {
|
|
272
|
+
"name": "health_check_runs_configuration_id_health_check_configurations_id_fk",
|
|
273
|
+
"tableFrom": "health_check_runs",
|
|
274
|
+
"tableTo": "health_check_configurations",
|
|
275
|
+
"columnsFrom": [
|
|
276
|
+
"configuration_id"
|
|
277
|
+
],
|
|
278
|
+
"columnsTo": [
|
|
279
|
+
"id"
|
|
280
|
+
],
|
|
281
|
+
"onDelete": "cascade",
|
|
282
|
+
"onUpdate": "no action"
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
"compositePrimaryKeys": {},
|
|
286
|
+
"uniqueConstraints": {},
|
|
287
|
+
"policies": {},
|
|
288
|
+
"checkConstraints": {},
|
|
289
|
+
"isRLSEnabled": false
|
|
290
|
+
},
|
|
291
|
+
"public.system_health_checks": {
|
|
292
|
+
"name": "system_health_checks",
|
|
293
|
+
"schema": "",
|
|
294
|
+
"columns": {
|
|
295
|
+
"system_id": {
|
|
296
|
+
"name": "system_id",
|
|
297
|
+
"type": "text",
|
|
298
|
+
"primaryKey": false,
|
|
299
|
+
"notNull": true
|
|
300
|
+
},
|
|
301
|
+
"configuration_id": {
|
|
302
|
+
"name": "configuration_id",
|
|
303
|
+
"type": "uuid",
|
|
304
|
+
"primaryKey": false,
|
|
305
|
+
"notNull": true
|
|
306
|
+
},
|
|
307
|
+
"enabled": {
|
|
308
|
+
"name": "enabled",
|
|
309
|
+
"type": "boolean",
|
|
310
|
+
"primaryKey": false,
|
|
311
|
+
"notNull": true,
|
|
312
|
+
"default": true
|
|
313
|
+
},
|
|
314
|
+
"state_thresholds": {
|
|
315
|
+
"name": "state_thresholds",
|
|
316
|
+
"type": "jsonb",
|
|
317
|
+
"primaryKey": false,
|
|
318
|
+
"notNull": false
|
|
319
|
+
},
|
|
320
|
+
"retention_config": {
|
|
321
|
+
"name": "retention_config",
|
|
322
|
+
"type": "jsonb",
|
|
323
|
+
"primaryKey": false,
|
|
324
|
+
"notNull": false
|
|
325
|
+
},
|
|
326
|
+
"created_at": {
|
|
327
|
+
"name": "created_at",
|
|
328
|
+
"type": "timestamp",
|
|
329
|
+
"primaryKey": false,
|
|
330
|
+
"notNull": true,
|
|
331
|
+
"default": "now()"
|
|
332
|
+
},
|
|
333
|
+
"updated_at": {
|
|
334
|
+
"name": "updated_at",
|
|
335
|
+
"type": "timestamp",
|
|
336
|
+
"primaryKey": false,
|
|
337
|
+
"notNull": true,
|
|
338
|
+
"default": "now()"
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
"indexes": {},
|
|
342
|
+
"foreignKeys": {
|
|
343
|
+
"system_health_checks_configuration_id_health_check_configurations_id_fk": {
|
|
344
|
+
"name": "system_health_checks_configuration_id_health_check_configurations_id_fk",
|
|
345
|
+
"tableFrom": "system_health_checks",
|
|
346
|
+
"tableTo": "health_check_configurations",
|
|
347
|
+
"columnsFrom": [
|
|
348
|
+
"configuration_id"
|
|
349
|
+
],
|
|
350
|
+
"columnsTo": [
|
|
351
|
+
"id"
|
|
352
|
+
],
|
|
353
|
+
"onDelete": "cascade",
|
|
354
|
+
"onUpdate": "no action"
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
"compositePrimaryKeys": {
|
|
358
|
+
"system_health_checks_system_id_configuration_id_pk": {
|
|
359
|
+
"name": "system_health_checks_system_id_configuration_id_pk",
|
|
360
|
+
"columns": [
|
|
361
|
+
"system_id",
|
|
362
|
+
"configuration_id"
|
|
363
|
+
]
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
"uniqueConstraints": {},
|
|
367
|
+
"policies": {},
|
|
368
|
+
"checkConstraints": {},
|
|
369
|
+
"isRLSEnabled": false
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
"enums": {
|
|
373
|
+
"public.bucket_size": {
|
|
374
|
+
"name": "bucket_size",
|
|
375
|
+
"schema": "public",
|
|
376
|
+
"values": [
|
|
377
|
+
"hourly",
|
|
378
|
+
"daily"
|
|
379
|
+
]
|
|
380
|
+
},
|
|
381
|
+
"public.health_check_status": {
|
|
382
|
+
"name": "health_check_status",
|
|
383
|
+
"schema": "public",
|
|
384
|
+
"values": [
|
|
385
|
+
"healthy",
|
|
386
|
+
"unhealthy",
|
|
387
|
+
"degraded"
|
|
388
|
+
]
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
"schemas": {},
|
|
392
|
+
"sequences": {},
|
|
393
|
+
"roles": {},
|
|
394
|
+
"policies": {},
|
|
395
|
+
"views": {},
|
|
396
|
+
"_meta": {
|
|
397
|
+
"columns": {},
|
|
398
|
+
"schemas": {},
|
|
399
|
+
"tables": {}
|
|
400
|
+
}
|
|
401
|
+
}
|