fix: byHost realTime metrics API (#17681)

This commit is contained in:
jiuker
2023-07-19 14:50:30 +08:00
committed by GitHub
parent 6426b74770
commit a99cd825ab
4 changed files with 21 additions and 3 deletions

View File

@@ -453,6 +453,12 @@ func (s *peerRESTServer) GetMetricsHandler(w http.ResponseWriter, r *http.Reques
for _, disk := range r.Form[peerRESTDisk] {
diskMap[disk] = struct{}{}
}
hostMap := make(map[string]struct{})
for _, host := range r.Form[peerRESTHost] {
hostMap[host] = struct{}{}
}
jobID := r.Form.Get(peerRESTJobID)
depID := r.Form.Get(peerRESTDepID)
@@ -461,6 +467,7 @@ func (s *peerRESTServer) GetMetricsHandler(w http.ResponseWriter, r *http.Reques
info := collectLocalMetrics(types, collectMetricsOpts{
disks: diskMap,
hosts: hostMap,
jobID: jobID,
depID: depID,
})