@debugkit/dashboard 0.4.0 → 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
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.js";
|
|
2
|
+
// ../../packages/adapters/src/rollups.ts
|
|
3
|
+
/** Merge increments with the same target so each batch does one write per row. */
|
|
4
|
+
function coalesceRollups(incs) {
|
|
5
|
+
const map = /* @__PURE__ */ new Map();
|
|
6
|
+
for (const i of incs) {
|
|
7
|
+
const id = rollupId(i);
|
|
8
|
+
const row = map.get(id) ?? {
|
|
9
|
+
app: i.app,
|
|
10
|
+
day: i.day,
|
|
11
|
+
dimension: i.dimension,
|
|
12
|
+
key: i.key,
|
|
13
|
+
errors: 0,
|
|
14
|
+
events: 0
|
|
15
|
+
};
|
|
16
|
+
if (i.kind === "error") row.errors += i.by;
|
|
17
|
+
else row.events += i.by;
|
|
18
|
+
map.set(id, row);
|
|
19
|
+
}
|
|
20
|
+
return [...map.values()];
|
|
21
|
+
}
|
|
22
|
+
var rollupId = (r) => `${r.day}__${r.dimension}__${encodeURIComponent(r.key)}`;
|
|
3
23
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
4
24
|
var util;
|
|
5
25
|
(function(util) {
|
|
@@ -3540,6 +3560,54 @@ ZodNullable.create;
|
|
|
3540
3560
|
ZodEffects.createWithPreprocess;
|
|
3541
3561
|
ZodPipeline.create;
|
|
3542
3562
|
// ../../packages/schema/src/core.ts
|
|
3563
|
+
/** "2.10.0" sorts after "2.9.1"; pre-release and build suffixes compare as text. */
|
|
3564
|
+
function compareVersions(a, b) {
|
|
3565
|
+
const pa = a.split(/[.+-]/);
|
|
3566
|
+
const pb = b.split(/[.+-]/);
|
|
3567
|
+
for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
|
|
3568
|
+
const x = pa[i] ?? "";
|
|
3569
|
+
const y = pb[i] ?? "";
|
|
3570
|
+
const d = /^\d+$/.test(x) && /^\d+$/.test(y) ? Number(x) - Number(y) : x.localeCompare(y);
|
|
3571
|
+
if (d) return d;
|
|
3572
|
+
}
|
|
3573
|
+
return 0;
|
|
3574
|
+
}
|
|
3575
|
+
/** How a release is labelled: the store version, plus the OTA update when there is one ("2.4.0+a1b2c3d"). */
|
|
3576
|
+
function releaseKey(app) {
|
|
3577
|
+
const v = app.version || "unknown";
|
|
3578
|
+
return app.update ? `${v}+${app.update.slice(0, 12)}` : v;
|
|
3579
|
+
}
|
|
3580
|
+
/** Upper bounds (ms) of the request-timing histogram buckets; one more bucket holds anything slower. */
|
|
3581
|
+
var LATENCY_BUCKETS_MS = [
|
|
3582
|
+
50,
|
|
3583
|
+
100,
|
|
3584
|
+
200,
|
|
3585
|
+
300,
|
|
3586
|
+
500,
|
|
3587
|
+
750,
|
|
3588
|
+
1e3,
|
|
3589
|
+
1500,
|
|
3590
|
+
2e3,
|
|
3591
|
+
3e3,
|
|
3592
|
+
5e3,
|
|
3593
|
+
1e4
|
|
3594
|
+
];
|
|
3595
|
+
/** The p-th percentile (0–1) from bucket counts, as the bucket's upper bound (or ">10000"). */
|
|
3596
|
+
function percentileMs(buckets, p) {
|
|
3597
|
+
const total = buckets.reduce((a, b) => a + b, 0);
|
|
3598
|
+
if (!total) return null;
|
|
3599
|
+
let seen = 0;
|
|
3600
|
+
for (let i = 0; i < buckets.length; i++) {
|
|
3601
|
+
seen += buckets[i];
|
|
3602
|
+
if (seen >= p * total) return i < LATENCY_BUCKETS_MS.length ? LATENCY_BUCKETS_MS[i] : Infinity;
|
|
3603
|
+
}
|
|
3604
|
+
return Infinity;
|
|
3605
|
+
}
|
|
3606
|
+
/** Has an issue resolved in `resolvedIn` come back in `version`? */
|
|
3607
|
+
function isRegression(resolvedIn, version, resolvedAt, ts) {
|
|
3608
|
+
if (resolvedIn && version) return compareVersions(version, resolvedIn) >= 0;
|
|
3609
|
+
return !!resolvedAt && ts > resolvedAt;
|
|
3610
|
+
}
|
|
3543
3611
|
/** Occurrences in the trailing 24h window. */
|
|
3544
3612
|
var DEFAULT_SEVERITY_THRESHOLDS = {
|
|
3545
3613
|
critical: 100,
|
|
@@ -3627,6 +3695,8 @@ var AppInfo = objectType({
|
|
|
3627
3695
|
id: stringType().min(1),
|
|
3628
3696
|
version: stringType().optional(),
|
|
3629
3697
|
build: stringType().optional(),
|
|
3698
|
+
/** Over-the-air update on top of the store version (hot-updater bundle id, expo-updates id). */
|
|
3699
|
+
update: stringType().max(100).optional(),
|
|
3630
3700
|
environment: stringType().default("production")
|
|
3631
3701
|
});
|
|
3632
3702
|
var Runtime = objectType({
|
|
@@ -3742,6 +3812,15 @@ var Event = discriminatedUnionType("type", [
|
|
|
3742
3812
|
"errored",
|
|
3743
3813
|
"crashed"
|
|
3744
3814
|
])
|
|
3815
|
+
}),
|
|
3816
|
+
EventBase.extend({
|
|
3817
|
+
type: literalType("metric"),
|
|
3818
|
+
name: literalType("http"),
|
|
3819
|
+
/** "<METHOD> <path>", as in ErrorEvent.request. */
|
|
3820
|
+
key: stringType().min(1).max(300),
|
|
3821
|
+
count: numberType().int().min(1).max(1e6),
|
|
3822
|
+
errors: numberType().int().min(0).max(1e6),
|
|
3823
|
+
buckets: arrayType(numberType().int().min(0)).length(13)
|
|
3745
3824
|
})
|
|
3746
3825
|
]);
|
|
3747
3826
|
var Envelope = objectType({
|
|
@@ -3761,514 +3840,135 @@ var Envelope = objectType({
|
|
|
3761
3840
|
}),
|
|
3762
3841
|
events: arrayType(Event).min(1).max(100)
|
|
3763
3842
|
});
|
|
3764
|
-
// src/
|
|
3765
|
-
var
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
*/
|
|
3812
|
-
async function getLocalWriteStore() {
|
|
3813
|
-
const kind = config().store;
|
|
3814
|
-
if (kind !== "demo" && kind !== "memory") return null;
|
|
3815
|
-
return await getStore();
|
|
3816
|
-
}
|
|
3817
|
-
async function create() {
|
|
3818
|
-
const cfg = config();
|
|
3819
|
-
switch (cfg.store) {
|
|
3820
|
-
case "firestore": {
|
|
3821
|
-
const { initializeApp, getApps } = await import("firebase-admin/app");
|
|
3822
|
-
const { getFirestore } = await import("firebase-admin/firestore");
|
|
3823
|
-
const { FirestoreStore } = await import("./firestore-BH-gx9no.js");
|
|
3824
|
-
if (!getApps().length) initializeApp();
|
|
3825
|
-
return new FirestoreStore(getFirestore(), { root: cfg.firestoreRoot });
|
|
3826
|
-
}
|
|
3827
|
-
case "dynamodb": {
|
|
3828
|
-
const { DynamoDBClient } = await import("@aws-sdk/client-dynamodb");
|
|
3829
|
-
const { DynamoDBDocumentClient } = await import("@aws-sdk/lib-dynamodb");
|
|
3830
|
-
const { DynamoStore } = await import("./dynamodb-DejcakaF.js");
|
|
3831
|
-
return new DynamoStore(DynamoDBDocumentClient.from(new DynamoDBClient({})), { table: cfg.dynamoTable });
|
|
3832
|
-
}
|
|
3833
|
-
case "memory": {
|
|
3834
|
-
const { MemoryStore } = await import("./memory-4DwW5cTO.js");
|
|
3835
|
-
return new MemoryStore();
|
|
3836
|
-
}
|
|
3837
|
-
default: {
|
|
3838
|
-
const { seedDemo } = await import("./demo-DTdlXNgj.js");
|
|
3839
|
-
return seedDemo();
|
|
3840
|
-
}
|
|
3841
|
-
}
|
|
3842
|
-
}
|
|
3843
|
-
// src/server/auth.ts
|
|
3844
|
-
var COOKIE = "debug_session";
|
|
3845
|
-
var MAX_AGE_S = 43200;
|
|
3846
|
-
var DEMO_USER = {
|
|
3847
|
-
email: "demo@debug.local",
|
|
3848
|
-
password: "demo-debug"
|
|
3849
|
-
};
|
|
3850
|
-
function users() {
|
|
3851
|
-
const cfg = config();
|
|
3852
|
-
const map = /* @__PURE__ */ new Map();
|
|
3853
|
-
for (const pair of cfg.users.split(",").map((s) => s.trim()).filter(Boolean)) {
|
|
3854
|
-
const i = pair.indexOf("=");
|
|
3855
|
-
if (i > 0) map.set(pair.slice(0, i).toLowerCase(), pair.slice(i + 1));
|
|
3843
|
+
// ../../packages/adapters/src/memory.ts
|
|
3844
|
+
var memory_exports = /* @__PURE__ */ __exportAll({ MemoryStore: () => MemoryStore });
|
|
3845
|
+
/** In-process store for tests and the dashboard's demo mode. */
|
|
3846
|
+
var MemoryStore = class {
|
|
3847
|
+
apps = /* @__PURE__ */ new Set();
|
|
3848
|
+
events = [];
|
|
3849
|
+
issues = /* @__PURE__ */ new Map();
|
|
3850
|
+
rollups = /* @__PURE__ */ new Map();
|
|
3851
|
+
settings = /* @__PURE__ */ new Map();
|
|
3852
|
+
/** `${app}/${scope}/${member}` → last day seen */
|
|
3853
|
+
users = /* @__PURE__ */ new Map();
|
|
3854
|
+
/** Expiry per event id (ms), mirroring what a real store would stamp. */
|
|
3855
|
+
expiry = /* @__PURE__ */ new Map();
|
|
3856
|
+
retentionDays = 30;
|
|
3857
|
+
async registerApp(app) {
|
|
3858
|
+
this.apps.add(app);
|
|
3859
|
+
}
|
|
3860
|
+
async writeEvents(events, opts = {}) {
|
|
3861
|
+
const days = opts.retentionDays ?? this.retentionDays;
|
|
3862
|
+
for (const e of events) this.expiry.set(e.event.id, Date.parse(e.receivedAt) + days * 864e5);
|
|
3863
|
+
this.events.push(...events);
|
|
3864
|
+
}
|
|
3865
|
+
async markUsers(app, marks) {
|
|
3866
|
+
for (const m of marks) {
|
|
3867
|
+
const k = `${app}/${m.scope}/${m.member}`;
|
|
3868
|
+
const cur = this.users.get(k);
|
|
3869
|
+
if (!cur || m.day > cur) this.users.set(k, m.day);
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
async countUsers(app, scope, sinceDay) {
|
|
3873
|
+
const prefix = `${app}/${scope}/`;
|
|
3874
|
+
let n = 0;
|
|
3875
|
+
for (const [k, day] of this.users) if (k.startsWith(prefix) && day >= sinceDay) n++;
|
|
3876
|
+
return n;
|
|
3877
|
+
}
|
|
3878
|
+
async setIssueStatus(app, fp, change) {
|
|
3879
|
+
const cur = this.issues.get(`${app}/${fp}`);
|
|
3880
|
+
if (!cur) return null;
|
|
3881
|
+
const next = {
|
|
3882
|
+
...cur,
|
|
3883
|
+
status: change.status,
|
|
3884
|
+
resolvedIn: change.status === "resolved" ? change.resolvedIn : void 0,
|
|
3885
|
+
resolvedAt: change.status === "resolved" ? (/* @__PURE__ */ new Date()).toISOString() : void 0,
|
|
3886
|
+
regressedAt: void 0
|
|
3887
|
+
};
|
|
3888
|
+
this.issues.set(`${app}/${fp}`, next);
|
|
3889
|
+
return next;
|
|
3856
3890
|
}
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
function demoLoginEnabled() {
|
|
3860
|
-
return config().store === "demo" && users().size === 0;
|
|
3861
|
-
}
|
|
3862
|
-
function verifyHash(password, stored) {
|
|
3863
|
-
const [algo, saltHex, hashHex] = stored.split(".");
|
|
3864
|
-
if (algo !== "scrypt" || !saltHex || !hashHex) return false;
|
|
3865
|
-
const expected = Buffer.from(hashHex, "hex");
|
|
3866
|
-
const actual = scryptSync(password, Buffer.from(saltHex, "hex"), expected.length);
|
|
3867
|
-
return timingSafeEqual(actual, expected);
|
|
3868
|
-
}
|
|
3869
|
-
function checkCredentials(email, password) {
|
|
3870
|
-
const e = email.trim().toLowerCase();
|
|
3871
|
-
if (demoLoginEnabled()) return e === DEMO_USER.email && password === DEMO_USER.password ? { email: e } : null;
|
|
3872
|
-
const stored = users().get(e);
|
|
3873
|
-
const ok = verifyHash(password, stored ?? "scrypt.00000000000000000000000000000000." + "00".repeat(64));
|
|
3874
|
-
return stored && ok ? { email: e } : null;
|
|
3875
|
-
}
|
|
3876
|
-
var sign = (payload) => createHmac("sha256", config().sessionSecret).update(payload).digest("base64url");
|
|
3877
|
-
function startSession(user) {
|
|
3878
|
-
const payload = Buffer.from(JSON.stringify({
|
|
3879
|
-
email: user.email,
|
|
3880
|
-
exp: Date.now() + MAX_AGE_S * 1e3
|
|
3881
|
-
})).toString("base64url");
|
|
3882
|
-
setCookie(COOKIE, `${payload}.${sign(payload)}`, {
|
|
3883
|
-
httpOnly: true,
|
|
3884
|
-
sameSite: "lax",
|
|
3885
|
-
secure: config().secureCookies,
|
|
3886
|
-
path: "/",
|
|
3887
|
-
maxAge: MAX_AGE_S
|
|
3888
|
-
});
|
|
3889
|
-
}
|
|
3890
|
-
function endSession() {
|
|
3891
|
-
deleteCookie(COOKIE, { path: "/" });
|
|
3892
|
-
}
|
|
3893
|
-
function readSession() {
|
|
3894
|
-
const raw = getCookie(COOKIE);
|
|
3895
|
-
if (!raw) return null;
|
|
3896
|
-
const [payload, sig] = raw.split(".");
|
|
3897
|
-
if (!payload || !sig) return null;
|
|
3898
|
-
const expected = Buffer.from(sign(payload));
|
|
3899
|
-
const given = Buffer.from(sig);
|
|
3900
|
-
if (expected.length !== given.length || !timingSafeEqual(expected, given)) return null;
|
|
3901
|
-
try {
|
|
3902
|
-
const data = JSON.parse(Buffer.from(payload, "base64url").toString());
|
|
3903
|
-
if (Date.now() > data.exp) return null;
|
|
3904
|
-
return { email: data.email };
|
|
3905
|
-
} catch {
|
|
3906
|
-
return null;
|
|
3891
|
+
async getSettings(app) {
|
|
3892
|
+
return this.settings.get(app) ?? null;
|
|
3907
3893
|
}
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
var hourKey = (t) => new Date(t).toISOString().slice(0, 13);
|
|
3924
|
-
function days(now, n) {
|
|
3925
|
-
return Array.from({ length: n }, (_, i) => dayKey(now - (n - 1 - i) * DAY));
|
|
3926
|
-
}
|
|
3927
|
-
function hours(now, n) {
|
|
3928
|
-
return Array.from({ length: n }, (_, i) => hourKey(now - (n - 1 - i) * HOUR));
|
|
3929
|
-
}
|
|
3930
|
-
/** Description of every field, shipped with the JSON API so agents can interpret it without docs. */
|
|
3931
|
-
var SUMMARY_FIELDS = {
|
|
3932
|
-
"totals.errors24h": "Error events in the trailing 24 hours (exact, from hourly rollups).",
|
|
3933
|
-
"totals.changePct": "Percent change of errors vs the previous 24h window.",
|
|
3934
|
-
"totals.activeIssues": "Distinct grouped errors (issues) seen in the last 14 days.",
|
|
3935
|
-
"totals.criticalIssues": "Issues whose 24h occurrence count meets the critical threshold.",
|
|
3936
|
-
"flows[]": "Parts of the app as tagged by the developer (e.g. auth.login). Sorted by severity, then errors24h.",
|
|
3937
|
-
"flows[].failureRate": "failures/(failures+successes) from events logged with an outcome. null when the app logs no outcomes for that flow.",
|
|
3938
|
-
"issues[]": "Grouped errors. Sorted by severity, then count24h.",
|
|
3939
|
-
"issues[].severity": "Derived from count24h using thresholds critical/high/medium.",
|
|
3940
|
-
"issues[].culprit": "Top in-app stack frame: function (file:line).",
|
|
3941
|
-
"trend[]": "Errors and non-error events per UTC day for the last 14 days.",
|
|
3942
|
-
"breakdowns": "Errors over the last 14 days split by OS, app version and device model.",
|
|
3943
|
-
narrative: "Plain-language summary of what is going wrong right now.",
|
|
3944
|
-
"health.crashFreeRate": "Share of sessions in 14 days with no fatal crash. Sessions are recorded automatically by the SDK.",
|
|
3945
|
-
"health.errorFreeRate": "Share of sessions in 14 days with no unhandled error.",
|
|
3946
|
-
"health.releases[]": "Crash-free and error-free rates per app version.",
|
|
3947
|
-
"health.endpoints[]": "HTTP endpoints whose requests failed most (5xx, timeouts, network errors), from automatic network capture."
|
|
3948
|
-
};
|
|
3949
|
-
async function counts24hByIssue(store, app, now) {
|
|
3950
|
-
const hs = hours(now, 24);
|
|
3951
|
-
const rows = await store.getRollups(app, "issueHour", hs[0], hs[hs.length - 1]);
|
|
3952
|
-
const map = /* @__PURE__ */ new Map();
|
|
3953
|
-
for (const r of rows) map.set(r.key, (map.get(r.key) ?? 0) + r.errors);
|
|
3954
|
-
return map;
|
|
3955
|
-
}
|
|
3956
|
-
async function buildSummary(store, appParam, thresholds, now = Date.now()) {
|
|
3957
|
-
const apps = await store.listApps();
|
|
3958
|
-
const app = appParam && apps.includes(appParam) ? appParam : apps[0];
|
|
3959
|
-
if (!app) return null;
|
|
3960
|
-
const d14 = days(now, 14);
|
|
3961
|
-
const from = d14[0];
|
|
3962
|
-
const to = d14[d14.length - 1];
|
|
3963
|
-
const [sessionRows, endpointRows, total, flowRows, outcomeRows, os, appVersion, deviceModel, issues, issue24h, hourly] = await Promise.all([
|
|
3964
|
-
store.getRollups(app, "session", from, to),
|
|
3965
|
-
store.getRollups(app, "endpoint", from, to),
|
|
3966
|
-
store.getRollups(app, "total", from, to),
|
|
3967
|
-
store.getRollups(app, "flow", from, to),
|
|
3968
|
-
store.getRollups(app, "flowOutcome", from, to),
|
|
3969
|
-
store.getRollups(app, "os", from, to),
|
|
3970
|
-
store.getRollups(app, "appVersion", from, to),
|
|
3971
|
-
store.getRollups(app, "deviceModel", from, to),
|
|
3972
|
-
store.listIssues(app, { limit: 500 }),
|
|
3973
|
-
counts24hByIssue(store, app, now),
|
|
3974
|
-
store.getRollups(app, "issueHour", hours(now, 48)[0], hourKey(now))
|
|
3975
|
-
]);
|
|
3976
|
-
const trend = d14.map((day) => {
|
|
3977
|
-
const r = total.find((x) => x.day === day);
|
|
3894
|
+
async putSettings(app, s) {
|
|
3895
|
+
const next = {
|
|
3896
|
+
...this.settings.get(app),
|
|
3897
|
+
...s,
|
|
3898
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3899
|
+
};
|
|
3900
|
+
this.settings.set(app, next);
|
|
3901
|
+
return next;
|
|
3902
|
+
}
|
|
3903
|
+
async restampExpiry(app, retentionDays, { cursor, limit = 500 } = {}) {
|
|
3904
|
+
const mine = this.events.filter((e) => e.app === app);
|
|
3905
|
+
const start = cursor ? Number(cursor) : 0;
|
|
3906
|
+
const page = mine.slice(start, start + limit);
|
|
3907
|
+
for (const e of page) this.expiry.set(e.event.id, Date.parse(e.receivedAt) + retentionDays * 864e5);
|
|
3908
|
+
const next = start + page.length;
|
|
3978
3909
|
return {
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
events: r?.events ?? 0
|
|
3910
|
+
updated: page.length,
|
|
3911
|
+
cursor: next < mine.length ? String(next) : void 0
|
|
3982
3912
|
};
|
|
3983
|
-
});
|
|
3984
|
-
const h24 = new Set(hours(now, 24));
|
|
3985
|
-
let errors24h = 0;
|
|
3986
|
-
let errorsPrev24h = 0;
|
|
3987
|
-
for (const r of hourly) h24.has(r.day) ? errors24h += r.errors : errorsPrev24h += r.errors;
|
|
3988
|
-
const since14 = (/* @__PURE__ */ new Date(now - 14 * DAY)).toISOString();
|
|
3989
|
-
const issueRows = issues.filter((i) => i.lastSeen >= since14).map((i) => toIssueRow(i, issue24h.get(i.fingerprint) ?? 0, thresholds)).sort(bySeverityThenCount);
|
|
3990
|
-
const flowMap = /* @__PURE__ */ new Map();
|
|
3991
|
-
const flowOf = (flow) => {
|
|
3992
|
-
let f = flowMap.get(flow);
|
|
3993
|
-
if (!f) flowMap.set(flow, f = {
|
|
3994
|
-
flow,
|
|
3995
|
-
errors24h: 0,
|
|
3996
|
-
errors14d: 0,
|
|
3997
|
-
severity: "low",
|
|
3998
|
-
issues: 0,
|
|
3999
|
-
successes14d: 0,
|
|
4000
|
-
failures14d: 0,
|
|
4001
|
-
failureRate: null
|
|
4002
|
-
});
|
|
4003
|
-
return f;
|
|
4004
|
-
};
|
|
4005
|
-
for (const r of flowRows) if (r.errors > 0) flowOf(r.key).errors14d += r.errors;
|
|
4006
|
-
for (const i of issueRows) {
|
|
4007
|
-
const f = flowOf(i.flow ?? "untagged");
|
|
4008
|
-
f.issues++;
|
|
4009
|
-
f.errors24h += i.count24h;
|
|
4010
|
-
if (SEVERITY_ORDER[i.severity] > SEVERITY_ORDER[f.severity]) f.severity = i.severity;
|
|
4011
|
-
}
|
|
4012
|
-
for (const r of outcomeRows) {
|
|
4013
|
-
const [flow, outcome] = r.key.split("|");
|
|
4014
|
-
const f = flowOf(flow);
|
|
4015
|
-
if (outcome === "success") f.successes14d += r.events;
|
|
4016
|
-
else if (outcome === "failure") f.failures14d += r.events;
|
|
4017
|
-
}
|
|
4018
|
-
const flows = [...flowMap.values()].map((f) => ({
|
|
4019
|
-
...f,
|
|
4020
|
-
failureRate: f.successes14d + f.failures14d > 0 ? f.failures14d / (f.successes14d + f.failures14d) : null
|
|
4021
|
-
})).filter((f) => f.errors14d > 0 || f.failures14d > 0).sort((a, b) => SEVERITY_ORDER[b.severity] - SEVERITY_ORDER[a.severity] || b.errors24h - a.errors24h || b.errors14d - a.errors14d);
|
|
4022
|
-
const top = (rows) => {
|
|
4023
|
-
const m = /* @__PURE__ */ new Map();
|
|
4024
|
-
for (const r of rows) m.set(r.key, (m.get(r.key) ?? 0) + r.errors);
|
|
4025
|
-
return [...m.entries()].map(([key, errors]) => ({
|
|
4026
|
-
key,
|
|
4027
|
-
errors
|
|
4028
|
-
})).filter((r) => r.errors > 0).sort((a, b) => b.errors - a.errors).slice(0, 8);
|
|
4029
|
-
};
|
|
4030
|
-
const summary = {
|
|
4031
|
-
app,
|
|
4032
|
-
apps,
|
|
4033
|
-
generatedAt: new Date(now).toISOString(),
|
|
4034
|
-
totals: {
|
|
4035
|
-
errors24h,
|
|
4036
|
-
errorsPrev24h,
|
|
4037
|
-
changePct: errorsPrev24h > 0 ? Math.round((errors24h - errorsPrev24h) / errorsPrev24h * 100) : null,
|
|
4038
|
-
events14d: trend.reduce((a, d) => a + d.events, 0),
|
|
4039
|
-
activeIssues: issueRows.length,
|
|
4040
|
-
criticalIssues: issueRows.filter((i) => i.severity === "critical").length,
|
|
4041
|
-
failingFlows: flows.filter((f) => f.errors24h > 0).length
|
|
4042
|
-
},
|
|
4043
|
-
narrative: [],
|
|
4044
|
-
trend,
|
|
4045
|
-
flows,
|
|
4046
|
-
issues: issueRows,
|
|
4047
|
-
breakdowns: {
|
|
4048
|
-
os: top(os),
|
|
4049
|
-
appVersion: top(appVersion),
|
|
4050
|
-
deviceModel: top(deviceModel)
|
|
4051
|
-
},
|
|
4052
|
-
health: buildHealth(sessionRows, endpointRows, dayKey(now))
|
|
4053
|
-
};
|
|
4054
|
-
summary.narrative = narrate(summary);
|
|
4055
|
-
return summary;
|
|
4056
|
-
}
|
|
4057
|
-
var rate = (bad, total) => total > 0 ? Math.max(0, 1 - bad / total) : null;
|
|
4058
|
-
/** "2.10.0" sorts after "2.9.1". */
|
|
4059
|
-
function compareVersions(a, b) {
|
|
4060
|
-
const pa = a.split(/[.-]/);
|
|
4061
|
-
const pb = b.split(/[.-]/);
|
|
4062
|
-
for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
|
|
4063
|
-
const x = pa[i] ?? "";
|
|
4064
|
-
const y = pb[i] ?? "";
|
|
4065
|
-
const d = /^\d+$/.test(x) && /^\d+$/.test(y) ? Number(x) - Number(y) : x.localeCompare(y);
|
|
4066
|
-
if (d) return d;
|
|
4067
3913
|
}
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
const
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
version,
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
});
|
|
4101
|
-
e.failures14d += r.errors;
|
|
4102
|
-
if (r.day === today) e.failures24h += r.errors;
|
|
3914
|
+
async upsertIssues(updates) {
|
|
3915
|
+
const outcome = {
|
|
3916
|
+
created: [],
|
|
3917
|
+
regressed: []
|
|
3918
|
+
};
|
|
3919
|
+
for (const u of updates) {
|
|
3920
|
+
const k = `${u.app}/${u.fingerprint}`;
|
|
3921
|
+
const cur = this.issues.get(k);
|
|
3922
|
+
const regressed = cur?.status === "resolved" && isRegression(cur.resolvedIn, u.version, cur.resolvedAt, u.ts);
|
|
3923
|
+
const newer = !cur || u.ts >= cur.lastSeen;
|
|
3924
|
+
if (!cur) outcome.created.push(u.fingerprint);
|
|
3925
|
+
if (regressed) outcome.regressed.push(u.fingerprint);
|
|
3926
|
+
this.issues.set(k, {
|
|
3927
|
+
...cur,
|
|
3928
|
+
...regressed ? {
|
|
3929
|
+
status: "regressed",
|
|
3930
|
+
regressedAt: u.ts
|
|
3931
|
+
} : {},
|
|
3932
|
+
firstVersion: cur?.firstVersion ?? u.version,
|
|
3933
|
+
lastVersion: newer ? u.version ?? cur?.lastVersion : cur?.lastVersion,
|
|
3934
|
+
app: u.app,
|
|
3935
|
+
fingerprint: u.fingerprint,
|
|
3936
|
+
title: u.title,
|
|
3937
|
+
culprit: u.culprit,
|
|
3938
|
+
flow: u.flow,
|
|
3939
|
+
firstSeen: cur && cur.firstSeen < u.firstTs ? cur.firstSeen : u.firstTs,
|
|
3940
|
+
lastSeen: cur && cur.lastSeen > u.ts ? cur.lastSeen : u.ts,
|
|
3941
|
+
count: (cur?.count ?? 0) + u.by,
|
|
3942
|
+
lastEvent: cur && cur.lastSeen > u.ts ? cur.lastEvent : u.lastEvent
|
|
3943
|
+
});
|
|
3944
|
+
}
|
|
3945
|
+
return outcome;
|
|
4103
3946
|
}
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
return {
|
|
4114
|
-
fingerprint: i.fingerprint,
|
|
4115
|
-
title: i.title,
|
|
4116
|
-
culprit: i.culprit,
|
|
4117
|
-
flow: i.flow,
|
|
4118
|
-
severity: severityFromCount(count24h, t),
|
|
4119
|
-
count24h,
|
|
4120
|
-
countTotal: i.count,
|
|
4121
|
-
firstSeen: i.firstSeen,
|
|
4122
|
-
lastSeen: i.lastSeen
|
|
4123
|
-
};
|
|
4124
|
-
}
|
|
4125
|
-
var bySeverityThenCount = (a, b) => SEVERITY_ORDER[b.severity] - SEVERITY_ORDER[a.severity] || b.count24h - a.count24h || b.lastSeen.localeCompare(a.lastSeen);
|
|
4126
|
-
var pct = (n) => `${Math.round(n * 100)}%`;
|
|
4127
|
-
var pctOne = (n) => `${(Math.floor(n * 1e3) / 10).toFixed(1)}%`;
|
|
4128
|
-
function narrate(s) {
|
|
4129
|
-
const out = [];
|
|
4130
|
-
const t = s.totals;
|
|
4131
|
-
if (t.errors24h === 0) {
|
|
4132
|
-
out.push("No errors in the last 24 hours.");
|
|
4133
|
-
return out;
|
|
4134
|
-
}
|
|
4135
|
-
const change = t.changePct === null ? "" : t.changePct === 0 ? ", flat versus the day before" : `, ${t.changePct > 0 ? "up" : "down"} ${Math.abs(t.changePct)}% on the previous 24h`;
|
|
4136
|
-
out.push(`${t.errors24h.toLocaleString()} errors in the last 24 hours${change}, across ${t.failingFlows} part${t.failingFlows === 1 ? "" : "s"} of the app.`);
|
|
4137
|
-
const f = s.flows[0];
|
|
4138
|
-
if (f && f.errors24h > 0) {
|
|
4139
|
-
const rate = f.failureRate !== null ? ` ${pct(f.failureRate)} of attempts fail.` : "";
|
|
4140
|
-
out.push(`${f.flow} is the most affected flow (${f.severity}): ${f.errors24h} errors in 24h from ${f.issues} issue${f.issues === 1 ? "" : "s"}.${rate}`);
|
|
4141
|
-
}
|
|
4142
|
-
const i = s.issues[0];
|
|
4143
|
-
if (i && i.count24h > 0) {
|
|
4144
|
-
const isNew = Date.parse(s.generatedAt) - Date.parse(i.firstSeen) < 3 * DAY;
|
|
4145
|
-
out.push(`Top issue: "${i.title}"${i.culprit ? ` in ${i.culprit}` : ""} — ${i.count24h} time${i.count24h === 1 ? "" : "s"} in 24h${isNew ? `, first seen ${relDays(s.generatedAt, i.firstSeen)}` : ""}.`);
|
|
4146
|
-
}
|
|
4147
|
-
const h = s.health;
|
|
4148
|
-
const latest = h.releases[0];
|
|
4149
|
-
const prev = h.releases[1];
|
|
4150
|
-
if (latest?.crashFreeRate != null && latest.sessions >= 20 && latest.crashFreeRate < .995) {
|
|
4151
|
-
const vs = prev?.crashFreeRate != null && prev.sessions >= 20 ? ` (${prev.version}: ${pctOne(prev.crashFreeRate)})` : "";
|
|
4152
|
-
out.push(`${latest.version} is ${pctOne(latest.crashFreeRate)} crash-free across ${latest.sessions.toLocaleString()} sessions${vs}.`);
|
|
4153
|
-
}
|
|
4154
|
-
const ep = h.endpoints[0];
|
|
4155
|
-
if (ep && ep.failures24h > 0) out.push(`${ep.endpoint} is the most failing endpoint: ${ep.failures24h} failed request${ep.failures24h === 1 ? "" : "s"} today.`);
|
|
4156
|
-
const os = s.breakdowns.os;
|
|
4157
|
-
const osTotal = os.reduce((a, b) => a + b.errors, 0);
|
|
4158
|
-
if (os[0] && osTotal > 20 && os[0].errors / osTotal > .6) out.push(`${pct(os[0].errors / osTotal)} of errors in the last 14 days come from ${os[0].key}.`);
|
|
4159
|
-
return out;
|
|
4160
|
-
}
|
|
4161
|
-
function relDays(now, then) {
|
|
4162
|
-
const d = Math.floor((Date.parse(now) - Date.parse(then)) / DAY);
|
|
4163
|
-
return d === 0 ? "today" : d === 1 ? "yesterday" : `${d} days ago`;
|
|
4164
|
-
}
|
|
4165
|
-
async function buildIssueDetail(store, app, fingerprint, thresholds, now = Date.now()) {
|
|
4166
|
-
const issue = await store.getIssue(app, fingerprint);
|
|
4167
|
-
if (!issue) return null;
|
|
4168
|
-
const hs = hours(now, 48);
|
|
4169
|
-
const d14 = days(now, 14);
|
|
4170
|
-
const [hourRows, dayRows, events] = await Promise.all([
|
|
4171
|
-
store.getRollups(app, "issueHour", hs[0], hs[hs.length - 1]),
|
|
4172
|
-
store.getRollups(app, "issue", d14[0], d14[d14.length - 1]),
|
|
4173
|
-
store.listIssueEvents(app, fingerprint, { limit: 200 })
|
|
4174
|
-
]);
|
|
4175
|
-
const hourly = hs.map((hour) => ({
|
|
4176
|
-
hour,
|
|
4177
|
-
count: hourRows.filter((r) => r.key === fingerprint && r.day === hour).reduce((a, r) => a + r.errors, 0)
|
|
4178
|
-
}));
|
|
4179
|
-
const daily = d14.map((day) => ({
|
|
4180
|
-
day,
|
|
4181
|
-
count: dayRows.filter((r) => r.key === fingerprint && r.day === day).reduce((a, r) => a + r.errors, 0)
|
|
4182
|
-
}));
|
|
4183
|
-
const count24h = hourly.slice(-24).reduce((a, h) => a + h.count, 0);
|
|
4184
|
-
const split = (pick) => {
|
|
4185
|
-
const m = /* @__PURE__ */ new Map();
|
|
4186
|
-
for (const e of events) {
|
|
4187
|
-
const k = pick(e) || "unknown";
|
|
4188
|
-
m.set(k, (m.get(k) ?? 0) + 1);
|
|
3947
|
+
async incrementRollups(incs) {
|
|
3948
|
+
for (const r of coalesceRollups(incs)) {
|
|
3949
|
+
const k = `${r.app}/${rollupId(r)}`;
|
|
3950
|
+
const cur = this.rollups.get(k);
|
|
3951
|
+
this.rollups.set(k, cur ? {
|
|
3952
|
+
...cur,
|
|
3953
|
+
errors: cur.errors + r.errors,
|
|
3954
|
+
events: cur.events + r.events
|
|
3955
|
+
} : r);
|
|
4189
3956
|
}
|
|
4190
|
-
return [...m.entries()].map(([key, count]) => ({
|
|
4191
|
-
key,
|
|
4192
|
-
count,
|
|
4193
|
-
share: events.length ? count / events.length : 0
|
|
4194
|
-
})).sort((a, b) => b.count - a.count).slice(0, 6);
|
|
4195
|
-
};
|
|
4196
|
-
const breakdowns = {
|
|
4197
|
-
os: split((e) => `${e.context.os.name} ${e.context.os.version ?? ""}`.trim()),
|
|
4198
|
-
appVersion: split((e) => e.context.app.version),
|
|
4199
|
-
deviceModel: split((e) => e.context.device.model),
|
|
4200
|
-
network: split((e) => e.context.network?.type),
|
|
4201
|
-
runtime: split((e) => [e.context.runtime.name, e.context.runtime.engine].filter(Boolean).join(" / "))
|
|
4202
|
-
};
|
|
4203
|
-
const users = new Set(events.map((e) => e.user?.id ?? e.user?.anonymousId ?? e.sessionId));
|
|
4204
|
-
return {
|
|
4205
|
-
app,
|
|
4206
|
-
issue: toIssueRow(issue, count24h, thresholds),
|
|
4207
|
-
hourly,
|
|
4208
|
-
daily,
|
|
4209
|
-
breakdowns,
|
|
4210
|
-
affectedUsers: users.size,
|
|
4211
|
-
sample: events[0] ?? issue.lastEvent ?? null,
|
|
4212
|
-
recent: events.slice(0, 25).map((e) => ({
|
|
4213
|
-
ts: e.event.ts,
|
|
4214
|
-
os: `${e.context.os.name} ${e.context.os.version ?? ""}`.trim(),
|
|
4215
|
-
appVersion: e.context.app.version,
|
|
4216
|
-
device: e.context.device.model,
|
|
4217
|
-
message: e.event.type === "error" ? e.event.error.message : e.event.type === "event" ? e.event.name : `session ${e.event.status}`,
|
|
4218
|
-
userId: e.user?.id
|
|
4219
|
-
})),
|
|
4220
|
-
hints: hintsFor(issue, breakdowns, events)
|
|
4221
|
-
};
|
|
4222
|
-
}
|
|
4223
|
-
/** Rule-based "what to look at" hints. Phase 2 replaces/augments these with an LLM over the same data. */
|
|
4224
|
-
function hintsFor(issue, b, events) {
|
|
4225
|
-
const hints = [];
|
|
4226
|
-
const text = `${issue.title} ${events[0]?.event.type === "error" ? events[0].event.error.stack ?? "" : ""}`.toLowerCase();
|
|
4227
|
-
const crumbs = events.flatMap((e) => e.event.type === "error" ? e.event.breadcrumbs ?? [] : []);
|
|
4228
|
-
const concentrated = (label, rows) => {
|
|
4229
|
-
const r = rows[0];
|
|
4230
|
-
if (r && r.key !== "unknown" && r.share >= .8 && events.length >= 5 && rows.length >= 1) hints.push({
|
|
4231
|
-
title: `Concentrated on ${label} ${r.key}`,
|
|
4232
|
-
detail: `${Math.round(r.share * 100)}% of recent occurrences. Reproduce on ${r.key} first, and check what changed for it.`
|
|
4233
|
-
});
|
|
4234
|
-
};
|
|
4235
|
-
concentrated("app version", b.appVersion);
|
|
4236
|
-
concentrated("OS", b.os);
|
|
4237
|
-
concentrated("device", b.deviceModel);
|
|
4238
|
-
if (/cannot read propert|undefined is not an object|of undefined|of null|is not a function/.test(text)) hints.push({
|
|
4239
|
-
title: "A value is missing when the code expects it",
|
|
4240
|
-
detail: `Something is null/undefined at ${issue.culprit ?? "the top frame"}. Check the data the previous step returns (API response shape, async state not yet loaded) and add a guard or loading state.`
|
|
4241
|
-
});
|
|
4242
|
-
if (/network request failed|failed to fetch|networkerror|timeout|timed out|econn|socket/.test(text)) hints.push({
|
|
4243
|
-
title: "Network failure",
|
|
4244
|
-
detail: "Check if errors line up with poor connectivity (see the network breakdown), add retries with backoff, and show an offline/timeout state instead of failing."
|
|
4245
|
-
});
|
|
4246
|
-
if (/\b401\b|\b403\b|unauthori[sz]ed|forbidden|token expired|jwt/.test(text)) hints.push({
|
|
4247
|
-
title: "Auth/session problem",
|
|
4248
|
-
detail: "Look for expired or missing tokens. Confirm the token refresh runs before this call, and that the clock/expiry handling is right."
|
|
4249
|
-
});
|
|
4250
|
-
if (/json|unexpected token|syntaxerror/.test(text)) hints.push({
|
|
4251
|
-
title: "Bad response body",
|
|
4252
|
-
detail: "The app tried to parse something that isn't the JSON it expected — often an HTML error page or an empty 204/5xx. Log the status and content-type before parsing."
|
|
4253
|
-
});
|
|
4254
|
-
if (/\b5\d\d\b|internal server error|bad gateway|service unavailable/.test(text)) hints.push({
|
|
4255
|
-
title: "Server-side failure",
|
|
4256
|
-
detail: "The backend returned a 5xx. Correlate the timestamps with your API logs."
|
|
4257
|
-
});
|
|
4258
|
-
const failingRequests = crumbs.filter((c) => c.category === "network" && (c.level === "error" || /\b[45]\d\d\b/.test(c.message)));
|
|
4259
|
-
if (failingRequests.length) {
|
|
4260
|
-
const m = /* @__PURE__ */ new Map();
|
|
4261
|
-
for (const c of failingRequests) m.set(c.message, (m.get(c.message) ?? 0) + 1);
|
|
4262
|
-
const [msg] = [...m.entries()].sort((a, b) => b[1] - a[1])[0];
|
|
4263
|
-
hints.push({
|
|
4264
|
-
title: "A request fails right before the error",
|
|
4265
|
-
detail: `Most common: ${msg}`
|
|
4266
|
-
});
|
|
4267
3957
|
}
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
})
|
|
4272
|
-
|
|
4273
|
-
}
|
|
4274
|
-
|
|
3958
|
+
async listApps() {
|
|
3959
|
+
return [...this.apps].sort();
|
|
3960
|
+
}
|
|
3961
|
+
async listIssues(app, { limit = 200 } = {}) {
|
|
3962
|
+
return [...this.issues.values()].filter((i) => i.app === app).sort((a, b) => b.lastSeen.localeCompare(a.lastSeen)).slice(0, limit);
|
|
3963
|
+
}
|
|
3964
|
+
async getIssue(app, fp) {
|
|
3965
|
+
return this.issues.get(`${app}/${fp}`) ?? null;
|
|
3966
|
+
}
|
|
3967
|
+
async getRollups(app, dimension, fromDay, toDay) {
|
|
3968
|
+
return [...this.rollups.values()].filter((r) => r.app === app && r.dimension === dimension && r.day >= fromDay && r.day <= toDay);
|
|
3969
|
+
}
|
|
3970
|
+
async listIssueEvents(app, fp, { limit = 50 } = {}) {
|
|
3971
|
+
return this.events.filter((e) => e.app === app && e.fingerprint === fp).sort((a, b) => b.event.ts.localeCompare(a.event.ts)).slice(0, limit);
|
|
3972
|
+
}
|
|
3973
|
+
};
|
|
3974
|
+
export { SEVERITY_ORDER as a, parseStack as c, severityFromCount as d, coalesceRollups as f, DEFAULT_SEVERITY_THRESHOLDS as i, percentileMs as l, memory_exports as n, compareVersions as o, rollupId as p, Envelope as r, isRegression as s, MemoryStore as t, releaseKey as u };
|