@debugkit/dashboard 0.3.1 → 0.5.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/dist/client/assets/_authed-DTn7rMla.js +1 -0
- package/dist/client/assets/_authed-Dc7covsB.js +7 -0
- package/dist/client/assets/{charts-C76vsG2N.js → charts-C0zeGTzu.js} +18 -18
- package/dist/client/assets/index-D12jr1bm.js +10 -0
- package/dist/client/assets/issues._fingerprint-C6ryZvIu.js +1 -0
- package/dist/client/assets/login-oLP1Yyz3.js +1 -0
- package/dist/client/assets/preload-helper-CDziuvpw.js +3 -0
- package/dist/client/assets/settings-9oQsCwdV.js +1 -0
- package/dist/client/assets/styles-DBg7wMRg.css +2 -0
- package/dist/client/assets/ui-BiRMJGWB.js +1 -0
- package/dist/server/assets/{_authed-ClbGOSDJ.js → _authed-CuDay0Tl.js} +296 -70
- package/dist/server/assets/{_authed-BaehIntL.js → _authed-DODQ_Iys.js} +28 -8
- package/dist/server/assets/{_tanstack-start-manifest_v-eNUCOzFz.js → _tanstack-start-manifest_v-BBxgjm04.js} +16 -7
- package/dist/server/assets/{charts-CNlV7Pga.js → charts-DzTVqJ8z.js} +21 -4
- package/dist/server/assets/{demo-DTdlXNgj.js → demo-hrRBo9_U.js} +87 -10
- package/dist/server/assets/dynamodb-DyPK9SVV.js +354 -0
- package/dist/server/assets/{firestore-BH-gx9no.js → firestore-B2xzpzYA.js} +89 -5
- package/dist/server/assets/fns-DPsnK0zS.js +79 -0
- package/dist/server/assets/fns-hk_OJe6M.js +250 -0
- package/dist/server/assets/{issues._fingerprint-D78dy5os.js → issues._fingerprint-CZCZDm7t.js} +159 -17
- package/dist/server/assets/{login-h3B5Vdhl.js → login-D-UG6SFw.js} +3 -3
- package/dist/server/assets/{queries-DIVV-5j6.js → memory-Do0CDoAX.js} +205 -505
- package/dist/server/assets/queries-CxHrgTdM.js +955 -0
- package/dist/server/assets/range-picker-0zbSGr3Z.js +106 -0
- package/dist/server/assets/rolldown-runtime-D8jQpDG7.js +12 -0
- package/dist/server/assets/{router-DqTf7XfT.js → router-CIIGBCmL.js} +84 -44
- package/dist/server/assets/settings-BHfngShx.js +371 -0
- package/dist/server/assets/src-D9VHcuh4.js +491 -0
- package/dist/server/assets/src-JXktBs5H.js +4 -0
- package/dist/server/assets/{ui-Lv-KcOoP.js → ui-BJokJdYa.js} +25 -3
- package/dist/server/server.js +32 -8
- package/package.json +4 -4
- package/dist/client/assets/_authed-Bi62GTX3.js +0 -7
- package/dist/client/assets/_authed-mWCAMokt.js +0 -1
- package/dist/client/assets/index-D7uhDdvA.js +0 -12
- package/dist/client/assets/issues._fingerprint-fVGLnT37.js +0 -1
- package/dist/client/assets/login-MqvT094Y.js +0 -1
- package/dist/client/assets/styles-CZZRuG1z.css +0 -2
- package/dist/client/assets/ui-Bj6uJIr8.js +0 -1
- package/dist/server/assets/dynamodb-DejcakaF.js +0 -187
- package/dist/server/assets/fns-CgB12FUN.js +0 -31
- package/dist/server/assets/fns-Yg8sT1Cb.js +0 -87
- package/dist/server/assets/memory-4DwW5cTO.js +0 -59
- package/dist/server/assets/rollups-JXbazRNh.js +0 -22
- package/dist/server/assets/src-D5jyi_C4.js +0 -235
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
import { c as parseStack, r as Envelope, u as releaseKey } from "./memory-Do0CDoAX.js";
|
|
2
|
+
import "./src-JXktBs5H.js";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
// ../../packages/ingest/src/alerts.ts
|
|
5
|
+
/** Slack incoming webhooks only: anything else could make ingest call arbitrary URLs. */
|
|
6
|
+
var SLACK_WEBHOOK = /^https:\/\/hooks\.slack\.com\/services\/[A-Za-z0-9/_-]{10,200}$/;
|
|
7
|
+
var recent = /* @__PURE__ */ new Map();
|
|
8
|
+
var HOUR = 36e5;
|
|
9
|
+
var defaultPost = (url, body) => fetch(url, {
|
|
10
|
+
method: "POST",
|
|
11
|
+
headers: { "content-type": "application/json" },
|
|
12
|
+
body: JSON.stringify(body),
|
|
13
|
+
signal: AbortSignal.timeout(3e3)
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Tell Slack about new and regressed issues, per the app's alert settings. At most one alert
|
|
17
|
+
* per issue per hour per function instance, and never more than 10 per batch. Failures are
|
|
18
|
+
* logged, never thrown: alerts must not break ingest.
|
|
19
|
+
*/
|
|
20
|
+
async function sendAlerts(app, outcome, issues, settings, post = defaultPost) {
|
|
21
|
+
const a = settings?.alerts;
|
|
22
|
+
if (!outcome || !a?.slackWebhookUrl || !SLACK_WEBHOOK.test(a.slackWebhookUrl)) return 0;
|
|
23
|
+
const critical = new Set(settings?.criticalFlows ?? []);
|
|
24
|
+
const picks = [...a.newIssues !== false ? outcome.created.map((fp) => ({
|
|
25
|
+
fp,
|
|
26
|
+
kind: "new"
|
|
27
|
+
})) : [], ...a.regressions !== false ? outcome.regressed.map((fp) => ({
|
|
28
|
+
fp,
|
|
29
|
+
kind: "regressed"
|
|
30
|
+
})) : []].filter(({ fp }) => !a.onlyCriticalFlows || critical.has(issues.get(fp)?.flow ?? "")).filter(({ fp, kind }) => {
|
|
31
|
+
const k = `${app}|${fp}|${kind}`;
|
|
32
|
+
const at = recent.get(k);
|
|
33
|
+
if (at && Date.now() - at < HOUR) return false;
|
|
34
|
+
recent.set(k, Date.now());
|
|
35
|
+
return true;
|
|
36
|
+
}).slice(0, 10);
|
|
37
|
+
if (recent.size > 5e3) recent.clear();
|
|
38
|
+
let sent = 0;
|
|
39
|
+
for (const { fp, kind } of picks) {
|
|
40
|
+
const u = issues.get(fp);
|
|
41
|
+
if (!u) continue;
|
|
42
|
+
const link = a.dashboardUrl ? `${a.dashboardUrl.replace(/\/+$/, "")}/issues/${fp}?app=${encodeURIComponent(app)}` : void 0;
|
|
43
|
+
const where = [
|
|
44
|
+
u.culprit && `\`${u.culprit}\``,
|
|
45
|
+
u.flow && `flow \`${u.flow}\`${critical.has(u.flow) ? " (critical)" : ""}`,
|
|
46
|
+
u.version && `version ${u.version}`
|
|
47
|
+
].filter(Boolean).join(" · ");
|
|
48
|
+
const text = `${kind === "new" ? ":new: New issue" : ":rotating_light: Regressed"} in *${app}*: ${link ? `<${link}|${u.title}>` : u.title}${where ? `\n${where}` : ""}`;
|
|
49
|
+
try {
|
|
50
|
+
await post(a.slackWebhookUrl, { text });
|
|
51
|
+
sent++;
|
|
52
|
+
} catch (err) {
|
|
53
|
+
console.error("[deBug] Slack alert failed", err);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return sent;
|
|
57
|
+
}
|
|
58
|
+
var CACHE_MS = 6e4;
|
|
59
|
+
var cache = /* @__PURE__ */ new Map();
|
|
60
|
+
/**
|
|
61
|
+
* The retention period for an app: its stored setting, else the deployment's default. Settings
|
|
62
|
+
* are cached for a minute per function instance, so a change from the dashboard applies to new
|
|
63
|
+
* events within about a minute, without a read on every request.
|
|
64
|
+
*/
|
|
65
|
+
async function cachedSettings(store, app) {
|
|
66
|
+
const hit = cache.get(app);
|
|
67
|
+
if (hit && Date.now() - hit.at < CACHE_MS) return hit.settings;
|
|
68
|
+
let settings;
|
|
69
|
+
try {
|
|
70
|
+
settings = await store.getSettings(app);
|
|
71
|
+
} catch {
|
|
72
|
+
settings = null;
|
|
73
|
+
}
|
|
74
|
+
cache.set(app, {
|
|
75
|
+
at: Date.now(),
|
|
76
|
+
settings
|
|
77
|
+
});
|
|
78
|
+
return settings;
|
|
79
|
+
}
|
|
80
|
+
async function effectiveRetention(store, app, fallback) {
|
|
81
|
+
return (await cachedSettings(store, app))?.retentionDays ?? fallback ?? 30;
|
|
82
|
+
}
|
|
83
|
+
// ../../packages/ingest/src/country.ts
|
|
84
|
+
/**
|
|
85
|
+
* Rough location from what the device already reports: its timezone, then its locale's region.
|
|
86
|
+
* Never from IP addresses. Timezone wins because many phones keep an en-US or en-GB locale
|
|
87
|
+
* wherever they are.
|
|
88
|
+
*/
|
|
89
|
+
var TZ = {
|
|
90
|
+
"Africa/Johannesburg": "ZA",
|
|
91
|
+
"Africa/Lagos": "NG",
|
|
92
|
+
"Africa/Nairobi": "KE",
|
|
93
|
+
"Africa/Cairo": "EG",
|
|
94
|
+
"Africa/Casablanca": "MA",
|
|
95
|
+
"Africa/Accra": "GH",
|
|
96
|
+
"Africa/Harare": "ZW",
|
|
97
|
+
"Africa/Lusaka": "ZM",
|
|
98
|
+
"Africa/Maputo": "MZ",
|
|
99
|
+
"Africa/Windhoek": "NA",
|
|
100
|
+
"Africa/Gaborone": "BW",
|
|
101
|
+
"Africa/Kampala": "UG",
|
|
102
|
+
"Africa/Dar_es_Salaam": "TZ",
|
|
103
|
+
"Africa/Addis_Ababa": "ET",
|
|
104
|
+
"Africa/Kigali": "RW",
|
|
105
|
+
"Africa/Algiers": "DZ",
|
|
106
|
+
"Africa/Tunis": "TN",
|
|
107
|
+
"Africa/Abidjan": "CI",
|
|
108
|
+
"Africa/Dakar": "SN",
|
|
109
|
+
"Africa/Luanda": "AO",
|
|
110
|
+
"Europe/London": "GB",
|
|
111
|
+
"Europe/Dublin": "IE",
|
|
112
|
+
"Europe/Paris": "FR",
|
|
113
|
+
"Europe/Berlin": "DE",
|
|
114
|
+
"Europe/Madrid": "ES",
|
|
115
|
+
"Europe/Rome": "IT",
|
|
116
|
+
"Europe/Amsterdam": "NL",
|
|
117
|
+
"Europe/Brussels": "BE",
|
|
118
|
+
"Europe/Lisbon": "PT",
|
|
119
|
+
"Europe/Stockholm": "SE",
|
|
120
|
+
"Europe/Oslo": "NO",
|
|
121
|
+
"Europe/Copenhagen": "DK",
|
|
122
|
+
"Europe/Helsinki": "FI",
|
|
123
|
+
"Europe/Warsaw": "PL",
|
|
124
|
+
"Europe/Zurich": "CH",
|
|
125
|
+
"Europe/Vienna": "AT",
|
|
126
|
+
"Europe/Athens": "GR",
|
|
127
|
+
"Europe/Istanbul": "TR",
|
|
128
|
+
"Europe/Moscow": "RU",
|
|
129
|
+
"Europe/Kyiv": "UA",
|
|
130
|
+
"Europe/Kiev": "UA",
|
|
131
|
+
"Europe/Prague": "CZ",
|
|
132
|
+
"Europe/Budapest": "HU",
|
|
133
|
+
"Europe/Bucharest": "RO",
|
|
134
|
+
"America/New_York": "US",
|
|
135
|
+
"America/Chicago": "US",
|
|
136
|
+
"America/Denver": "US",
|
|
137
|
+
"America/Los_Angeles": "US",
|
|
138
|
+
"America/Phoenix": "US",
|
|
139
|
+
"America/Anchorage": "US",
|
|
140
|
+
"Pacific/Honolulu": "US",
|
|
141
|
+
"America/Detroit": "US",
|
|
142
|
+
"America/Toronto": "CA",
|
|
143
|
+
"America/Vancouver": "CA",
|
|
144
|
+
"America/Edmonton": "CA",
|
|
145
|
+
"America/Halifax": "CA",
|
|
146
|
+
"America/Mexico_City": "MX",
|
|
147
|
+
"America/Sao_Paulo": "BR",
|
|
148
|
+
"America/Argentina/Buenos_Aires": "AR",
|
|
149
|
+
"America/Bogota": "CO",
|
|
150
|
+
"America/Lima": "PE",
|
|
151
|
+
"America/Santiago": "CL",
|
|
152
|
+
"Asia/Dubai": "AE",
|
|
153
|
+
"Asia/Riyadh": "SA",
|
|
154
|
+
"Asia/Qatar": "QA",
|
|
155
|
+
"Asia/Jerusalem": "IL",
|
|
156
|
+
"Asia/Kolkata": "IN",
|
|
157
|
+
"Asia/Calcutta": "IN",
|
|
158
|
+
"Asia/Karachi": "PK",
|
|
159
|
+
"Asia/Dhaka": "BD",
|
|
160
|
+
"Asia/Bangkok": "TH",
|
|
161
|
+
"Asia/Jakarta": "ID",
|
|
162
|
+
"Asia/Singapore": "SG",
|
|
163
|
+
"Asia/Kuala_Lumpur": "MY",
|
|
164
|
+
"Asia/Manila": "PH",
|
|
165
|
+
"Asia/Ho_Chi_Minh": "VN",
|
|
166
|
+
"Asia/Hong_Kong": "HK",
|
|
167
|
+
"Asia/Shanghai": "CN",
|
|
168
|
+
"Asia/Tokyo": "JP",
|
|
169
|
+
"Asia/Seoul": "KR",
|
|
170
|
+
"Asia/Taipei": "TW",
|
|
171
|
+
"Australia/Sydney": "AU",
|
|
172
|
+
"Australia/Melbourne": "AU",
|
|
173
|
+
"Australia/Brisbane": "AU",
|
|
174
|
+
"Australia/Perth": "AU",
|
|
175
|
+
"Australia/Adelaide": "AU",
|
|
176
|
+
"Pacific/Auckland": "NZ",
|
|
177
|
+
"Indian/Mauritius": "MU"
|
|
178
|
+
};
|
|
179
|
+
function countryOf(ctx) {
|
|
180
|
+
const tz = ctx.timezone ? TZ[ctx.timezone] : void 0;
|
|
181
|
+
if (tz) return tz;
|
|
182
|
+
return /[-_]([A-Z]{2})(?:\b|$)/.exec(ctx.locale ?? "")?.[1] ?? "unknown";
|
|
183
|
+
}
|
|
184
|
+
// ../../packages/ingest/src/fingerprint.ts
|
|
185
|
+
/** Strip volatile parts so "User 123 not found" and "User 456 not found" group together. */
|
|
186
|
+
function normaliseMessage(msg) {
|
|
187
|
+
return msg.replace(/https?:\/\/\S+/g, "<url>").replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi, "<uuid>").replace(/\b[0-9a-f]{16,}\b/gi, "<hex>").replace(/[\w.+-]+@[\w-]+\.[\w.]+/g, "<email>").replace(/\d+(\.\d+)?/g, "<n>").replace(/(["'`]).*?\1/g, "<str>").trim().slice(0, 300);
|
|
188
|
+
}
|
|
189
|
+
/** Remove build hashes / absolute prefixes so the same code location matches across builds and devices. */
|
|
190
|
+
function normaliseFile(file) {
|
|
191
|
+
if (!file) return "";
|
|
192
|
+
let f = file.replace(/\/\/&.*$/, "").replace(/[?#].*$/, "").replace(/^[a-z]+:\/\/[^/]+/i, "");
|
|
193
|
+
if (/\.(?:js)?bundle$/.test(f)) return f.replace(/^.*\//, "");
|
|
194
|
+
for (const root of [
|
|
195
|
+
"/src/",
|
|
196
|
+
"/lib/",
|
|
197
|
+
"/app/"
|
|
198
|
+
]) {
|
|
199
|
+
const i = f.lastIndexOf(root);
|
|
200
|
+
if (i >= 0) {
|
|
201
|
+
f = f.slice(i + 1);
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return f.replace(/\.[0-9a-f]{6,}\./g, ".");
|
|
206
|
+
}
|
|
207
|
+
function topInAppFrame(frames) {
|
|
208
|
+
return frames?.find((f) => f.inApp !== false && f.file) ?? frames?.[0];
|
|
209
|
+
}
|
|
210
|
+
function culpritOf(e) {
|
|
211
|
+
const f = topInAppFrame(e.error.frames);
|
|
212
|
+
if (!f) return void 0;
|
|
213
|
+
const loc = normaliseFile(f.file) + (f.line ? `:${f.line}` : "");
|
|
214
|
+
return f.fn ? `${f.fn} (${loc})` : loc;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Fingerprint = error name + top in-app frame (function + file, not line, so small edits
|
|
218
|
+
* don't split issues) + flow. Falls back to the normalised message when there's no stack.
|
|
219
|
+
*/
|
|
220
|
+
function fingerprint(e) {
|
|
221
|
+
const f = topInAppFrame(e.error.frames);
|
|
222
|
+
const r = e.request;
|
|
223
|
+
const where = r ? `${r.method.toUpperCase()} ${r.url} ${r.status ? `${Math.floor(r.status / 100)}xx` : "failed"}` : f ? `${f.fn ?? "?"}@${normaliseFile(f.file)}` : normaliseMessage(e.error.message);
|
|
224
|
+
return createHash("sha256").update([
|
|
225
|
+
e.error.name,
|
|
226
|
+
where,
|
|
227
|
+
e.flow ?? ""
|
|
228
|
+
].join("|")).digest("hex").slice(0, 24);
|
|
229
|
+
}
|
|
230
|
+
function titleOf(e) {
|
|
231
|
+
return `${e.error.name}: ${e.error.message}`.slice(0, 200);
|
|
232
|
+
}
|
|
233
|
+
// ../../packages/ingest/src/index.ts
|
|
234
|
+
/** "pk_abc:megaton-native,pk_def:other-app" → { pk_abc: "megaton-native", ... } */
|
|
235
|
+
function parseIngestKeys(raw) {
|
|
236
|
+
const out = {};
|
|
237
|
+
for (const pair of (raw ?? "").split(",").map((s) => s.trim()).filter(Boolean)) {
|
|
238
|
+
const [key, app] = pair.split(":");
|
|
239
|
+
if (key && app) out[key] = app;
|
|
240
|
+
}
|
|
241
|
+
return out;
|
|
242
|
+
}
|
|
243
|
+
var dayOf = (iso) => iso.slice(0, 10);
|
|
244
|
+
/** Clamp client clocks: events claiming to be from the future or very old are pinned to receipt time. */
|
|
245
|
+
function sanitiseTs(ts, now) {
|
|
246
|
+
const t = Date.parse(ts);
|
|
247
|
+
const n = now.getTime();
|
|
248
|
+
if (Number.isNaN(t) || t > n + 3e5 || t < n - 6048e5) return now.toISOString();
|
|
249
|
+
return new Date(t).toISOString();
|
|
250
|
+
}
|
|
251
|
+
function enrich(ctx) {
|
|
252
|
+
return {
|
|
253
|
+
...ctx,
|
|
254
|
+
os: {
|
|
255
|
+
...ctx.os,
|
|
256
|
+
name: ctx.os.name.toLowerCase()
|
|
257
|
+
},
|
|
258
|
+
runtime: {
|
|
259
|
+
...ctx.runtime,
|
|
260
|
+
name: ctx.runtime.name.toLowerCase()
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
/** Platform-agnostic ingest. Wrap with ./firebase or ./lambda to deploy. */
|
|
265
|
+
async function ingest(rawBody, ingestKey, opts) {
|
|
266
|
+
const now = opts.now?.() ?? /* @__PURE__ */ new Date();
|
|
267
|
+
if (!ingestKey || !opts.keys[ingestKey]) return {
|
|
268
|
+
status: 401,
|
|
269
|
+
body: {
|
|
270
|
+
ok: false,
|
|
271
|
+
error: "invalid ingest key"
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
if (Buffer.byteLength(rawBody) > (opts.maxBytes ?? 524288)) return {
|
|
275
|
+
status: 413,
|
|
276
|
+
body: {
|
|
277
|
+
ok: false,
|
|
278
|
+
error: "payload too large"
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
let json;
|
|
282
|
+
try {
|
|
283
|
+
json = JSON.parse(rawBody);
|
|
284
|
+
} catch {
|
|
285
|
+
return {
|
|
286
|
+
status: 400,
|
|
287
|
+
body: {
|
|
288
|
+
ok: false,
|
|
289
|
+
error: "invalid json"
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
const parsed = Envelope.safeParse(json);
|
|
294
|
+
if (!parsed.success) return {
|
|
295
|
+
status: 400,
|
|
296
|
+
body: {
|
|
297
|
+
ok: false,
|
|
298
|
+
error: "invalid envelope",
|
|
299
|
+
issues: parsed.error.flatten()
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
const env = parsed.data;
|
|
303
|
+
const app = env.context.app.id;
|
|
304
|
+
if (opts.keys[ingestKey] !== app && opts.keys[ingestKey] !== "*") return {
|
|
305
|
+
status: 403,
|
|
306
|
+
body: {
|
|
307
|
+
ok: false,
|
|
308
|
+
error: `key not allowed for app ${app}`
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
const context = enrich(env.context);
|
|
312
|
+
const receivedAt = now.toISOString();
|
|
313
|
+
const stored = [];
|
|
314
|
+
const rollups = [];
|
|
315
|
+
const issues = /* @__PURE__ */ new Map();
|
|
316
|
+
/** Where this envelope's user counts: "app", "crash", "issue:<fp>". */
|
|
317
|
+
const scopes = /* @__PURE__ */ new Set();
|
|
318
|
+
for (const raw of env.events) {
|
|
319
|
+
const event = {
|
|
320
|
+
...raw,
|
|
321
|
+
ts: sanitiseTs(raw.ts, now)
|
|
322
|
+
};
|
|
323
|
+
if (event.type === "error" && !event.error.frames?.length && event.error.stack) event.error.frames = parseStack(event.error.stack);
|
|
324
|
+
const day = dayOf(event.ts);
|
|
325
|
+
if (event.type === "session") {
|
|
326
|
+
rollups.push({
|
|
327
|
+
app,
|
|
328
|
+
day,
|
|
329
|
+
dimension: "session",
|
|
330
|
+
key: `${context.app.version || "unknown"}|${event.status}`,
|
|
331
|
+
kind: "event",
|
|
332
|
+
by: 1
|
|
333
|
+
});
|
|
334
|
+
scopes.add("app");
|
|
335
|
+
if (event.status === "started") rollups.push({
|
|
336
|
+
app,
|
|
337
|
+
day,
|
|
338
|
+
dimension: "release",
|
|
339
|
+
key: releaseKey(context.app),
|
|
340
|
+
kind: "event",
|
|
341
|
+
by: 1
|
|
342
|
+
});
|
|
343
|
+
if (event.status === "crashed") scopes.add("crash");
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
346
|
+
scopes.add("app");
|
|
347
|
+
if (event.type === "metric") {
|
|
348
|
+
rollups.push({
|
|
349
|
+
app,
|
|
350
|
+
day,
|
|
351
|
+
dimension: "requests",
|
|
352
|
+
key: event.key,
|
|
353
|
+
kind: "event",
|
|
354
|
+
by: event.count
|
|
355
|
+
});
|
|
356
|
+
if (event.errors) rollups.push({
|
|
357
|
+
app,
|
|
358
|
+
day,
|
|
359
|
+
dimension: "requests",
|
|
360
|
+
key: event.key,
|
|
361
|
+
kind: "error",
|
|
362
|
+
by: event.errors
|
|
363
|
+
});
|
|
364
|
+
event.buckets.forEach((n, i) => n && rollups.push({
|
|
365
|
+
app,
|
|
366
|
+
day,
|
|
367
|
+
dimension: "latency",
|
|
368
|
+
key: `${event.key}|${i}`,
|
|
369
|
+
kind: "event",
|
|
370
|
+
by: n
|
|
371
|
+
}));
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
const kind = event.type === "error" ? "error" : "event";
|
|
375
|
+
const inc = (dimension, key) => rollups.push({
|
|
376
|
+
app,
|
|
377
|
+
day,
|
|
378
|
+
dimension,
|
|
379
|
+
key: key || "unknown",
|
|
380
|
+
kind,
|
|
381
|
+
by: 1
|
|
382
|
+
});
|
|
383
|
+
let fp;
|
|
384
|
+
if (event.type === "error") {
|
|
385
|
+
fp = fingerprint(event);
|
|
386
|
+
const cur = issues.get(fp);
|
|
387
|
+
const se = {
|
|
388
|
+
app,
|
|
389
|
+
day,
|
|
390
|
+
fingerprint: fp,
|
|
391
|
+
event,
|
|
392
|
+
context,
|
|
393
|
+
user: env.user,
|
|
394
|
+
sessionId: env.session.id,
|
|
395
|
+
receivedAt
|
|
396
|
+
};
|
|
397
|
+
issues.set(fp, {
|
|
398
|
+
app,
|
|
399
|
+
fingerprint: fp,
|
|
400
|
+
title: titleOf(event),
|
|
401
|
+
culprit: culpritOf(event),
|
|
402
|
+
flow: event.flow,
|
|
403
|
+
by: (cur?.by ?? 0) + 1,
|
|
404
|
+
ts: cur && cur.ts > event.ts ? cur.ts : event.ts,
|
|
405
|
+
firstTs: cur && cur.firstTs < event.ts ? cur.firstTs : event.ts,
|
|
406
|
+
lastEvent: cur && cur.ts > event.ts ? cur.lastEvent : se,
|
|
407
|
+
version: context.app.version
|
|
408
|
+
});
|
|
409
|
+
scopes.add(`issue:${fp}`);
|
|
410
|
+
inc("issue", fp);
|
|
411
|
+
if (event.request) inc("endpoint", `${event.request.method.toUpperCase()} ${event.request.url}`);
|
|
412
|
+
rollups.push({
|
|
413
|
+
app,
|
|
414
|
+
day: event.ts.slice(0, 13),
|
|
415
|
+
dimension: "issueHour",
|
|
416
|
+
key: fp,
|
|
417
|
+
kind,
|
|
418
|
+
by: 1
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
inc("total", "all");
|
|
422
|
+
inc("flow", event.flow ?? "untagged");
|
|
423
|
+
inc("os", `${context.os.name} ${context.os.version ?? ""}`.trim());
|
|
424
|
+
inc("appVersion", context.app.version);
|
|
425
|
+
inc("deviceModel", context.device.model);
|
|
426
|
+
if (event.type === "event" && event.outcome && event.flow) {
|
|
427
|
+
inc("flowOutcome", `${event.flow}|${event.outcome}`);
|
|
428
|
+
if (event.step) inc("flowStep", `${event.flow}|${event.step}|${event.outcome}`);
|
|
429
|
+
}
|
|
430
|
+
if (event.type === "error") {
|
|
431
|
+
inc("network", context.network?.type);
|
|
432
|
+
inc("country", countryOf(context));
|
|
433
|
+
}
|
|
434
|
+
stored.push({
|
|
435
|
+
app,
|
|
436
|
+
day,
|
|
437
|
+
fingerprint: fp,
|
|
438
|
+
event,
|
|
439
|
+
context,
|
|
440
|
+
user: env.user,
|
|
441
|
+
sessionId: env.session.id,
|
|
442
|
+
receivedAt
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
await opts.store.registerApp(app);
|
|
446
|
+
const retentionDays = stored.length ? await effectiveRetention(opts.store, app, opts.retentionDays) : void 0;
|
|
447
|
+
const [, outcome] = await Promise.all([
|
|
448
|
+
stored.length ? opts.store.writeEvents(stored, { retentionDays }) : void 0,
|
|
449
|
+
opts.store.upsertIssues([...issues.values()]),
|
|
450
|
+
opts.store.incrementRollups(rollups),
|
|
451
|
+
markUsers(opts.store, app, env.user?.id ?? env.user?.anonymousId ?? env.session.id, scopes, dayOf(receivedAt))
|
|
452
|
+
]);
|
|
453
|
+
if (outcome && (outcome.created.length || outcome.regressed.length)) await sendAlerts(app, outcome, issues, await cachedSettings(opts.store, app));
|
|
454
|
+
return {
|
|
455
|
+
status: 202,
|
|
456
|
+
body: {
|
|
457
|
+
ok: true,
|
|
458
|
+
accepted: env.events.length
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
/** Recently written (scope, member, day) marks, so a busy user costs one write per day, not per batch. */
|
|
463
|
+
var seenMarks = /* @__PURE__ */ new Set();
|
|
464
|
+
/**
|
|
465
|
+
* Count the envelope's user in each scope. The id is hashed, so the store never holds user ids,
|
|
466
|
+
* and each (scope, user, day) is written at most once per function instance.
|
|
467
|
+
*/
|
|
468
|
+
async function markUsers(store, app, who, scopes, day) {
|
|
469
|
+
if (!scopes.size) return;
|
|
470
|
+
const member = createHash("sha256").update(`${app}\u0000${who}`).digest("hex").slice(0, 24);
|
|
471
|
+
const marks = [];
|
|
472
|
+
for (const scope of scopes) {
|
|
473
|
+
const k = `${app}|${scope}|${member}|${day}`;
|
|
474
|
+
if (seenMarks.has(k)) continue;
|
|
475
|
+
seenMarks.add(k);
|
|
476
|
+
marks.push({
|
|
477
|
+
scope,
|
|
478
|
+
member,
|
|
479
|
+
day
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
if (seenMarks.size > 5e4) seenMarks.clear();
|
|
483
|
+
if (marks.length) await store.markUsers(app, marks);
|
|
484
|
+
}
|
|
485
|
+
var CORS_HEADERS = {
|
|
486
|
+
"access-control-allow-origin": "*",
|
|
487
|
+
"access-control-allow-methods": "POST, OPTIONS",
|
|
488
|
+
"access-control-allow-headers": "content-type, x-debug-key",
|
|
489
|
+
"access-control-max-age": "86400"
|
|
490
|
+
};
|
|
491
|
+
export { ingest as n, parseIngestKeys as r, CORS_HEADERS as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
// src/components/ui.tsx
|
|
3
3
|
function Logo() {
|
|
4
4
|
return /* @__PURE__ */ jsxs("span", {
|
|
@@ -26,7 +26,7 @@ function SeverityBadge({ severity }) {
|
|
|
26
26
|
}
|
|
27
27
|
function Card({ title, subtitle, children, right }) {
|
|
28
28
|
return /* @__PURE__ */ jsxs("section", {
|
|
29
|
-
className: "rounded-xl border border-line bg-panel p-4 sm:p-5",
|
|
29
|
+
className: "min-w-0 rounded-xl border border-line bg-panel p-4 sm:p-5",
|
|
30
30
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
31
31
|
className: "mb-3 flex items-start justify-between gap-3",
|
|
32
32
|
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
|
|
@@ -128,4 +128,26 @@ function timeAgo(iso, now = Date.now()) {
|
|
|
128
128
|
if (s < 86400) return `${Math.round(s / 3600)}h ago`;
|
|
129
129
|
return `${Math.round(s / 86400)}d ago`;
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
/** Small labels under an issue: regressed, new in the latest release, resolved, ignored. */
|
|
132
|
+
function IssueLabels({ issue }) {
|
|
133
|
+
const chip = "mt-1 mr-1 inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide";
|
|
134
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
135
|
+
issue.status === "regressed" && /* @__PURE__ */ jsxs("span", {
|
|
136
|
+
className: `${chip} bg-sev-critical text-white`,
|
|
137
|
+
children: ["Regressed", issue.resolvedIn ? ` after ${issue.resolvedIn}` : ""]
|
|
138
|
+
}),
|
|
139
|
+
issue.newInLatest && /* @__PURE__ */ jsxs("span", {
|
|
140
|
+
className: `${chip} bg-accent-soft text-accent`,
|
|
141
|
+
children: ["New in ", issue.firstVersion]
|
|
142
|
+
}),
|
|
143
|
+
issue.status === "resolved" && /* @__PURE__ */ jsxs("span", {
|
|
144
|
+
className: `${chip} border border-line text-muted`,
|
|
145
|
+
children: ["Resolved", issue.resolvedIn ? ` in ${issue.resolvedIn}` : ""]
|
|
146
|
+
}),
|
|
147
|
+
issue.status === "ignored" && /* @__PURE__ */ jsx("span", {
|
|
148
|
+
className: `${chip} border border-line text-muted`,
|
|
149
|
+
children: "Ignored"
|
|
150
|
+
})
|
|
151
|
+
] });
|
|
152
|
+
}
|
|
153
|
+
export { SeverityBadge as a, timeAgo as c, Logo as i, DataTable as n, ShareBars as o, IssueLabels as r, Stat as s, Card as t };
|
package/dist/server/server.js
CHANGED
|
@@ -4485,7 +4485,7 @@ var HEADERS = { TSS_SHELL: "X-TSS_SHELL" };
|
|
|
4485
4485
|
* the dev styles URL for route-scoped CSS collection.
|
|
4486
4486
|
*/
|
|
4487
4487
|
async function getStartManifest(matchedRoutes) {
|
|
4488
|
-
const { tsrStartManifest } = await import("./assets/_tanstack-start-manifest_v-
|
|
4488
|
+
const { tsrStartManifest } = await import("./assets/_tanstack-start-manifest_v-BBxgjm04.js");
|
|
4489
4489
|
const startManifest = tsrStartManifest();
|
|
4490
4490
|
let routes = startManifest.routes;
|
|
4491
4491
|
routes[rootRouteId];
|
|
@@ -4506,29 +4506,53 @@ async function getStartManifest(matchedRoutes) {
|
|
|
4506
4506
|
}
|
|
4507
4507
|
// \0%23tanstack-start-server-fn-resolver
|
|
4508
4508
|
var manifest = {
|
|
4509
|
+
"0c2f8fcb35c5e356e4a58fce376bb16efb0e006f519592fdd5f120fa868720cd": {
|
|
4510
|
+
functionName: "saveRetention_createServerFn_handler",
|
|
4511
|
+
importer: () => import("./assets/fns-hk_OJe6M.js")
|
|
4512
|
+
},
|
|
4509
4513
|
"1edaae661b4968edee65ebb4a946e246107684704b784b6359bf9af2dfaae23f": {
|
|
4510
4514
|
functionName: "getSessionUser_createServerFn_handler",
|
|
4511
|
-
importer: () => import("./assets/fns-
|
|
4515
|
+
importer: () => import("./assets/fns-hk_OJe6M.js")
|
|
4516
|
+
},
|
|
4517
|
+
"7028d75aed3e58a91f5f26a3821d0cec6bb478a913058f5aa73cbfb64bbc41d3": {
|
|
4518
|
+
functionName: "sendTestAlert_createServerFn_handler",
|
|
4519
|
+
importer: () => import("./assets/fns-hk_OJe6M.js")
|
|
4512
4520
|
},
|
|
4513
4521
|
"86933afdbcaa1be4a0aa07c4f8e690fdd684edbeab02a49ffdb73e85cadf9933": {
|
|
4514
4522
|
functionName: "getIssueDetail_createServerFn_handler",
|
|
4515
|
-
importer: () => import("./assets/fns-
|
|
4523
|
+
importer: () => import("./assets/fns-hk_OJe6M.js")
|
|
4516
4524
|
},
|
|
4517
4525
|
"9354c2231554471ec5cde4e9a07b2e32662a8ce0bf29b09b5b930359d374f862": {
|
|
4518
4526
|
functionName: "getOverview_createServerFn_handler",
|
|
4519
|
-
importer: () => import("./assets/fns-
|
|
4527
|
+
importer: () => import("./assets/fns-hk_OJe6M.js")
|
|
4520
4528
|
},
|
|
4521
4529
|
"949e1fa91e479f6ad9193caee7087c38ca21191786f4b2c082ea643cbd30dec1": {
|
|
4522
4530
|
functionName: "getLoginInfo_createServerFn_handler",
|
|
4523
|
-
importer: () => import("./assets/fns-
|
|
4531
|
+
importer: () => import("./assets/fns-hk_OJe6M.js")
|
|
4532
|
+
},
|
|
4533
|
+
"950c0a9412e17ae8308bccd862dee5faea0375153c5ce59491a033dbcb7e7181": {
|
|
4534
|
+
functionName: "saveAppSettings_createServerFn_handler",
|
|
4535
|
+
importer: () => import("./assets/fns-hk_OJe6M.js")
|
|
4536
|
+
},
|
|
4537
|
+
"a1b47d616a31acc3132c1bb8258bde961d9c419ff91b2ce1d6479ebb9760b393": {
|
|
4538
|
+
functionName: "restampExisting_createServerFn_handler",
|
|
4539
|
+
importer: () => import("./assets/fns-hk_OJe6M.js")
|
|
4524
4540
|
},
|
|
4525
4541
|
"a9edf8f42685a06ce282bb7c9f888e3ae39636f350a90750c31a47b27de7dca8": {
|
|
4526
4542
|
functionName: "login_createServerFn_handler",
|
|
4527
|
-
importer: () => import("./assets/fns-
|
|
4543
|
+
importer: () => import("./assets/fns-hk_OJe6M.js")
|
|
4544
|
+
},
|
|
4545
|
+
"c263ee8bf14396211aeb95bc2b2aec914480b38cc99a9024c1319f932f590f2f": {
|
|
4546
|
+
functionName: "updateIssueStatus_createServerFn_handler",
|
|
4547
|
+
importer: () => import("./assets/fns-hk_OJe6M.js")
|
|
4548
|
+
},
|
|
4549
|
+
"e97a9c2b8715ff5e25a9629262b594fb42f11853d6eea78b87305fd0b5155d4d": {
|
|
4550
|
+
functionName: "getSettings_createServerFn_handler",
|
|
4551
|
+
importer: () => import("./assets/fns-hk_OJe6M.js")
|
|
4528
4552
|
},
|
|
4529
4553
|
"fd40d9026eb7d8fb5ab200daaed9a58f1d7b4eaf5b1ccab3e4cef9b0fedd9bc4": {
|
|
4530
4554
|
functionName: "logout_createServerFn_handler",
|
|
4531
|
-
importer: () => import("./assets/fns-
|
|
4555
|
+
importer: () => import("./assets/fns-hk_OJe6M.js")
|
|
4532
4556
|
}
|
|
4533
4557
|
};
|
|
4534
4558
|
async function getServerFnById(id, access) {
|
|
@@ -7260,7 +7284,7 @@ var getBaseManifest = getProdBaseManifest;
|
|
|
7260
7284
|
var createEarlyHintsForRequest = createEarlyHintsCollector;
|
|
7261
7285
|
async function loadEntries() {
|
|
7262
7286
|
const [routerEntry, startEntry, pluginAdapters] = await Promise.all([
|
|
7263
|
-
import("./assets/router-
|
|
7287
|
+
import("./assets/router-CIIGBCmL.js").then((n) => n.t),
|
|
7264
7288
|
import("./assets/start-t09PGpZL.js"),
|
|
7265
7289
|
import("./assets/empty-plugin-adapters-BsRz-CQL.js")
|
|
7266
7290
|
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@debugkit/dashboard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "The self-hosted deBug dashboard. Run it with npx debugkit dashboard, or npx @debugkit/dashboard with your own settings.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"tailwindcss": "^4.3.5",
|
|
30
30
|
"vite": "^8.3.7",
|
|
31
31
|
"@tanstack/react-start": "^1.169.5",
|
|
32
|
-
"@debugkit/adapters": "0.
|
|
33
|
-
"@debugkit/ingest": "0.
|
|
34
|
-
"@debugkit/schema": "0.
|
|
32
|
+
"@debugkit/adapters": "0.5.0",
|
|
33
|
+
"@debugkit/ingest": "0.5.0",
|
|
34
|
+
"@debugkit/schema": "0.5.0"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=20.12"
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{_ as e,c as t,d as n,f as r,l as i,m as a,n as o}from"./index-D7uhDdvA.js";import{r as s,t as c}from"./charts-C76vsG2N.js";import{a as l,i as u,n as d,o as f,s as p,t as m}from"./ui-Bj6uJIr8.js";var h=e(a()),g=r();function _(){let e=o.useLoaderData(),{flow:n}=o.useSearch(),r=i({from:o.fullPath});if(!e)return(0,g.jsx)(x,{});let{totals:a}=e,h=n?e.issues.filter(e=>(e.flow??`untagged`)===n):e.issues,_=a.changePct;return(0,g.jsxs)(`main`,{className:`mx-auto max-w-7xl space-y-5 px-4 py-6 sm:px-6`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-xs uppercase tracking-wide text-muted`,children:`Overview · last 24h`}),(0,g.jsxs)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:[`What's going wrong in `,e.app]})]}),e.apps.length>1&&(0,g.jsx)(`select`,{"aria-label":`App`,value:e.app,onChange:e=>r({search:{app:e.target.value}}),className:`rounded-md border border-line bg-panel px-2 py-1.5 text-sm`,children:e.apps.map(e=>(0,g.jsx)(`option`,{children:e},e))})]}),(0,g.jsx)(`section`,{"aria-label":`Summary`,className:`rounded-xl border border-line bg-panel p-4 sm:p-5`,children:(0,g.jsx)(`ul`,{className:`space-y-1.5 text-[15px] leading-relaxed`,children:e.narrative.map((e,t)=>(0,g.jsx)(`li`,{className:t===0?`font-medium`:`text-ink/90`,children:e},t))})}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,g.jsx)(f,{label:`Errors (24h)`,value:a.errors24h.toLocaleString(),tone:a.criticalIssues?`critical`:void 0,hint:_===null?`no prior data`:`${_>0?`▲`:_<0?`▼`:`•`} ${Math.abs(_)}% vs previous 24h`}),(0,g.jsx)(f,{label:`Critical issues`,value:a.criticalIssues,tone:a.criticalIssues?`critical`:void 0,hint:`≥ threshold occurrences in 24h`}),(0,g.jsx)(f,{label:`Failing flows`,value:a.failingFlows,hint:`parts of the app with errors in 24h`}),(0,g.jsx)(f,{label:`Crash-free sessions (14d)`,value:v(e.health.crashFreeRate),tone:e.health.crashFreeRate!==null&&e.health.crashFreeRate<.99?`high`:void 0,hint:`${e.health.sessions14d.toLocaleString()} sessions · ${a.activeIssues} active issues`})]}),(0,g.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-5`,children:[(0,g.jsx)(`div`,{className:`lg:col-span-3`,children:(0,g.jsxs)(m,{title:`Where the app is failing`,subtitle:`Errors in the last 24h by flow, coloured by worst severity. Click a bar to filter issues.`,children:[(0,g.jsx)(c,{data:e.flows,onSelect:e=>r({search:t=>({...t,flow:t.flow===e?void 0:e})})}),(0,g.jsx)(d,{columns:[`Flow`,`Severity`,`Errors 24h`,`Errors 14d`,`Issues`,`Failure rate 14d`],rows:e.flows.map(e=>[e.flow,e.severity,e.errors24h,e.errors14d,e.issues,e.failureRate===null?`—`:`${Math.round(e.failureRate*100)}%`])})]})}),(0,g.jsx)(`div`,{className:`lg:col-span-2`,children:(0,g.jsxs)(m,{title:`Error trend`,subtitle:`Errors per day, last 14 days (UTC)`,children:[(0,g.jsx)(s,{data:e.trend}),(0,g.jsx)(d,{columns:[`Day`,`Errors`,`Events`],rows:e.trend.map(e=>[e.day,e.errors,e.events])})]})})]}),(0,g.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-2`,children:[(0,g.jsx)(m,{title:`Release health`,subtitle:`Share of sessions without a crash or unhandled error, per app version (14d). Recorded automatically by the SDK.`,children:e.health.releases.length?(0,g.jsx)(`div`,{className:`-mx-4 overflow-x-auto sm:mx-0`,children:(0,g.jsxs)(`table`,{className:`tabular w-full min-w-[420px] text-left text-sm`,children:[(0,g.jsx)(`thead`,{className:`text-xs text-muted`,children:(0,g.jsxs)(`tr`,{className:`border-b border-line`,children:[(0,g.jsx)(`th`,{className:`px-4 py-2 font-medium sm:px-2`,children:`Version`}),(0,g.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Sessions`}),(0,g.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Crash-free`}),(0,g.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Error-free`})]})}),(0,g.jsx)(`tbody`,{children:e.health.releases.map(e=>(0,g.jsxs)(`tr`,{className:`border-b border-line last:border-0`,children:[(0,g.jsx)(`td`,{className:`px-4 py-2 font-medium sm:px-2`,children:e.version}),(0,g.jsx)(`td`,{className:`px-2 py-2 text-right text-muted`,children:e.sessions.toLocaleString()}),(0,g.jsx)(`td`,{className:`px-2 py-2 text-right font-semibold ${y(e.crashFreeRate)}`,children:v(e.crashFreeRate)}),(0,g.jsx)(`td`,{className:`px-2 py-2 text-right`,children:v(e.errorFreeRate)})]},e.version))})]})}):(0,g.jsx)(`p`,{className:`text-sm text-muted`,children:`No sessions yet. They're recorded automatically from SDK 0.2.`})}),(0,g.jsx)(m,{title:`Failing endpoints`,subtitle:`Requests that returned 5xx, timed out or failed, 14d. Captured automatically from fetch and XHR.`,children:e.health.endpoints.length?(0,g.jsx)(l,{rows:e.health.endpoints.map(e=>({key:e.endpoint,value:e.failures14d}))}):(0,g.jsx)(`p`,{className:`text-sm text-muted`,children:`No failed requests.`})})]}),(0,g.jsx)(m,{title:n?`Issues in ${n}`:`Issues by severity`,subtitle:`Grouped errors. Severity is set by occurrences in the last 24 hours.`,right:n?(0,g.jsx)(`button`,{className:`text-xs text-accent`,onClick:()=>r({search:e=>({...e,flow:void 0})}),children:`Clear filter ×`}):null,children:(0,g.jsx)(`div`,{className:`-mx-4 overflow-x-auto sm:mx-0`,children:(0,g.jsxs)(`table`,{className:`tabular w-full min-w-[640px] text-left text-sm`,children:[(0,g.jsx)(`thead`,{className:`text-xs text-muted`,children:(0,g.jsxs)(`tr`,{className:`border-b border-line`,children:[(0,g.jsx)(`th`,{className:`px-4 py-2 font-medium sm:px-2`,children:`Severity`}),(0,g.jsx)(`th`,{className:`px-2 py-2 font-medium`,children:`Issue`}),(0,g.jsx)(`th`,{className:`px-2 py-2 font-medium`,children:`Flow`}),(0,g.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`24h`}),(0,g.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Total`}),(0,g.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Last seen`})]})}),(0,g.jsxs)(`tbody`,{children:[h.map(n=>(0,g.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-panel-2`,children:[(0,g.jsx)(`td`,{className:`px-4 py-2.5 sm:px-2`,children:(0,g.jsx)(u,{severity:n.severity})}),(0,g.jsxs)(`td`,{className:`max-w-[420px] px-2 py-2.5`,children:[(0,g.jsx)(t,{to:`/issues/$fingerprint`,params:{fingerprint:n.fingerprint},search:{app:e.app},className:`block truncate font-medium hover:text-accent`,children:n.title}),n.culprit&&(0,g.jsx)(`div`,{className:`truncate font-mono text-xs text-muted`,children:n.culprit})]}),(0,g.jsx)(`td`,{className:`px-2 py-2.5 text-xs`,children:n.flow??(0,g.jsx)(`span`,{className:`text-muted`,children:`untagged`})}),(0,g.jsx)(`td`,{className:`px-2 py-2.5 text-right font-semibold`,children:n.count24h}),(0,g.jsx)(`td`,{className:`px-2 py-2.5 text-right text-muted`,children:n.countTotal}),(0,g.jsx)(`td`,{className:`px-2 py-2.5 text-right text-xs text-muted`,children:p(n.lastSeen)})]},n.fingerprint)),!h.length&&(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{colSpan:6,className:`px-2 py-6 text-center text-muted`,children:`No issues.`})})]})]})})}),(0,g.jsxs)(`div`,{className:`grid gap-5 md:grid-cols-3`,children:[(0,g.jsx)(m,{title:`By OS`,subtitle:`Errors, 14d`,children:(0,g.jsx)(l,{rows:e.breakdowns.os.map(e=>({key:e.key,value:e.errors}))})}),(0,g.jsx)(m,{title:`By app version`,subtitle:`Errors, 14d`,children:(0,g.jsx)(l,{rows:e.breakdowns.appVersion.map(e=>({key:e.key,value:e.errors}))})}),(0,g.jsx)(m,{title:`By device`,subtitle:`Errors, 14d`,children:(0,g.jsx)(l,{rows:e.breakdowns.deviceModel.map(e=>({key:e.key,value:e.errors}))})})]}),(0,g.jsxs)(`p`,{className:`pb-6 text-xs text-muted`,children:[`Machine-readable: `,(0,g.jsxs)(`code`,{children:[`GET /api/summary?app=`,e.app]}),` returns this page as JSON with field descriptions.`]})]})}function v(e){return e===null?`—`:`${(Math.floor(e*1e3)/10).toFixed(1)}%`}function y(e){return e===null?``:e<.98?`text-sev-critical`:e<.995?`text-sev-high`:``}var b=[{title:`A written summary`,when:`after the first error`,detail:`How many errors in the last 24 hours, the worst part of the app, the top issue and the release that's struggling, in plain sentences.`},{title:`Issues by severity`,when:`after the first error`,detail:`Errors grouped by cause. Severity comes from how often each happened in the last 24 hours. Open one for the stack trace and the steps that led to it.`},{title:`Release health`,when:`as soon as the app starts`,detail:`Every app launch is a session. You'll see the share of sessions per version that ran without a crash or an unhandled error.`},{title:`Failing endpoints`,when:`after the first failed request`,detail:`Requests that timed out, failed or returned 5xx, captured from fetch and XHR without any code from you.`},{title:`Where the app is failing`,when:`once you tag flows`,detail:`Errors by flow, like auth.login or checkout.payment. Wrap a step in deBug.track() and each flow also gets a failure rate.`},{title:`Breakdowns`,when:`after the first error`,detail:`Errors split by OS, app version and device model, so you can see who is affected.`}];function x(){let e=n();return(0,h.useEffect)(()=>{let t=setInterval(()=>void e.invalidate(),5e3);return()=>clearInterval(t)},[e]),(0,g.jsxs)(`main`,{className:`mx-auto max-w-4xl space-y-6 px-4 py-10 sm:px-6`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-xs uppercase tracking-wide text-muted`,children:`Connected · waiting for the first event`}),(0,g.jsx)(`h1`,{className:`mt-1 text-2xl font-semibold tracking-tight`,children:`Your dashboard is ready, and empty for now.`}),(0,g.jsxs)(`p`,{className:`mt-2 max-w-2xl text-sm text-muted`,children:[`Nothing has arrived yet. Run your app with the SDK initialised, or send a test event with `,(0,g.jsx)(`code`,{children:`npx debugkit test`}),` (or `,(0,g.jsx)(`code`,{children:`npx @debugkit/cli test`}),`). This page fills in on its own.`]})]}),(0,g.jsxs)(`section`,{"aria-labelledby":`see-h`,className:`rounded-xl border border-line bg-panel p-4 sm:p-5`,children:[(0,g.jsx)(`h2`,{id:`see-h`,className:`text-sm font-semibold`,children:`What you'll see here`}),(0,g.jsx)(`ul`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:b.map(e=>(0,g.jsxs)(`li`,{className:`rounded-lg border border-line p-3`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:e.title}),(0,g.jsx)(`span`,{className:`text-[11px] uppercase tracking-wide text-muted`,children:e.when})]}),(0,g.jsx)(`p`,{className:`mt-1 text-sm text-ink/80`,children:e.detail})]},e.title))})]}),(0,g.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,g.jsxs)(`section`,{"aria-labelledby":`auto-h`,className:`rounded-xl border border-line bg-panel p-4 sm:p-5`,children:[(0,g.jsx)(`h2`,{id:`auto-h`,className:`text-sm font-semibold`,children:`Recorded automatically`}),(0,g.jsxs)(`p`,{className:`mt-1 text-xs text-muted`,children:[`Once `,(0,g.jsx)(`code`,{children:`init()`}),` runs, with no other code.`]}),(0,g.jsxs)(`ul`,{className:`mt-3 list-disc space-y-1 pl-5 text-sm`,children:[(0,g.jsx)(`li`,{children:`Crashes and unhandled promise rejections`}),(0,g.jsx)(`li`,{children:`Failed, timed-out and 5xx requests, with the code that made them`}),(0,g.jsx)(`li`,{children:`Sessions, for crash-free rates per release`}),(0,g.jsx)(`li`,{children:`Screens visited, buttons clicked, console warnings, app backgrounded or offline`}),(0,g.jsx)(`li`,{children:`Device, OS, app version and network on every event`})]})]}),(0,g.jsxs)(`section`,{"aria-labelledby":`manual-h`,className:`rounded-xl border border-line bg-panel p-4 sm:p-5`,children:[(0,g.jsx)(`h2`,{id:`manual-h`,className:`text-sm font-semibold`,children:`What you add`}),(0,g.jsx)(`p`,{className:`mt-1 text-xs text-muted`,children:`Only what the app can't know on its own.`}),(0,g.jsx)(`pre`,{className:`mt-3 overflow-x-auto rounded-md bg-panel-2 p-3 text-xs leading-relaxed`,children:`// in a try/catch you already have
|
|
2
|
-
catch (err) {
|
|
3
|
-
deBug.error(err, { flow: "checkout.payment", step: "charge" });
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
// success or failure of a step, plus the error
|
|
7
|
-
await deBug.track("auth.login", "submit_otp", () => verifyOtp(code));`})]})]})]})}export{_ as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,d as t,f as n,i as r,o as i,s as a}from"./index-D7uhDdvA.js";import{r as o}from"./ui-Bj6uJIr8.js";var s=n();function c(){let{user:n}=r.useRouteContext(),c=t();return(0,s.jsxs)(`div`,{className:`min-h-screen`,children:[(0,s.jsx)(`header`,{className:`sticky top-0 z-10 border-b border-line bg-bg/90 backdrop-blur`,children:(0,s.jsxs)(`div`,{className:`mx-auto flex max-w-7xl items-center justify-between gap-4 px-4 py-3 sm:px-6`,children:[(0,s.jsx)(e,{to:`/`,search:{},className:`shrink-0`,children:(0,s.jsx)(o,{})}),(0,s.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,s.jsx)(`span`,{className:`hidden text-muted sm:inline`,children:n.email}),(0,s.jsx)(`button`,{className:`rounded-md border border-line px-2.5 py-1 hover:bg-panel-2`,onClick:async()=>{await i(),await c.invalidate(),await c.navigate({to:`/login`})},children:`Sign out`})]})]})}),(0,s.jsx)(a,{})]})}export{c as component};
|