diff --git a/pkg/apis/monitoring/v1alpha2/register.go b/pkg/apis/monitoring/v1alpha2/register.go index 5cfd548870fcda205c8e91964092cf2711ed14d8..4f9d97dbe2ffe4343d0a7e3a3645efb40ddd0834 100644 --- a/pkg/apis/monitoring/v1alpha2/register.go +++ b/pkg/apis/monitoring/v1alpha2/register.go @@ -227,10 +227,10 @@ func addWebService(c *restful.Container) error { // Only use this api to monitor status of pods under the {workload} // To monitor a specific workload, try the next two apis with "resources_filter" - ws.Route(ws.GET("/namespaces/{namespace}/workloads/{workload_kind}/{workload}").To(monitoring.MonitorSpecificWorkload). + ws.Route(ws.GET("/namespaces/{namespace}/workloads/{kind}/{workload}").To(monitoring.MonitorSpecificWorkload). Doc("Get specific workload metrics under a given namespace."). Param(ws.PathParameter("namespace", "Specify the target namespace.").DataType("string").Required(true)). - Param(ws.PathParameter("workload_kind", "Specify the target workload kind. One of deployment, daemonset, statefulset. Other values will be interpreted as any of three.").DataType("string").Required(true).DefaultValue("(.*)")). + Param(ws.PathParameter("kind", "Specify the target workload kind. One of deployment, daemonset, statefulset. Other values will be interpreted as any of three.").DataType("string").Required(true).DefaultValue("(.*)")). Param(ws.PathParameter("workload", "Specify the target workload.").DataType("string").Required(true)). Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. workload_cpu|workload_memory.").DataType("string").Required(false)). Param(ws.QueryParameter("step", "Used to get metrics over a range of time. Query resolution step. eg. 10m.").DataType("string").Required(false)). @@ -243,10 +243,10 @@ func addWebService(c *restful.Container) error { Consumes(restful.MIME_JSON, restful.MIME_XML). Produces(restful.MIME_JSON) - ws.Route(ws.GET("/namespaces/{namespace}/workloads/{workload_kind}").To(monitoring.MonitorAllWorkloadsOfSpecificKind). + ws.Route(ws.GET("/namespaces/{namespace}/workloads/{kind}").To(monitoring.MonitorAllWorkloadsOfSpecificKind). Doc("Get all workload-level metrics of a specific workload kind under a given namespace."). Param(ws.PathParameter("namespace", "Specify the target namespace.").DataType("string").Required(true)). - Param(ws.PathParameter("workload_kind", "Specify the target workload kind. One of deployment, daemonset, statefulset. Other values will be interpreted as any of three.").DataType("string").Required(true).DefaultValue("(.*)")). + Param(ws.PathParameter("kind", "Specify the target workload kind. One of deployment, daemonset, statefulset. Other values will be interpreted as any of three.").DataType("string").Required(true).DefaultValue("(.*)")). Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. node_cpu|node_memory.").DataType("string").Required(false)). Param(ws.QueryParameter("resources_filter", "Workload filter in regexp pattern.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_metric", "Sort workloads by the specified metric. Valid only if type is rank.").DataType("string").Required(false)). diff --git a/pkg/simple/client/prometheus/prometheusclient.go b/pkg/simple/client/prometheus/prometheusclient.go index 4ed4b52575021450582fce31ec3e23e21cb5b69e..6f8fabbd682b532e764ed0c1dd6ca5b963e5d29d 100644 --- a/pkg/simple/client/prometheus/prometheusclient.go +++ b/pkg/simple/client/prometheus/prometheusclient.go @@ -114,7 +114,7 @@ func ParseMonitoringRequestParams(request *restful.Request) *MonitoringRequestPa nsName := strings.Trim(request.PathParameter("namespace"), " ") podName := strings.Trim(request.PathParameter("pod"), " ") containerName := strings.Trim(request.PathParameter("container"), " ") - workloadKind := strings.Trim(request.PathParameter("workload_kind"), " ") + workloadKind := strings.Trim(request.PathParameter("kind"), " ") componentName := strings.Trim(request.PathParameter("component"), " ") var requestParams = MonitoringRequestParams{