feat: incident updates with a status, public or internal
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 6m54s
ci / test (pull_request) Successful in 12m15s
ci / build (pull_request) Successful in 11m0s
ci / image (pull_request) Successful in 4m23s
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 6m54s
ci / test (pull_request) Successful in 12m15s
ci / build (pull_request) Successful in 11m0s
ci / image (pull_request) Successful in 4m23s
Outages open and close with their monitor; now people can say what is going on. An incident gets an optional title and updates, each with a status (investigating, identified, monitoring, resolved) and a Markdown message, shown on status pages or kept as an internal note. The incident shows the latest update's status, resolved once its monitor recovered. The console lists title and status and has a page per incident with its timeline (outage, updates, recovery) and, for incidents.write in the monitor's group, forms to post updates and set the title. Status pages show title, status and public updates. API: GET/PATCH /org/incidents/:id, POST and DELETE /org/incidents/:id/updates; the incident list carries title and status; the organization export includes the updates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
6f0cf59406
commit
43a04e99b1
27 files changed
+2753
-908
No files matched your search
@@ -176,8 +176,47 @@ func (q *Queries) OrgDailyStats(ctx context.Context, orgID uuid.UUID) ([]OrgDail
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const orgIncidentUpdatesExport = `-- name: OrgIncidentUpdatesExport :many
|
||||
SELECT incident_id, status, message, public, created_at FROM incident_updates
|
||||
WHERE org_id = $1 ORDER BY created_at
|
||||
`
|
||||
|
||||
type OrgIncidentUpdatesExportRow struct {
|
||||
IncidentID uuid.UUID
|
||||
Status string
|
||||
Message string
|
||||
Public bool
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
func (q *Queries) OrgIncidentUpdatesExport(ctx context.Context, orgID uuid.UUID) ([]OrgIncidentUpdatesExportRow, error) {
|
||||
rows, err := q.db.Query(ctx, orgIncidentUpdatesExport, orgID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
items := []OrgIncidentUpdatesExportRow{}
|
||||
for rows.Next() {
|
||||
var i OrgIncidentUpdatesExportRow
|
||||
if err := rows.Scan(
|
||||
&i.IncidentID,
|
||||
&i.Status,
|
||||
&i.Message,
|
||||
&i.Public,
|
||||
&i.CreatedAt,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const orgIncidentsExport = `-- name: OrgIncidentsExport :many
|
||||
SELECT i.id, i.monitor_id, m.name AS monitor, i.started_at, i.resolved_at, i.cause
|
||||
SELECT i.id, i.monitor_id, m.name AS monitor, i.started_at, i.resolved_at, i.cause, i.title, i.status
|
||||
FROM incidents i LEFT JOIN monitors m ON m.id = i.monitor_id
|
||||
WHERE i.org_id = $1 ORDER BY i.started_at
|
||||
`
|
||||
@@ -189,6 +228,8 @@ type OrgIncidentsExportRow struct {
|
||||
StartedAt time.Time
|
||||
ResolvedAt *time.Time
|
||||
Cause []byte
|
||||
Title string
|
||||
Status *string
|
||||
}
|
||||
|
||||
func (q *Queries) OrgIncidentsExport(ctx context.Context, orgID uuid.UUID) ([]OrgIncidentsExportRow, error) {
|
||||
@@ -207,6 +248,8 @@ func (q *Queries) OrgIncidentsExport(ctx context.Context, orgID uuid.UUID) ([]Or
|
||||
&i.StartedAt,
|
||||
&i.ResolvedAt,
|
||||
&i.Cause,
|
||||
&i.Title,
|
||||
&i.Status,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user