Merge branch 'feature/traffic-analytics'
This commit is contained in:
commit
5fdeff012c
10 files changed
+649
-6
No files matched your search
+3
-1
@@ -64,12 +64,13 @@ func (s *Server) alertOverview(w http.ResponseWriter, sc alertScope) {
|
||||
}
|
||||
}
|
||||
sort.Slice(active, func(i, j int) bool { return active[i].Since.Before(active[j].Since) })
|
||||
settings := map[string]int{"debounceMin": 2, "repeatHours": 0}
|
||||
settings := map[string]int{"debounceMin": 2, "repeatHours": 0, "spikeFactor": 0, "dailyMb": 0}
|
||||
if o := s.findOrg(sc.org); o != nil {
|
||||
if o.AlertDebounceMin > 0 {
|
||||
settings["debounceMin"] = o.AlertDebounceMin
|
||||
}
|
||||
settings["repeatHours"] = o.AlertRepeatHours
|
||||
settings["spikeFactor"], settings["dailyMb"] = o.TrafficSpikeFactor, o.TrafficDailyMB
|
||||
}
|
||||
mailOK := s.st.Settings.SMTP.Host != ""
|
||||
s.mu.Unlock()
|
||||
@@ -201,6 +202,7 @@ func (s *Server) registerAlertRoutes(mux *http.ServeMux) {
|
||||
mux.HandleFunc("DELETE /api/orgs/{org}/alerts/channels/{id}", s.withOrgAlerts(s.deleteChannel))
|
||||
mux.HandleFunc("POST /api/orgs/{org}/alerts/channels/{id}/test", s.withOrgAlerts(s.testChannel))
|
||||
mux.HandleFunc("PUT /api/orgs/{org}/alerts/settings", s.withOrgAlerts(s.alertSettings))
|
||||
mux.HandleFunc("PUT /api/orgs/{org}/alerts/traffic", s.withOrgAlerts(s.trafficAlertSettings))
|
||||
mux.HandleFunc("GET /api/admin/alerts", s.withServerAlerts(overview))
|
||||
mux.HandleFunc("POST /api/admin/alerts/channels", s.withServerAlerts(s.saveChannel))
|
||||
mux.HandleFunc("PUT /api/admin/alerts/channels/{id}", s.withServerAlerts(s.saveChannel))
|
||||
|
||||
Reference in new issue
Block a user