summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2025-08-08 13:18:44 -0400
committerRobby Zambito <contact@robbyzambito.me>2025-08-08 13:18:52 -0400
commitd4c519c3b9935768a7481f83ee7cc717c25d3361 (patch)
tree6dc5606fdedc90e25482cab56d5e11317d5d0f9d /internal
parent9671b4abf936f59b9d04f9d26b301e65fa78753d (diff)
Update overall status based on incidents
Diffstat (limited to 'internal')
-rw-r--r--internal/api/handlers.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/internal/api/handlers.go b/internal/api/handlers.go
index 2cc2188..4c4b2ec 100644
--- a/internal/api/handlers.go
+++ b/internal/api/handlers.go
@@ -102,8 +102,8 @@ func InitializeAPI(logs *[LogLength]string, n *int, toLogParser chan string) {
// ScheduledMaintenance: 0,
// }
status.overallStatus = overallStatus{
- Status: StatusDegraded,
- Description: "Everything is not great",
+ Status: StatusOperational,
+ Description: "Everything is operating normally",
Uptime: 50.0,
ResponseTime: 20000,
ActiveIncidents: 9001,
@@ -207,6 +207,19 @@ func InitializeAPI(logs *[LogLength]string, n *int, toLogParser chan string) {
addRotLog(logs, n, toLogParser, fmt.Sprintf(`{"incidentEvent": %s}`, string(jsonData)))
})
status.overallStatus.ActiveIncidents = len(status.incidents)
+
+ status.overallStatus.Status = StatusOperational
+ status.overallStatus.Description = "Everything is operating normally"
+ for _, s := range status.incidents {
+ if s.Status == StatusDown {
+ status.overallStatus.Status = StatusDown
+ break
+ }
+
+ if s.Status == StatusDegraded {
+ status.overallStatus.Status = StatusDegraded
+ }
+ }
}
}
}()