pbacsko commented on code in PR #589:
URL: https://github.com/apache/yunikorn-core/pull/589#discussion_r1261470134
##########
pkg/webservice/handlers.go:
##########
@@ -869,3 +891,90 @@ func getGroupResourceUsage(w http.ResponseWriter, r
*http.Request) {
buildJSONErrorResponse(w, err.Error(),
http.StatusInternalServerError)
}
}
+
+func getEventsByType(w http.ResponseWriter, r *http.Request) {
+ vars := httprouter.ParamsFromContext(r.Context())
+ if vars == nil {
+ getEvents(w, r, nil)
+ return
+ }
+ evtType := strings.ToLower(vars.ByName("type"))
+ if evtType == "" {
+ getEvents(w, r, nil)
+ return
+ }
+ switch evtType {
+ case "node":
+ getEvents(w, r, eventFilters[nodeEvents])
+ case "app":
+ getEvents(w, r, eventFilters[appEvents])
+ case "queue":
+ getEvents(w, r, eventFilters[queueEvents])
+ default:
+ buildJSONErrorResponse(w, "Illegal event type: "+evtType,
http.StatusBadRequest)
+ }
+}
+
+func getAllEvents(w http.ResponseWriter, r *http.Request) {
+ getEvents(w, r, nil)
+}
+
+func getEvents(w http.ResponseWriter, r *http.Request, filter func(record
*si.EventRecord) bool) {
+ writeHeaders(w)
+ eventSystem := events.GetEventSystem()
+ if eventSystem == nil {
+ buildJSONErrorResponse(w, "Event system is disabled",
http.StatusBadRequest)
+ return
+ }
Review Comment:
This will be affected by #579
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]