feat: 1.5.0 incident management (tickets from egress findings, triage, comments, suppression with expiry)
Release / Publish tags (push) Successful in 14s
Release / Plan (reuse the published image?) (push) Successful in 5s
Release / ci (push) Successful in 1m14s
Release / Build image (amd64) (push) Successful in 24s
Release / Build image (arm64) (push) Successful in 1m13s
CI / Format and vet (push) Successful in 41s
CI / Tests (Linux, race detector) (push) Successful in 1m1s
CI / Dependency audit (push) Successful in 33s
CI / Docker image (build and smoke test) (push) Skipped
Release / Gitea release (push) Successful in 4s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Opus 5.5 committed 2026-11-15 09:18:06 -03:00
1 parent 3ae72e27d6
commit e5058968e2
22 files changed
+2651 -20

No files matched your search

+20 -5
View File
@@ -1,6 +1,7 @@
package server
import (
"context"
"encoding/json"
"net/http"
"sort"
@@ -23,6 +24,7 @@ type egressOut struct {
Enabled bool `json:"enabled"`
Source egress.SourceInfo `json:"source"`
egress.Report
SuppressedCount int `json:"suppressed_count"`
}
// egressAPI: GET /api/v1/egress?range=24h&host=all|<name>. On a hub the
@@ -48,7 +50,21 @@ func (s *Server) egressAPI(w http.ResponseWriter, r *http.Request) {
out.Source = eng.Info()
out.Enabled = true
}
rep := egress.EmptyReport()
rep, peerOn := s.egressReport(r.Context(), from, to, local, peers, only)
if peerOn {
out.Enabled = true
}
// incidents are fed only by the 60 s loop, never by a request
out.Report = rep
out.SuppressedCount = s.annotateFindings(&out.Report, r.URL.Query().Get("suppressed") == "1")
writeJSON(w, 200, out)
}
// egressReport builds the report of the window: the local engine and, on a hub,
// the peers' reports merged (items carrying "host"). peerOn is true when a peer answered.
func (s *Server) egressReport(ctx context.Context, from, to int64, local, peers bool, only string) (rep egress.Report, peerOn bool) {
eng := egressEngine.Load()
rep = egress.EmptyReport()
if local && eng != nil {
rep = eng.Report(from, to)
}
@@ -59,7 +75,7 @@ func (s *Server) egressAPI(w http.ResponseWriter, r *http.Request) {
rep.Stamp(s.opt.Store.Name())
merged.Merge(rep, s.opt.Store.Name())
}
raws := s.opt.Hub.EgressFor(r.Context(), from, to, only)
raws := s.opt.Hub.EgressFor(ctx, from, to, only)
names := make([]string, 0, len(raws))
for n := range raws {
names = append(names, n)
@@ -72,12 +88,11 @@ func (s *Server) egressAPI(w http.ResponseWriter, r *http.Request) {
}
pr.Sanitize(n)
merged.Merge(pr, n)
out.Enabled = true
peerOn = true
}
rep = merged
}
out.Report = rep
writeJSON(w, 200, out)
return rep, peerOn
}
// peerEgress: GET /api/v1/peer/egress, the local report a hub merges; opened