|
|
@ -38,6 +38,10 @@ func dayHistory(w http.ResponseWriter, req *http.Request) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
service_name := keys[0]
|
|
|
|
service_name := keys[0]
|
|
|
|
|
|
|
|
if !validTarget[service_name] {
|
|
|
|
|
|
|
|
http.Error(w, "Invalid `service_name` requested", http.StatusBadRequest)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
keys, ok = req.URL.Query()["interval"]
|
|
|
|
keys, ok = req.URL.Query()["interval"]
|
|
|
|
var interval = 5
|
|
|
|
var interval = 5
|
|
|
|
if len(keys) >= 2 {
|
|
|
|
if len(keys) >= 2 {
|
|
|
@ -89,6 +93,10 @@ func history(w http.ResponseWriter, req *http.Request, dayCount int) {
|
|
|
|
http.Error(w, "Only one `service_name` allowed", http.StatusBadRequest)
|
|
|
|
http.Error(w, "Only one `service_name` allowed", http.StatusBadRequest)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !validTarget[keys[0]] {
|
|
|
|
|
|
|
|
http.Error(w, "Invalid `service_name` requested", http.StatusBadRequest)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
entries := getHistoryDay(keys[0], dayCount)
|
|
|
|
entries := getHistoryDay(keys[0], dayCount)
|
|
|
|
writeJSON(w, entries)
|
|
|
|
writeJSON(w, entries)
|
|
|
|
}
|
|
|
|
}
|
|
|
|