What changed before this? on every incident, ranked
- A card on the incident page, and GET /api/incidents/:id/before and /api/v1/incidents/:id/before: what the app knows happened in the 30 min to 24 h before an alert began (audit log, maintenance windows, update runs and patch plans, other alerts, a step in the server's own figures), scored by how related, what kind and how close - A host going down is shown once; Likely, Possible and Background; at most ten - Docs and roles updated Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c2e76262ca
commit
0277126add
12 files changed
+887
No files matched your search
@@ -5,6 +5,7 @@ import { endpointChecks, servers } from "../db/schema.js";
|
||||
import { resolveApiToken, type ApiTokenRow, type ApiTokenUser } from "../services/apiTokens.js";
|
||||
import { getEndpointHistory } from "../services/endpointChecks.js";
|
||||
import { getIncident, listIncidents } from "../services/incidents.js";
|
||||
import { whatChangedBefore } from "../services/incidentBefore.js";
|
||||
import { buildNetworkOverview } from "../services/networkOverview.js";
|
||||
import { alertsV1, endpointsV1, inventoryV1, maintenanceV1, oneServerV1, serversV1 } from "../services/publicApi.js";
|
||||
import { getServerMetrics, MAX_RANGE_DAYS } from "../services/serverMetrics.js";
|
||||
@@ -67,6 +68,7 @@ publicApiRouter.get("/", (_req, res) => {
|
||||
"GET /api/v1/alerts?severity=&category=&acknowledged=&silenced=",
|
||||
"GET /api/v1/incidents?status=&limit=",
|
||||
"GET /api/v1/incidents/:id",
|
||||
"GET /api/v1/incidents/:id/before?minutes=",
|
||||
"GET /api/v1/inventory",
|
||||
"GET /api/v1/network",
|
||||
"GET /api/v1/endpoints",
|
||||
@@ -135,6 +137,14 @@ publicApiRouter.get("/incidents/:id", asyncHandler(async (req, res) => {
|
||||
res.json(detail);
|
||||
}));
|
||||
|
||||
publicApiRouter.get("/incidents/:id/before", asyncHandler(async (req, res) => {
|
||||
const id = idOf(req.params.id);
|
||||
if (!Number.isInteger(id)) return res.status(400).json({ error: "invalid_id" });
|
||||
const report = await whatChangedBefore(id, req.query.minutes === undefined ? undefined : Number(req.query.minutes));
|
||||
if (!report) return res.status(404).json({ error: "not_found" });
|
||||
res.json(report);
|
||||
}));
|
||||
|
||||
publicApiRouter.get("/inventory", asyncHandler(async (_req, res) => {
|
||||
res.json({ assets: await inventoryV1() });
|
||||
}));
|
||||
|
||||
Reference in new issue
Block a user