@checkstack/slo-backend 0.2.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 ADDED
@@ -0,0 +1,41 @@
1
+ # @checkstack/slo-backend
2
+
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3c34b07: Complete SLO Reliability Engine frontend and backend
8
+
9
+ **Frontend** — 7 new visualization components:
10
+
11
+ - `StreakCounter`: Fire-themed compliance streak counter with color-coded flame and best-streak trophy
12
+ - `AchievementBadge`: Emoji-labeled badges for 9 achievement types with hover tooltip
13
+ - `AttributionChart`: Horizontal stacked bar showing error budget split (self/upstream/remaining)
14
+ - `DowntimeTimeline`: Dot-and-line timeline with attribution badges and timestamps
15
+ - `SloTrendChart`: Pure SVG availability trend line chart from daily snapshots
16
+ - `MilestoneFeed`: Organization-wide milestone feed on the SLO overview sidebar
17
+ - `DependencyExclusionConfig`: Interactive upstream dependency picker for SLO editor
18
+
19
+ **Backend** — Weekly digest scheduled integration event:
20
+
21
+ - `weekly-digest.ts`: Cron job (Monday 09:00 UTC) emitting SLO performance summary
22
+ - Top/worst performers, breach counts, and streak data delivered via configured notification channels
23
+ - New `sloWeeklyDigest` hook registered as integration event
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies [d1a2796]
28
+ - Updated dependencies [3c34b07]
29
+ - @checkstack/common@0.6.5
30
+ - @checkstack/backend-api@0.11.1
31
+ - @checkstack/catalog-backend@0.2.23
32
+ - @checkstack/healthcheck-backend@0.12.1
33
+ - @checkstack/integration-backend@0.1.18
34
+ - @checkstack/slo-common@0.2.0
35
+ - @checkstack/catalog-common@1.3.1
36
+ - @checkstack/healthcheck-common@0.10.1
37
+ - @checkstack/command-backend@0.1.18
38
+ - @checkstack/dependency-common@0.2.1
39
+ - @checkstack/integration-common@0.2.8
40
+ - @checkstack/signal-common@0.1.9
41
+ - @checkstack/queue-api@0.2.12
@@ -0,0 +1,57 @@
1
+ CREATE TABLE "slo_achievements" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "system_id" text NOT NULL,
4
+ "achievement" text NOT NULL,
5
+ "unlocked_at" timestamp DEFAULT now() NOT NULL
6
+ );
7
+ --> statement-breakpoint
8
+ CREATE TABLE "slo_daily_snapshots" (
9
+ "id" text PRIMARY KEY NOT NULL,
10
+ "objective_id" text NOT NULL,
11
+ "date" timestamp NOT NULL,
12
+ "availability_percent" double precision NOT NULL,
13
+ "budget_consumed_minutes" double precision NOT NULL,
14
+ "budget_remaining_percent" double precision NOT NULL,
15
+ "burn_rate" double precision,
16
+ "streak_days" integer DEFAULT 0 NOT NULL
17
+ );
18
+ --> statement-breakpoint
19
+ CREATE TABLE "slo_downtime_events" (
20
+ "id" text PRIMARY KEY NOT NULL,
21
+ "objective_id" text NOT NULL,
22
+ "system_id" text NOT NULL,
23
+ "start_time" timestamp NOT NULL,
24
+ "end_time" timestamp,
25
+ "duration_seconds" double precision,
26
+ "attribution_type" text NOT NULL,
27
+ "upstream_system_id" text,
28
+ "upstream_system_name" text
29
+ );
30
+ --> statement-breakpoint
31
+ CREATE TABLE "slo_objectives" (
32
+ "id" text PRIMARY KEY NOT NULL,
33
+ "system_id" text NOT NULL,
34
+ "health_check_configuration_id" text,
35
+ "target" double precision NOT NULL,
36
+ "window_days" integer NOT NULL,
37
+ "dependency_exclusion" text DEFAULT 'strict' NOT NULL,
38
+ "excluded_dependency_ids" json,
39
+ "burn_rate_warning_percent" double precision DEFAULT 50 NOT NULL,
40
+ "burn_rate_critical_percent" double precision DEFAULT 80 NOT NULL,
41
+ "burn_rate_fast_burn_multiplier" double precision DEFAULT 5 NOT NULL,
42
+ "created_at" timestamp DEFAULT now() NOT NULL,
43
+ "updated_at" timestamp DEFAULT now() NOT NULL
44
+ );
45
+ --> statement-breakpoint
46
+ CREATE TABLE "slo_streaks" (
47
+ "objective_id" text PRIMARY KEY NOT NULL,
48
+ "system_id" text NOT NULL,
49
+ "current_streak" integer DEFAULT 0 NOT NULL,
50
+ "best_streak" integer DEFAULT 0 NOT NULL,
51
+ "streak_start" timestamp,
52
+ "best_streak_end" timestamp
53
+ );
54
+ --> statement-breakpoint
55
+ ALTER TABLE "slo_daily_snapshots" ADD CONSTRAINT "slo_daily_snapshots_objective_id_slo_objectives_id_fk" FOREIGN KEY ("objective_id") REFERENCES "slo_objectives"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
56
+ ALTER TABLE "slo_downtime_events" ADD CONSTRAINT "slo_downtime_events_objective_id_slo_objectives_id_fk" FOREIGN KEY ("objective_id") REFERENCES "slo_objectives"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
57
+ ALTER TABLE "slo_streaks" ADD CONSTRAINT "slo_streaks_objective_id_slo_objectives_id_fk" FOREIGN KEY ("objective_id") REFERENCES "slo_objectives"("id") ON DELETE cascade ON UPDATE no action;
@@ -0,0 +1,370 @@
1
+ {
2
+ "id": "dd026a71-5006-4d09-85b1-ba5b892fce3f",
3
+ "prevId": "00000000-0000-0000-0000-000000000000",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.slo_achievements": {
8
+ "name": "slo_achievements",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "system_id": {
18
+ "name": "system_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "achievement": {
24
+ "name": "achievement",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "unlocked_at": {
30
+ "name": "unlocked_at",
31
+ "type": "timestamp",
32
+ "primaryKey": false,
33
+ "notNull": true,
34
+ "default": "now()"
35
+ }
36
+ },
37
+ "indexes": {},
38
+ "foreignKeys": {},
39
+ "compositePrimaryKeys": {},
40
+ "uniqueConstraints": {},
41
+ "policies": {},
42
+ "checkConstraints": {},
43
+ "isRLSEnabled": false
44
+ },
45
+ "public.slo_daily_snapshots": {
46
+ "name": "slo_daily_snapshots",
47
+ "schema": "",
48
+ "columns": {
49
+ "id": {
50
+ "name": "id",
51
+ "type": "text",
52
+ "primaryKey": true,
53
+ "notNull": true
54
+ },
55
+ "objective_id": {
56
+ "name": "objective_id",
57
+ "type": "text",
58
+ "primaryKey": false,
59
+ "notNull": true
60
+ },
61
+ "date": {
62
+ "name": "date",
63
+ "type": "timestamp",
64
+ "primaryKey": false,
65
+ "notNull": true
66
+ },
67
+ "availability_percent": {
68
+ "name": "availability_percent",
69
+ "type": "double precision",
70
+ "primaryKey": false,
71
+ "notNull": true
72
+ },
73
+ "budget_consumed_minutes": {
74
+ "name": "budget_consumed_minutes",
75
+ "type": "double precision",
76
+ "primaryKey": false,
77
+ "notNull": true
78
+ },
79
+ "budget_remaining_percent": {
80
+ "name": "budget_remaining_percent",
81
+ "type": "double precision",
82
+ "primaryKey": false,
83
+ "notNull": true
84
+ },
85
+ "burn_rate": {
86
+ "name": "burn_rate",
87
+ "type": "double precision",
88
+ "primaryKey": false,
89
+ "notNull": false
90
+ },
91
+ "streak_days": {
92
+ "name": "streak_days",
93
+ "type": "integer",
94
+ "primaryKey": false,
95
+ "notNull": true,
96
+ "default": 0
97
+ }
98
+ },
99
+ "indexes": {},
100
+ "foreignKeys": {
101
+ "slo_daily_snapshots_objective_id_slo_objectives_id_fk": {
102
+ "name": "slo_daily_snapshots_objective_id_slo_objectives_id_fk",
103
+ "tableFrom": "slo_daily_snapshots",
104
+ "tableTo": "slo_objectives",
105
+ "columnsFrom": [
106
+ "objective_id"
107
+ ],
108
+ "columnsTo": [
109
+ "id"
110
+ ],
111
+ "onDelete": "cascade",
112
+ "onUpdate": "no action"
113
+ }
114
+ },
115
+ "compositePrimaryKeys": {},
116
+ "uniqueConstraints": {},
117
+ "policies": {},
118
+ "checkConstraints": {},
119
+ "isRLSEnabled": false
120
+ },
121
+ "public.slo_downtime_events": {
122
+ "name": "slo_downtime_events",
123
+ "schema": "",
124
+ "columns": {
125
+ "id": {
126
+ "name": "id",
127
+ "type": "text",
128
+ "primaryKey": true,
129
+ "notNull": true
130
+ },
131
+ "objective_id": {
132
+ "name": "objective_id",
133
+ "type": "text",
134
+ "primaryKey": false,
135
+ "notNull": true
136
+ },
137
+ "system_id": {
138
+ "name": "system_id",
139
+ "type": "text",
140
+ "primaryKey": false,
141
+ "notNull": true
142
+ },
143
+ "start_time": {
144
+ "name": "start_time",
145
+ "type": "timestamp",
146
+ "primaryKey": false,
147
+ "notNull": true
148
+ },
149
+ "end_time": {
150
+ "name": "end_time",
151
+ "type": "timestamp",
152
+ "primaryKey": false,
153
+ "notNull": false
154
+ },
155
+ "duration_seconds": {
156
+ "name": "duration_seconds",
157
+ "type": "double precision",
158
+ "primaryKey": false,
159
+ "notNull": false
160
+ },
161
+ "attribution_type": {
162
+ "name": "attribution_type",
163
+ "type": "text",
164
+ "primaryKey": false,
165
+ "notNull": true
166
+ },
167
+ "upstream_system_id": {
168
+ "name": "upstream_system_id",
169
+ "type": "text",
170
+ "primaryKey": false,
171
+ "notNull": false
172
+ },
173
+ "upstream_system_name": {
174
+ "name": "upstream_system_name",
175
+ "type": "text",
176
+ "primaryKey": false,
177
+ "notNull": false
178
+ }
179
+ },
180
+ "indexes": {},
181
+ "foreignKeys": {
182
+ "slo_downtime_events_objective_id_slo_objectives_id_fk": {
183
+ "name": "slo_downtime_events_objective_id_slo_objectives_id_fk",
184
+ "tableFrom": "slo_downtime_events",
185
+ "tableTo": "slo_objectives",
186
+ "columnsFrom": [
187
+ "objective_id"
188
+ ],
189
+ "columnsTo": [
190
+ "id"
191
+ ],
192
+ "onDelete": "cascade",
193
+ "onUpdate": "no action"
194
+ }
195
+ },
196
+ "compositePrimaryKeys": {},
197
+ "uniqueConstraints": {},
198
+ "policies": {},
199
+ "checkConstraints": {},
200
+ "isRLSEnabled": false
201
+ },
202
+ "public.slo_objectives": {
203
+ "name": "slo_objectives",
204
+ "schema": "",
205
+ "columns": {
206
+ "id": {
207
+ "name": "id",
208
+ "type": "text",
209
+ "primaryKey": true,
210
+ "notNull": true
211
+ },
212
+ "system_id": {
213
+ "name": "system_id",
214
+ "type": "text",
215
+ "primaryKey": false,
216
+ "notNull": true
217
+ },
218
+ "health_check_configuration_id": {
219
+ "name": "health_check_configuration_id",
220
+ "type": "text",
221
+ "primaryKey": false,
222
+ "notNull": false
223
+ },
224
+ "target": {
225
+ "name": "target",
226
+ "type": "double precision",
227
+ "primaryKey": false,
228
+ "notNull": true
229
+ },
230
+ "window_days": {
231
+ "name": "window_days",
232
+ "type": "integer",
233
+ "primaryKey": false,
234
+ "notNull": true
235
+ },
236
+ "dependency_exclusion": {
237
+ "name": "dependency_exclusion",
238
+ "type": "text",
239
+ "primaryKey": false,
240
+ "notNull": true,
241
+ "default": "'strict'"
242
+ },
243
+ "excluded_dependency_ids": {
244
+ "name": "excluded_dependency_ids",
245
+ "type": "json",
246
+ "primaryKey": false,
247
+ "notNull": false
248
+ },
249
+ "burn_rate_warning_percent": {
250
+ "name": "burn_rate_warning_percent",
251
+ "type": "double precision",
252
+ "primaryKey": false,
253
+ "notNull": true,
254
+ "default": 50
255
+ },
256
+ "burn_rate_critical_percent": {
257
+ "name": "burn_rate_critical_percent",
258
+ "type": "double precision",
259
+ "primaryKey": false,
260
+ "notNull": true,
261
+ "default": 80
262
+ },
263
+ "burn_rate_fast_burn_multiplier": {
264
+ "name": "burn_rate_fast_burn_multiplier",
265
+ "type": "double precision",
266
+ "primaryKey": false,
267
+ "notNull": true,
268
+ "default": 5
269
+ },
270
+ "created_at": {
271
+ "name": "created_at",
272
+ "type": "timestamp",
273
+ "primaryKey": false,
274
+ "notNull": true,
275
+ "default": "now()"
276
+ },
277
+ "updated_at": {
278
+ "name": "updated_at",
279
+ "type": "timestamp",
280
+ "primaryKey": false,
281
+ "notNull": true,
282
+ "default": "now()"
283
+ }
284
+ },
285
+ "indexes": {},
286
+ "foreignKeys": {},
287
+ "compositePrimaryKeys": {},
288
+ "uniqueConstraints": {},
289
+ "policies": {},
290
+ "checkConstraints": {},
291
+ "isRLSEnabled": false
292
+ },
293
+ "public.slo_streaks": {
294
+ "name": "slo_streaks",
295
+ "schema": "",
296
+ "columns": {
297
+ "objective_id": {
298
+ "name": "objective_id",
299
+ "type": "text",
300
+ "primaryKey": true,
301
+ "notNull": true
302
+ },
303
+ "system_id": {
304
+ "name": "system_id",
305
+ "type": "text",
306
+ "primaryKey": false,
307
+ "notNull": true
308
+ },
309
+ "current_streak": {
310
+ "name": "current_streak",
311
+ "type": "integer",
312
+ "primaryKey": false,
313
+ "notNull": true,
314
+ "default": 0
315
+ },
316
+ "best_streak": {
317
+ "name": "best_streak",
318
+ "type": "integer",
319
+ "primaryKey": false,
320
+ "notNull": true,
321
+ "default": 0
322
+ },
323
+ "streak_start": {
324
+ "name": "streak_start",
325
+ "type": "timestamp",
326
+ "primaryKey": false,
327
+ "notNull": false
328
+ },
329
+ "best_streak_end": {
330
+ "name": "best_streak_end",
331
+ "type": "timestamp",
332
+ "primaryKey": false,
333
+ "notNull": false
334
+ }
335
+ },
336
+ "indexes": {},
337
+ "foreignKeys": {
338
+ "slo_streaks_objective_id_slo_objectives_id_fk": {
339
+ "name": "slo_streaks_objective_id_slo_objectives_id_fk",
340
+ "tableFrom": "slo_streaks",
341
+ "tableTo": "slo_objectives",
342
+ "columnsFrom": [
343
+ "objective_id"
344
+ ],
345
+ "columnsTo": [
346
+ "id"
347
+ ],
348
+ "onDelete": "cascade",
349
+ "onUpdate": "no action"
350
+ }
351
+ },
352
+ "compositePrimaryKeys": {},
353
+ "uniqueConstraints": {},
354
+ "policies": {},
355
+ "checkConstraints": {},
356
+ "isRLSEnabled": false
357
+ }
358
+ },
359
+ "enums": {},
360
+ "schemas": {},
361
+ "sequences": {},
362
+ "roles": {},
363
+ "policies": {},
364
+ "views": {},
365
+ "_meta": {
366
+ "columns": {},
367
+ "schemas": {},
368
+ "tables": {}
369
+ }
370
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "postgresql",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "7",
8
+ "when": 1776544523754,
9
+ "tag": "0000_rainy_kronos",
10
+ "breakpoints": true
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from "drizzle-kit";
2
+
3
+ export default defineConfig({
4
+ schema: "./src/schema.ts",
5
+ out: "./drizzle",
6
+ dialect: "postgresql",
7
+ });
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@checkstack/slo-backend",
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "main": "src/index.ts",
6
+ "checkstack": {
7
+ "type": "backend"
8
+ },
9
+ "scripts": {
10
+ "typecheck": "tsc --noEmit",
11
+ "generate": "drizzle-kit generate",
12
+ "lint": "bun run lint:code",
13
+ "lint:code": "eslint . --max-warnings 0"
14
+ },
15
+ "dependencies": {
16
+ "@checkstack/backend-api": "0.11.0",
17
+ "@checkstack/slo-common": "0.1.0",
18
+ "@checkstack/healthcheck-common": "0.10.0",
19
+ "@checkstack/healthcheck-backend": "0.12.0",
20
+ "@checkstack/dependency-common": "0.2.0",
21
+ "@checkstack/catalog-common": "1.3.0",
22
+ "@checkstack/catalog-backend": "0.2.22",
23
+ "@checkstack/command-backend": "0.1.17",
24
+ "@checkstack/signal-common": "0.1.8",
25
+ "@checkstack/integration-backend": "0.1.17",
26
+ "@checkstack/integration-common": "0.2.7",
27
+ "@checkstack/common": "0.6.4",
28
+ "@checkstack/queue-api": "0.2.11",
29
+ "drizzle-orm": "^0.45.0",
30
+ "zod": "^4.2.1",
31
+ "@orpc/server": "^1.13.2"
32
+ },
33
+ "devDependencies": {
34
+ "@checkstack/drizzle-helper": "0.0.4",
35
+ "@checkstack/scripts": "0.1.2",
36
+ "@checkstack/test-utils-backend": "0.1.17",
37
+ "@checkstack/tsconfig": "0.0.5",
38
+ "@types/bun": "^1.0.0",
39
+ "typescript": "^5.0.0"
40
+ }
41
+ }