wilfred-s commented on a change in pull request #125: [YUNIKORN-79] Internal 
metrics are unavailable through REST API
URL: 
https://github.com/apache/incubator-yunikorn-core/pull/125#discussion_r405261622
 
 

 ##########
 File path: pkg/webservice/handlers.go
 ##########
 @@ -241,23 +241,24 @@ func GetApplicationHistory(w http.ResponseWriter, r 
*http.Request) {
        writeHeaders(w)
 
        if imHistory != nil {
-               var result []*dao.ApplicationHistoryDAOInfo
-               records := imHistory.GetRecords()
-               for _, record := range records {
-                       if record == nil {
-                               break
-                       }
-                       element := &dao.ApplicationHistoryDAOInfo{
-                               Timestamp:         record.Timestamp.UnixNano(),
-                               TotalApplications: 
strconv.Itoa(record.TotalApplications),
-                       }
-                       result = append(result, element)
+               http.Error(w, "Internal metrics collection is not enabled.", 
http.StatusInternalServerError)
+               return
+       }
+       var result []*dao.ApplicationHistoryDAOInfo
+       records := imHistory.GetRecords()
+       for _, record := range records {
+               if record == nil {
+                       continue
 
 Review comment:
   We still should break here: internal filling of the array stops when we have 
run out of stats to collect. If we cannot convert we set it to -1. So the only 
way the record can be nil is if we have never written to it and that means all 
follow up values are nil.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to