mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-12-02 17:13:33 +01:00
fix(admin): group errors by code and service, list the routes that failed
- An issue is now one error code (or exception type) per service: one cause,
such as a rate-limit burst, hits many routes. Rows show the most frequent
route and "+N routes"; the issue page lists them with a count and a bar.
- The request header shows the viewer as a role ("Viewer: owner", "Viewer not
signed in") beside the owner chip, with a user link only for another user.
- List meta parts no longer leave a lone separator when they wrap.
- The issue page shows the 10 latest occurrences and a "Show all" button
instead of clipping the list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c91e662034
commit
d3860f29ad
11 files changed
+136
-65
No files matched your search
@@ -74,7 +74,8 @@ export function issueTitle(row: Row) {
|
||||
}
|
||||
|
||||
export function issueId(row: Row) {
|
||||
return createHash("sha256").update(JSON.stringify([codeOf(row), String(row.service || ""), String(row.route || row.queue || "")])).digest("hex").slice(0, 16);
|
||||
// One cause (a GitHub limit, an outage) hits many routes: routes are listed inside the issue.
|
||||
return createHash("sha256").update(JSON.stringify([codeOf(row), String(row.service || "")])).digest("hex").slice(0, 16);
|
||||
}
|
||||
|
||||
const time = (row: Row) => Date.parse(String(row.timestamp));
|
||||
@@ -208,12 +209,21 @@ export function buildIssues(rows: Row[], options: IssueOptions) {
|
||||
const users = countBy(sorted, "userId", validUserId);
|
||||
const viewers = { signedIn: 0, visitors: 0, notRecorded: 0 };
|
||||
for (const row of sorted) viewers[SIGNED_IN.has(String(row.viewer)) ? "signedIn" : row.viewer ? "visitors" : "notRecorded"]++;
|
||||
const routes = new Set(sorted.map(row => row.route).filter(Boolean));
|
||||
const routeCounts = new Map<string, { route: string; method: string; count: number; last: string }>();
|
||||
for (const row of sorted) {
|
||||
const route = String(row.route || (row.queue ? `job ${row.queue}` : ""));
|
||||
if (!route) continue;
|
||||
const key = `${row.method || ""} ${route}`;
|
||||
const entry = routeCounts.get(key) || { route, method: String(row.method || ""), count: 0, last: String(row.timestamp) };
|
||||
entry.count++; routeCounts.set(key, entry);
|
||||
}
|
||||
const routes = [...routeCounts.values()].sort((a, b) => b.count - a.count || Date.parse(b.last) - Date.parse(a.last));
|
||||
const top = routes[0];
|
||||
return {
|
||||
id, title: issueTitle(sample), code: codeOf(sample), errorCode: sample.errorCode || null, errorType: sample.errorType || null,
|
||||
status: statusOf(sample) || null, service: sample.service || null, route: sample.route || null, method: sample.method || null,
|
||||
status: statusOf(sample) || null, service: sample.service || null, route: top && !top.route.startsWith("job ") ? top.route : null, method: top?.method || sample.method || null,
|
||||
queue: sample.queue || null, event: sample.event, severity: sample.severity,
|
||||
count: sorted.length, requests: requests.size, jobs: jobs.size, routeKnown: sorted.filter(row => row.route).length, routes: routes.size,
|
||||
count: sorted.length, requests: requests.size, jobs: jobs.size, routeKnown: sorted.filter(row => row.route).length, routeCount: routes.length, routes: routes.slice(0, 20),
|
||||
repoCount: repos.length, repos: repos.slice(0, 50), userCount: users.length, users: users.slice(0, 50), viewers,
|
||||
first: new Date(group.first).toISOString(), last: new Date(group.last).toISOString(),
|
||||
firstRelease: firstRow.release && firstRow.release !== "unknown" ? firstRow.release : null,
|
||||
|
||||
Reference in new issue
Block a user