mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-12-02 17:13:33 +01:00
feat(admin): errors page built around issues, linked to repositories and users
The admin Errors page now shows one list of issues: records grouped by error code (or exception type), service and route, each with a plain-language title, a likely cause, its impact (failures, repositories, users), a trend and when it was last seen. Expected 4xx answers sit in a collapsed group; slow and interrupted requests are left out and counted, with a link to Performance. - GET /api/admin/errors/issues groups server-side (admin-error-issues.ts). It reads central logs when they answer and the Redis history otherwise, accepts validated repoId/userId/service/window filters and resolves repository owners and user names when the database is connected. - The cause is derived from external_request records of the same requests (#990 field names), fast 429s, storage and network codes, and the first application stack frame; otherwise it says nothing is known. - Issue page (?issue=) with cause, affected repositories and owners, who hit it, failures over time and occurrences. Request view (&occurrence=) with a waterfall from the existing correlation lookup and Request, Exception and All fields tabs; missing data shows as "not recorded". - Repositories (search = one repoId) and user admin pages list their issues, with a "failing now" banner. - The source switch, export, clear history, telemetry and 24-hour counters move to a collapsed "Settings and diagnostics" section. - Synthetic fixtures shared by dev-mock and preview-errors; old errors-page CSS removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c281841f91
commit
2abd6beaa9
21 files changed
+2053
-2323
No files matched your search
@@ -7,7 +7,8 @@ const { execFileSync } = require('node:child_process');
|
||||
const { randomUUID } = require('node:crypto');
|
||||
const fs = require('node:fs');
|
||||
const assert = require('node:assert/strict');
|
||||
const { investigateLogs, logOptions } = require('../src/server/admin-log-investigation');
|
||||
const { investigateLogs, logOptions, issueRecords } = require('../src/server/admin-log-investigation');
|
||||
const { buildIssues } = require('../src/server/admin-error-issues');
|
||||
const name = 'admin-logs-test-' + randomUUID().slice(0,8);
|
||||
const image = fs.readFileSync('deploy/logging/compose.yml','utf8').match(/image: (victoriametrics\/victoria-logs:[^\s]+)/)[1];
|
||||
const docker = (...args) => execFileSync('docker', args, {encoding:'utf8',stdio:['ignore','pipe','pipe']}).trim();
|
||||
@@ -32,6 +33,18 @@ const sleep = ms => new Promise(resolve=>setTimeout(resolve,ms));
|
||||
const timeline=await investigateLogs(logOptions({kind:'jobId',id:jobId},true),true);
|
||||
assert.equal(timeline.state,'ready'); assert.deepEqual([...new Set(timeline.events.map(row=>row.service))].sort(),['api','streamer','worker']);
|
||||
console.log('PASS real filtered grouping, privacy projection and job→request cross-service correlation');
|
||||
// Issue list queries: identity filter, failed external calls and the slow/interrupted counts are valid LogsQL.
|
||||
const issueId=randomUUID(), now=Date.now();
|
||||
const issueRows=[{timestamp:new Date(now-3000).toISOString(),severity:'error',service:'api',event:'application_log',module:'route',errorCode:'upstream_error',status:502,release:'fedcba9',requestId:issueId,repoId:'issue-repo',route:'/api/repo/:repoId/file/:path'},
|
||||
{timestamp:new Date(now-3100).toISOString(),severity:'info',service:'api',event:'external_request',module:'external-request',requestId:issueId,upstreamHost:'api.github.com',upstreamStatus:502,ms:600,release:'fedcba9'},
|
||||
{timestamp:new Date(now-3200).toISOString(),severity:'warn',service:'api',event:'request_slow',module:'requests',status:200,requestId:randomUUID(),repoId:'issue-repo',release:'fedcba9'},
|
||||
{timestamp:new Date(now-3300).toISOString(),severity:'info',service:'api',event:'application_log',module:'route',errorCode:'file_not_found',status:404,repoId:'issue-repo',release:'fedcba9'}];
|
||||
assert((await fetch(process.env.ADMIN_LOG_URL+'/insert/jsonline?_time_field=timestamp',{method:'POST',body:issueRows.map(JSON.stringify).join('\n'),headers:{'Content-Type':'application/stream+json'}})).ok); await sleep(2000);
|
||||
const issueSource=await issueRecords({window:'1h',start:new Date(now-3600000).toISOString(),end:new Date().toISOString(),service:'',repoId:'issue-repo',userId:''});
|
||||
assert.equal(issueSource.state,'ready'); assert.deepEqual(issueSource.noise,{slow:1,interrupted:0}); assert.equal(issueSource.external.length,1);
|
||||
const issueList=buildIssues(issueSource.records,{start:issueSource.start,end:issueSource.end,external:issueSource.external});
|
||||
assert.equal(issueList.issues.length,1); assert.equal(issueList.issues[0].cause.source,'github'); assert.equal(issueList.expected.count,1);
|
||||
console.log('PASS issue list: repoId filter, external calls, expected responses and noise counts');
|
||||
// Run the deployed collector program in its pinned Vector image, then ingest
|
||||
// its real output alongside historical absent/explicit-unknown releases.
|
||||
const vectorImage = fs.readFileSync('deploy/logging/compose.yml','utf8').match(/image: (timberio\/vector:[^\s]+)/)[1];
|
||||
|
||||
Reference in new issue
Block a user