adamantal 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_r405410701
##########
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:
As I wrote in my comment
[above](https://github.com/apache/incubator-yunikorn-core/pull/125#discussion_r404605856)
in more detail, the array returned by the `GetRecords()` may have `nil` values
**at the beginning**, but have non-nil values later.
----------------------------------------------------------------
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