fix bug for node metrics on overview page
Signed-off-by: zhu733756 <talonzhu@yunify.com>
This commit is contained in:
@@ -90,6 +90,7 @@ type reqParams struct {
|
||||
cluster string
|
||||
services string
|
||||
pvcFilter string
|
||||
queryType string
|
||||
}
|
||||
|
||||
type queryOptions struct {
|
||||
@@ -145,6 +146,7 @@ func parseRequestParams(req *restful.Request) reqParams {
|
||||
r.componentType = req.PathParameter("component")
|
||||
r.expression = req.QueryParameter("expr")
|
||||
r.metric = req.QueryParameter("metric")
|
||||
r.queryType = req.QueryParameter("type")
|
||||
|
||||
return r
|
||||
}
|
||||
@@ -213,6 +215,7 @@ func (h handler) makeQueryOptions(r reqParams, lvl monitoring.Level) (q queryOpt
|
||||
NodeName: r.nodeName,
|
||||
PVCFilter: r.pvcFilter, // metering pvc
|
||||
StorageClassName: r.storageClassName, // metering pvc
|
||||
QueryType: r.queryType,
|
||||
}
|
||||
q.namedMetrics = model.NodeMetrics
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("sort_type", "Sort order. One of asc, desc.").DefaultValue("desc.").DataType("string").Required(false)).
|
||||
Param(ws.QueryParameter("page", "The page number. This field paginates result data of each metric, then returns a specific page. For example, setting **page** to 2 returns the second page. It only applies to sorted metric data.").DataType("integer").Required(false)).
|
||||
Param(ws.QueryParameter("limit", "Page size, the maximum number of results in a single page. Defaults to 5.").DataType("integer").Required(false).DefaultValue("5")).
|
||||
Param(ws.QueryParameter("type", "The query type. This field can be set to 'rank' for node ranking query or '' for others. Defaults to ''.").DataType("string").Required(false).DefaultValue("")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NodeMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
|
||||
Reference in New Issue
Block a user