test
This commit is contained in:
parent
0e991c40aa
commit
a06c8ab70f
|
@ -13,7 +13,7 @@ type ControllerMetricsReq struct {
|
|||
Metrics []string `form:"metrics"`
|
||||
Pod string `form:"pod"`
|
||||
WorkloadName string `form:"workloadName"`
|
||||
Steps string `form:"steps"`
|
||||
Steps int `form:"steps"`
|
||||
Start string `form:"start"`
|
||||
End string `form:"end"`
|
||||
Level string `form:"level"`
|
||||
|
@ -29,14 +29,16 @@ func ControllerMetrics(c *gin.Context) {
|
|||
Response(c, http.StatusBadRequest, "invalid request params.", "")
|
||||
return
|
||||
}
|
||||
// steps parse
|
||||
duration := time.Duration(p.Steps)
|
||||
var result []monitoring.Metric
|
||||
if len(p.Pod) != 0 {
|
||||
result = apiserver.ApiServer.MonitoringClientMap[p.ClusterName].GetNamedMetricsByTime(p.Metrics, p.Start, p.End, 60*time.Minute, monitoring.PodOption{
|
||||
result = apiserver.ApiServer.MonitoringClientMap[p.ClusterName].GetNamedMetricsByTime(p.Metrics, p.Start, p.End, duration*time.Minute, monitoring.PodOption{
|
||||
PodName: p.Pod,
|
||||
})
|
||||
} else {
|
||||
|
||||
result = apiserver.ApiServer.MonitoringClientMap[p.ClusterName].GetNamedMetricsByTime(p.Metrics, p.Start, p.End, 60*time.Minute, monitoring.ControllerOption{
|
||||
result = apiserver.ApiServer.MonitoringClientMap[p.ClusterName].GetNamedMetricsByTime(p.Metrics, p.Start, p.End, duration*time.Minute, monitoring.ControllerOption{
|
||||
WorkloadName: p.WorkloadName,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue