doc: fix swagger import errors caused by duplicate operationId and non-allowed data type values

Signed-off-by: huanggze <loganhuang@yunify.com>
This commit is contained in:
huanggze
2019-06-10 13:29:39 +08:00
committed by zryfish
parent 736582be23
commit 3e2693739d
4 changed files with 126 additions and 49 deletions

View File

@@ -65,8 +65,8 @@ func addWebService(c *restful.Container) error {
Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)). Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)). Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)). Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("int").DefaultValue("0").Required(false)). Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("integer").DefaultValue("0").Required(false)).
Param(ws.QueryParameter("size", "Size of result to return.").DataType("int").DefaultValue("10").Required(false)). Param(ws.QueryParameter("size", "Size of result to return.").DataType("integer").DefaultValue("10").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags). Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(esclient.Response{}). Writes(esclient.Response{}).
Returns(http.StatusOK, RespOK, esclient.Response{})). Returns(http.StatusOK, RespOK, esclient.Response{})).
@@ -91,8 +91,8 @@ func addWebService(c *restful.Container) error {
Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)). Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)). Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)). Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("int").DefaultValue("0").Required(false)). Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("integer").DefaultValue("0").Required(false)).
Param(ws.QueryParameter("size", "Size of result to return.").DataType("int").DefaultValue("10").Required(false)). Param(ws.QueryParameter("size", "Size of result to return.").DataType("integer").DefaultValue("10").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags). Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(esclient.Response{}). Writes(esclient.Response{}).
Returns(http.StatusOK, RespOK, esclient.Response{})). Returns(http.StatusOK, RespOK, esclient.Response{})).
@@ -115,8 +115,8 @@ func addWebService(c *restful.Container) error {
Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)). Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)). Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)). Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("int").DefaultValue("0").Required(false)). Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("integer").DefaultValue("0").Required(false)).
Param(ws.QueryParameter("size", "Size of result to return.").DataType("int").DefaultValue("10").Required(false)). Param(ws.QueryParameter("size", "Size of result to return.").DataType("integer").DefaultValue("10").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags). Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(esclient.Response{}). Writes(esclient.Response{}).
Returns(http.StatusOK, RespOK, esclient.Response{})). Returns(http.StatusOK, RespOK, esclient.Response{})).
@@ -138,8 +138,8 @@ func addWebService(c *restful.Container) error {
Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)). Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)). Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)). Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("int").DefaultValue("0").Required(false)). Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("integer").DefaultValue("0").Required(false)).
Param(ws.QueryParameter("size", "Size of result to return.").DataType("int").DefaultValue("10").Required(false)). Param(ws.QueryParameter("size", "Size of result to return.").DataType("integer").DefaultValue("10").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags). Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(esclient.Response{}). Writes(esclient.Response{}).
Returns(http.StatusOK, RespOK, esclient.Response{})). Returns(http.StatusOK, RespOK, esclient.Response{})).
@@ -159,8 +159,8 @@ func addWebService(c *restful.Container) error {
Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)). Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)). Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)). Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("int").DefaultValue("0").Required(false)). Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("integer").DefaultValue("0").Required(false)).
Param(ws.QueryParameter("size", "Size of result to return.").DataType("int").DefaultValue("10").Required(false)). Param(ws.QueryParameter("size", "Size of result to return.").DataType("integer").DefaultValue("10").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags). Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(esclient.Response{}). Writes(esclient.Response{}).
Returns(http.StatusOK, RespOK, esclient.Response{})). Returns(http.StatusOK, RespOK, esclient.Response{})).
@@ -179,8 +179,8 @@ func addWebService(c *restful.Container) error {
Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)). Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)). Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)). Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("int").DefaultValue("0").Required(false)). Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("integer").DefaultValue("0").Required(false)).
Param(ws.QueryParameter("size", "Size of result to return.").DataType("int").DefaultValue("10").Required(false)). Param(ws.QueryParameter("size", "Size of result to return.").DataType("integer").DefaultValue("10").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags). Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(esclient.Response{}). Writes(esclient.Response{}).
Returns(http.StatusOK, RespOK, esclient.Response{})). Returns(http.StatusOK, RespOK, esclient.Response{})).

View File

@@ -57,14 +57,14 @@ func addWebService(c *restful.Container) error {
Consumes(restful.MIME_JSON, restful.MIME_XML). Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON) Produces(restful.MIME_JSON)
ws.Route(ws.GET("/nodes").To(monitoring.MonitorNode). ws.Route(ws.GET("/nodes").To(monitoring.MonitorAllNodes).
Doc("Get node-level metrics."). Doc("Get node-level metrics.").
Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. node_cpu|node_memory.").DataType("string").Required(false)). Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. node_cpu|node_memory.").DataType("string").Required(false)).
Param(ws.QueryParameter("resources_filter", "Node filter in regexp pattern, eg. i-caojnter|i-cmu82ogj.").DataType("string").Required(false)). Param(ws.QueryParameter("resources_filter", "Node filter in regexp pattern, eg. i-caojnter|i-cmu82ogj.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_metric", "Sort nodes by the specified metric. Valid only if type is rank.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_metric", "Sort nodes by the specified metric. Valid only if type is rank.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)).
Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("int").Required(false).DefaultValue("1")). Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("integer").Required(false).DefaultValue("1")).
Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("int").Required(false).DefaultValue("5")). Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("integer").Required(false).DefaultValue("5")).
Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)). Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags). Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(metrics.FormatedLevelMetric{}). Writes(metrics.FormatedLevelMetric{}).
@@ -72,7 +72,7 @@ func addWebService(c *restful.Container) error {
Consumes(restful.MIME_JSON, restful.MIME_XML). Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON) Produces(restful.MIME_JSON)
ws.Route(ws.GET("/nodes/{node}").To(monitoring.MonitorNode). ws.Route(ws.GET("/nodes/{node}").To(monitoring.MonitorSpecificNode).
Doc("Get specific node metrics."). Doc("Get specific node metrics.").
Param(ws.PathParameter("node", "Specify the target node.").DataType("string").Required(true)). Param(ws.PathParameter("node", "Specify the target node.").DataType("string").Required(true)).
Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. node_cpu|node_memory.").DataType("string").Required(false)). Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. node_cpu|node_memory.").DataType("string").Required(false)).
@@ -86,14 +86,14 @@ func addWebService(c *restful.Container) error {
Consumes(restful.MIME_JSON, restful.MIME_XML). Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON) Produces(restful.MIME_JSON)
ws.Route(ws.GET("/namespaces").To(monitoring.MonitorNamespace). ws.Route(ws.GET("/namespaces").To(monitoring.MonitorAllNamespaces).
Doc("Get namespace-level metrics."). Doc("Get namespace-level metrics.").
Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. namespace_cpu|namespace_memory.").DataType("string").Required(false)). Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. namespace_cpu|namespace_memory.").DataType("string").Required(false)).
Param(ws.QueryParameter("resources_filter", "Namespace filter in regexp pattern, eg. namespace-1|namespace-2.").DataType("string").Required(false)). Param(ws.QueryParameter("resources_filter", "Namespace filter in regexp pattern, eg. namespace-1|namespace-2.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_metric", "Sort namespaces by the specified metric. Valid only if type is rank.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_metric", "Sort namespaces by the specified metric. Valid only if type is rank.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)).
Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("int").Required(false).DefaultValue("1")). Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("integer").Required(false).DefaultValue("1")).
Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("int").Required(false).DefaultValue("5")). Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("integer").Required(false).DefaultValue("5")).
Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)). Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags). Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(metrics.FormatedLevelMetric{}). Writes(metrics.FormatedLevelMetric{}).
@@ -101,7 +101,7 @@ func addWebService(c *restful.Container) error {
Consumes(restful.MIME_JSON, restful.MIME_XML). Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON) Produces(restful.MIME_JSON)
ws.Route(ws.GET("/namespaces/{namespace}").To(monitoring.MonitorNamespace). ws.Route(ws.GET("/namespaces/{namespace}").To(monitoring.MonitorSpecificNamespace).
Doc("Get specific namespace metrics."). Doc("Get specific namespace metrics.").
Param(ws.PathParameter("namespace", "Specify the target namespace.").DataType("string").Required(true)). Param(ws.PathParameter("namespace", "Specify the target namespace.").DataType("string").Required(true)).
Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. namespace_cpu|namespace_memory.").DataType("string").Required(false)). Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. namespace_cpu|namespace_memory.").DataType("string").Required(false)).
@@ -115,15 +115,15 @@ func addWebService(c *restful.Container) error {
Consumes(restful.MIME_JSON, restful.MIME_XML). Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON) Produces(restful.MIME_JSON)
ws.Route(ws.GET("/namespaces/{namespace}/pods").To(monitoring.MonitorPod). ws.Route(ws.GET("/namespaces/{namespace}/pods").To(monitoring.MonitorAllPodsOfSpecificNamespace).
Doc("Get pod-level metrics of a given namespace."). Doc("Get pod-level metrics of a given namespace.").
Param(ws.PathParameter("namespace", "Specify the target namespace.").DataType("string").Required(true)). Param(ws.PathParameter("namespace", "Specify the target namespace.").DataType("string").Required(true)).
Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. pod_cpu|pod_memory.").DataType("string").Required(false)). Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. pod_cpu|pod_memory.").DataType("string").Required(false)).
Param(ws.QueryParameter("resources_filter", "Pods filter in regexp pattern, eg. coredns-77b8449dc9-hd6gd|coredns-77b8449dc9-b4n74.").DataType("string").Required(false)). Param(ws.QueryParameter("resources_filter", "Pods filter in regexp pattern, eg. coredns-77b8449dc9-hd6gd|coredns-77b8449dc9-b4n74.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_metric", "Sort pods by the specified metric. Valid only if type is rank.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_metric", "Sort pods by the specified metric. Valid only if type is rank.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)).
Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("int").Required(false).DefaultValue("1")). Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("integer").Required(false).DefaultValue("1")).
Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("int").Required(false).DefaultValue("5")). Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("integer").Required(false).DefaultValue("5")).
Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)). Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags). Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(metrics.FormatedLevelMetric{}). Writes(metrics.FormatedLevelMetric{}).
@@ -131,7 +131,7 @@ func addWebService(c *restful.Container) error {
Consumes(restful.MIME_JSON, restful.MIME_XML). Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON) Produces(restful.MIME_JSON)
ws.Route(ws.GET("/namespaces/{namespace}/pods/{pod}").To(monitoring.MonitorPod). ws.Route(ws.GET("/namespaces/{namespace}/pods/{pod}").To(monitoring.MonitorSpecificPodOfSpecificNamespace).
Doc("Get specific pod metrics."). Doc("Get specific pod metrics.").
Param(ws.PathParameter("namespace", "Specify the target namespace.").DataType("string").Required(true)). Param(ws.PathParameter("namespace", "Specify the target namespace.").DataType("string").Required(true)).
Param(ws.PathParameter("pod", "Specify the target pod.").DataType("string").Required(true)). Param(ws.PathParameter("pod", "Specify the target pod.").DataType("string").Required(true)).
@@ -146,15 +146,15 @@ func addWebService(c *restful.Container) error {
Consumes(restful.MIME_JSON, restful.MIME_XML). Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON) Produces(restful.MIME_JSON)
ws.Route(ws.GET("/nodes/{node}/pods").To(monitoring.MonitorPod). ws.Route(ws.GET("/nodes/{node}/pods").To(monitoring.MonitorAllPodsOnSpecificNode).
Doc("Get metrics of all pod on a specific node."). Doc("Get metrics of all pod on a specific node.").
Param(ws.PathParameter("node", "Specify the target node.").DataType("string").Required(true)). Param(ws.PathParameter("node", "Specify the target node.").DataType("string").Required(true)).
Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. node_cpu|node_memory.").DataType("string").Required(false)). Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. node_cpu|node_memory.").DataType("string").Required(false)).
Param(ws.QueryParameter("resources_filter", "Pod filter in regexp pattern, eg. coredns-77b8449dc9-hd6gd|coredns-77b8449dc9-b4n74.").DataType("string").Required(false)). Param(ws.QueryParameter("resources_filter", "Pod filter in regexp pattern, eg. coredns-77b8449dc9-hd6gd|coredns-77b8449dc9-b4n74.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_metric", "Sort pods by the specified metric. Valid only if type is rank.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_metric", "Sort pods by the specified metric. Valid only if type is rank.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)).
Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("int").Required(false).DefaultValue("1")). Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("integer").Required(false).DefaultValue("1")).
Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("int").Required(false).DefaultValue("5")). Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("integer").Required(false).DefaultValue("5")).
Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)). Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags). Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(metrics.FormatedLevelMetric{}). Writes(metrics.FormatedLevelMetric{}).
@@ -162,7 +162,7 @@ func addWebService(c *restful.Container) error {
Consumes(restful.MIME_JSON, restful.MIME_XML). Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON) Produces(restful.MIME_JSON)
ws.Route(ws.GET("/nodes/{node}/pods/{pod}").To(monitoring.MonitorPod). ws.Route(ws.GET("/nodes/{node}/pods/{pod}").To(monitoring.MonitorSpecificPodOnSpecificNode).
Doc("Get specific pod metrics under a given namespace."). Doc("Get specific pod metrics under a given namespace.").
Param(ws.PathParameter("node", "Specify the target node.").DataType("string").Required(true)). Param(ws.PathParameter("node", "Specify the target node.").DataType("string").Required(true)).
Param(ws.PathParameter("pod", "Specify the target pod.").DataType("string").Required(true)). Param(ws.PathParameter("pod", "Specify the target pod.").DataType("string").Required(true)).
@@ -177,7 +177,7 @@ func addWebService(c *restful.Container) error {
Consumes(restful.MIME_JSON, restful.MIME_XML). Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON) Produces(restful.MIME_JSON)
ws.Route(ws.GET("/nodes/{node}/pods/{pod}/containers").To(monitoring.MonitorContainer). ws.Route(ws.GET("/nodes/{node}/pods/{pod}/containers").To(monitoring.MonitorAllContainersOnSpecificNode).
Doc("Get container-level metrics under a given node and pod."). Doc("Get container-level metrics under a given node and pod.").
Param(ws.PathParameter("node", "Specify the target node.").DataType("string").Required(true)). Param(ws.PathParameter("node", "Specify the target node.").DataType("string").Required(true)).
Param(ws.PathParameter("pod", "Specify the target pod.").DataType("string").Required(true)). Param(ws.PathParameter("pod", "Specify the target pod.").DataType("string").Required(true)).
@@ -185,8 +185,8 @@ func addWebService(c *restful.Container) error {
Param(ws.QueryParameter("resources_filter", "Container filter in regexp pattern.").DataType("string").Required(false)). Param(ws.QueryParameter("resources_filter", "Container filter in regexp pattern.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_metric", "Sort containers by the specified metric. Valid only if type is rank.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_metric", "Sort containers by the specified metric. Valid only if type is rank.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)).
Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("int").Required(false).DefaultValue("1")). Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("integer").Required(false).DefaultValue("1")).
Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("int").Required(false).DefaultValue("5")). Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("integer").Required(false).DefaultValue("5")).
Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)). Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags). Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(metrics.FormatedLevelMetric{}). Writes(metrics.FormatedLevelMetric{}).
@@ -194,7 +194,7 @@ func addWebService(c *restful.Container) error {
Consumes(restful.MIME_JSON, restful.MIME_XML). Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON) Produces(restful.MIME_JSON)
ws.Route(ws.GET("/namespaces/{namespace}/pods/{pod}/containers").To(monitoring.MonitorContainer). ws.Route(ws.GET("/namespaces/{namespace}/pods/{pod}/containers").To(monitoring.MonitorAllContainersOfSpecificNamespace).
Doc("Get container-level metrics under a given namespace and pod."). Doc("Get container-level metrics under a given namespace and pod.").
Param(ws.PathParameter("namespace", "Specify the target namespace.").DataType("string").Required(true)). Param(ws.PathParameter("namespace", "Specify the target namespace.").DataType("string").Required(true)).
Param(ws.PathParameter("pod", "Specify the target pod.").DataType("string").Required(true)). Param(ws.PathParameter("pod", "Specify the target pod.").DataType("string").Required(true)).
@@ -202,8 +202,8 @@ func addWebService(c *restful.Container) error {
Param(ws.QueryParameter("resources_filter", "Container filter in regexp pattern.").DataType("string").Required(false)). Param(ws.QueryParameter("resources_filter", "Container filter in regexp pattern.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_metric", "Sort containers by the specified metric. Valid only if type is rank.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_metric", "Sort containers by the specified metric. Valid only if type is rank.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)).
Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("int").Required(false).DefaultValue("1")). Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("integer").Required(false).DefaultValue("1")).
Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("int").Required(false).DefaultValue("5")). Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("integer").Required(false).DefaultValue("5")).
Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)). Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags). Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(metrics.FormatedLevelMetric{}). Writes(metrics.FormatedLevelMetric{}).
@@ -211,7 +211,7 @@ func addWebService(c *restful.Container) error {
Consumes(restful.MIME_JSON, restful.MIME_XML). Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON) Produces(restful.MIME_JSON)
ws.Route(ws.GET("/namespaces/{namespace}/pods/{pod}/containers/{container}").To(monitoring.MonitorContainer). ws.Route(ws.GET("/namespaces/{namespace}/pods/{pod}/containers/{container}").To(monitoring.MonitorSpecificContainerOfSpecificNamespace).
Doc("Get specific container metrics under a given node and pod."). Doc("Get specific container metrics under a given node and pod.").
Param(ws.PathParameter("namespace", "Specify the target namespace.").DataType("string").Required(true)). Param(ws.PathParameter("namespace", "Specify the target namespace.").DataType("string").Required(true)).
Param(ws.PathParameter("pod", "Specify the target pod.").DataType("string").Required(true)). Param(ws.PathParameter("pod", "Specify the target pod.").DataType("string").Required(true)).
@@ -229,7 +229,7 @@ func addWebService(c *restful.Container) error {
// Only use this api to monitor status of pods under the {workload} // 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" // 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.MonitorWorkload). ws.Route(ws.GET("/namespaces/{namespace}/workloads/{workload_kind}/{workload}").To(monitoring.MonitorSpecificWorkload).
Doc("Get specific workload metrics under a given namespace."). Doc("Get specific workload metrics under a given namespace.").
Param(ws.PathParameter("namespace", "Specify the target namespace.").DataType("string").Required(true)). 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("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("(.*)")).
@@ -245,7 +245,7 @@ func addWebService(c *restful.Container) error {
Consumes(restful.MIME_JSON, restful.MIME_XML). Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON) Produces(restful.MIME_JSON)
ws.Route(ws.GET("/namespaces/{namespace}/workloads/{workload_kind}").To(monitoring.MonitorWorkload). ws.Route(ws.GET("/namespaces/{namespace}/workloads/{workload_kind}").To(monitoring.MonitorAllWorkloadsOfSpecificKind).
Doc("Get workload-level metrics of specific workload kind."). Doc("Get workload-level metrics of specific workload kind.").
Param(ws.PathParameter("namespace", "Specify the target namespace.").DataType("string").Required(true)). 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("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("(.*)")).
@@ -253,8 +253,8 @@ func addWebService(c *restful.Container) error {
Param(ws.QueryParameter("resources_filter", "Workload filter in regexp pattern.").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)). Param(ws.QueryParameter("sort_metric", "Sort workloads by the specified metric. Valid only if type is rank.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)).
Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("int").Required(false).DefaultValue("1")). Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("integer").Required(false).DefaultValue("1")).
Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("int").Required(false).DefaultValue("5")). Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("integer").Required(false).DefaultValue("5")).
Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)). Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags). Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(metrics.FormatedLevelMetric{}). Writes(metrics.FormatedLevelMetric{}).
@@ -262,15 +262,15 @@ func addWebService(c *restful.Container) error {
Consumes(restful.MIME_JSON, restful.MIME_XML). Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON) Produces(restful.MIME_JSON)
ws.Route(ws.GET("/namespaces/{namespace}/workloads").To(monitoring.MonitorWorkload). ws.Route(ws.GET("/namespaces/{namespace}/workloads").To(monitoring.MonitorAllWorkloadsOfSpecificNamespace).
Doc("Get workload-level metrics under a given namespace."). Doc("Get workload-level metrics under a given namespace.").
Param(ws.PathParameter("namespace", "Specify the target namespace.").DataType("string").Required(true)). Param(ws.PathParameter("namespace", "Specify the target namespace.").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("metrics_filter", "Metrics filter in regexp pattern, eg. workload_cpu|workload_memory.").DataType("string").Required(false)).
Param(ws.QueryParameter("resources_filter", "Workload filter in regexp pattern.").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)). Param(ws.QueryParameter("sort_metric", "Sort workloads by the specified metric. Valid only if type is rank.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)).
Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("int").Required(false).DefaultValue("1")). Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("integer").Required(false).DefaultValue("1")).
Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("int").Required(false).DefaultValue("5")). Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("integer").Required(false).DefaultValue("5")).
Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)). Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags). Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(metrics.FormatedLevelMetric{}). Writes(metrics.FormatedLevelMetric{}).
@@ -279,7 +279,7 @@ func addWebService(c *restful.Container) error {
Produces(restful.MIME_JSON) Produces(restful.MIME_JSON)
// list all namespace in this workspace by selected metrics // list all namespace in this workspace by selected metrics
ws.Route(ws.GET("/workspaces/{workspace}").To(monitoring.MonitorOneWorkspace). ws.Route(ws.GET("/workspaces/{workspace}").To(monitoring.MonitorSpecificWorkspace).
Doc("Get specific workspace metrics."). Doc("Get specific workspace metrics.").
Param(ws.PathParameter("workspace", "Specify the target workspace.").DataType("string").Required(true)). Param(ws.PathParameter("workspace", "Specify the target workspace.").DataType("string").Required(true)).
Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. workspace_cpu|workspace_memory.").DataType("string").Required(false)). Param(ws.QueryParameter("metrics_filter", "Metrics filter in regexp pattern, eg. workspace_cpu|workspace_memory.").DataType("string").Required(false)).
@@ -299,8 +299,8 @@ func addWebService(c *restful.Container) error {
Param(ws.QueryParameter("resources_filter", "Workspace filter in regexp pattern, eg. workspace_1|workspace_2.").DataType("string").Required(false)). Param(ws.QueryParameter("resources_filter", "Workspace filter in regexp pattern, eg. workspace_1|workspace_2.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_metric", "Sort workspaces by the specified metric. Valid only if type is rank.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_metric", "Sort workspaces by the specified metric. Valid only if type is rank.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)). Param(ws.QueryParameter("sort_type", "Sorting order, one of asc, desc. Valid only if type is rank.").DefaultValue("desc.").DataType("string").Required(false)).
Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("int").Required(false).DefaultValue("1")). Param(ws.QueryParameter("page", "The number of paged results per metric. Default to return the whole metrics.").DataType("integer").Required(false).DefaultValue("1")).
Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("int").Required(false).DefaultValue("5")). Param(ws.QueryParameter("limit", "Max count of items per page.").DataType("integer").Required(false).DefaultValue("5")).
Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)). Param(ws.QueryParameter("type", "Additional operation to the result. One of rank, statistic.").DataType("string").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags). Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(metrics.FormatedLevelMetric{}). Writes(metrics.FormatedLevelMetric{}).

View File

@@ -27,11 +27,11 @@ import (
"kubesphere.io/kubesphere/pkg/apiserver/tenant" "kubesphere.io/kubesphere/pkg/apiserver/tenant"
"kubesphere.io/kubesphere/pkg/models/devops" "kubesphere.io/kubesphere/pkg/models/devops"
"kubesphere.io/kubesphere/pkg/params" "kubesphere.io/kubesphere/pkg/params"
esclient "kubesphere.io/kubesphere/pkg/simple/client/elasticsearch"
"kubesphere.io/kubesphere/pkg/errors" "kubesphere.io/kubesphere/pkg/errors"
"kubesphere.io/kubesphere/pkg/models" "kubesphere.io/kubesphere/pkg/models"
"net/http" "net/http"
) )
@@ -118,7 +118,6 @@ func addWebService(c *restful.Container) error {
Required(false). Required(false).
DataFormat("key=%s,key~%s")). DataFormat("key=%s,key~%s")).
Doc("List devops projects for the current user"). Doc("List devops projects for the current user").
Metadata(restfulspec.KeyOpenAPITags, tags)) Metadata(restfulspec.KeyOpenAPITags, tags))
ws.Route(ws.GET("/workspaces/{workspace}/members/{username}/devops"). ws.Route(ws.GET("/workspaces/{workspace}/members/{username}/devops").
To(tenant.ListDevopsProjects). To(tenant.ListDevopsProjects).
@@ -151,7 +150,29 @@ func addWebService(c *restful.Container) error {
ws.Route(ws.GET("/logging"). ws.Route(ws.GET("/logging").
To(tenant.LogQuery). To(tenant.LogQuery).
Doc("Query cluster-level logs in a multi-tenants environment"). Doc("Query cluster-level logs in a multi-tenants environment").
Metadata(restfulspec.KeyOpenAPITags, tags)) Param(ws.QueryParameter("operation", "Query operation type. One of query, statistics, histogram.").DataType("string").Required(true)).
Param(ws.QueryParameter("workspaces", "List of workspaces the query will perform against, eg. wk-one,wk-two").DataType("string").Required(false)).
Param(ws.QueryParameter("workspace_query", "List of keywords for filtering workspaces. Workspaces whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("namespaces", "List of namespaces the query will perform against, eg. ns-one,ns-two").DataType("string").Required(false)).
Param(ws.QueryParameter("namespace_query", "List of keywords for filtering namespaces. Namespaces whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("workloads", "List of workloads the query will perform against, eg. wl-one,wl-two").DataType("string").Required(false)).
Param(ws.QueryParameter("workload_query", "List of keywords for filtering workloads. Workloads whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("pods", "List of pods the query will perform against, eg. pod-one,pod-two").DataType("string").Required(false)).
Param(ws.QueryParameter("pod_query", "List of keywords for filtering pods. Pods whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("containers", "List of containers the query will perform against, eg. container-one,container-two").DataType("string").Required(false)).
Param(ws.QueryParameter("container_query", "List of keywords for filtering containers. Containers whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("log_query", "List of keywords for filtering logs. The query returns log containing at least one keyword. Non case-sensitive matching. eg. err,INFO.").DataType("string").Required(false)).
Param(ws.QueryParameter("interval", "Count logs at intervals. Valid only if operation is histogram. The unit can be ms(milliseconds), s(seconds), m(minutes), h(hours), d(days), w(weeks), M(months), q(quarters), y(years). eg. 30m.").DataType("string").Required(false)).
Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("integer").DefaultValue("0").Required(false)).
Param(ws.QueryParameter("size", "Size of result to return.").DataType("integer").DefaultValue("10").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(esclient.Response{}).
Returns(http.StatusOK, RespOK, esclient.Response{})).
Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON)
c.Add(ws) c.Add(ws)
return nil return nil

View File

@@ -23,6 +23,22 @@ import (
"kubesphere.io/kubesphere/pkg/simple/client/prometheus" "kubesphere.io/kubesphere/pkg/simple/client/prometheus"
) )
func MonitorAllPodsOfSpecificNamespace(request *restful.Request, response *restful.Response) {
MonitorPod(request, response)
}
func MonitorSpecificPodOfSpecificNamespace(request *restful.Request, response *restful.Response) {
MonitorPod(request, response)
}
func MonitorAllPodsOnSpecificNode(request *restful.Request, response *restful.Response) {
MonitorPod(request, response)
}
func MonitorSpecificPodOnSpecificNode(request *restful.Request, response *restful.Response) {
MonitorPod(request, response)
}
func MonitorPod(request *restful.Request, response *restful.Response) { func MonitorPod(request *restful.Request, response *restful.Response) {
requestParams := prometheus.ParseMonitoringRequestParams(request) requestParams := prometheus.ParseMonitoringRequestParams(request)
podName := requestParams.PodName podName := requestParams.PodName
@@ -48,6 +64,18 @@ func MonitorPod(request *restful.Request, response *restful.Response) {
} }
} }
func MonitorAllContainersOnSpecificNode(request *restful.Request, response *restful.Response) {
MonitorContainer(request, response)
}
func MonitorAllContainersOfSpecificNamespace(request *restful.Request, response *restful.Response) {
MonitorContainer(request, response)
}
func MonitorSpecificContainerOfSpecificNamespace(request *restful.Request, response *restful.Response) {
MonitorContainer(request, response)
}
func MonitorContainer(request *restful.Request, response *restful.Response) { func MonitorContainer(request *restful.Request, response *restful.Response) {
requestParams := prometheus.ParseMonitoringRequestParams(request) requestParams := prometheus.ParseMonitoringRequestParams(request)
metricName := requestParams.MetricsName metricName := requestParams.MetricsName
@@ -67,6 +95,18 @@ func MonitorContainer(request *restful.Request, response *restful.Response) {
} }
func MonitorSpecificWorkload(request *restful.Request, response *restful.Response) {
MonitorWorkload(request, response)
}
func MonitorAllWorkloadsOfSpecificKind(request *restful.Request, response *restful.Response) {
MonitorWorkload(request, response)
}
func MonitorAllWorkloadsOfSpecificNamespace(request *restful.Request, response *restful.Response) {
MonitorWorkload(request, response)
}
func MonitorWorkload(request *restful.Request, response *restful.Response) { func MonitorWorkload(request *restful.Request, response *restful.Response) {
requestParams := prometheus.ParseMonitoringRequestParams(request) requestParams := prometheus.ParseMonitoringRequestParams(request)
@@ -108,7 +148,7 @@ func MonitorAllWorkspaces(request *restful.Request, response *restful.Response)
} }
} }
func MonitorOneWorkspace(request *restful.Request, response *restful.Response) { func MonitorSpecificWorkspace(request *restful.Request, response *restful.Response) {
requestParams := prometheus.ParseMonitoringRequestParams(request) requestParams := prometheus.ParseMonitoringRequestParams(request)
tp := requestParams.Tp tp := requestParams.Tp
@@ -135,6 +175,14 @@ func MonitorOneWorkspace(request *restful.Request, response *restful.Response) {
} }
} }
func MonitorAllNamespaces(request *restful.Request, response *restful.Response) {
MonitorNamespace(request, response)
}
func MonitorSpecificNamespace(request *restful.Request, response *restful.Response) {
MonitorNamespace(request, response)
}
func MonitorNamespace(request *restful.Request, response *restful.Response) { func MonitorNamespace(request *restful.Request, response *restful.Response) {
requestParams := prometheus.ParseMonitoringRequestParams(request) requestParams := prometheus.ParseMonitoringRequestParams(request)
// multiple // multiple
@@ -165,6 +213,14 @@ func MonitorCluster(request *restful.Request, response *restful.Response) {
} }
} }
func MonitorAllNodes(request *restful.Request, response *restful.Response) {
MonitorNode(request, response)
}
func MonitorSpecificNode(request *restful.Request, response *restful.Response) {
MonitorNode(request, response)
}
func MonitorNode(request *restful.Request, response *restful.Response) { func MonitorNode(request *restful.Request, response *restful.Response) {
requestParams := prometheus.ParseMonitoringRequestParams(request) requestParams := prometheus.ParseMonitoringRequestParams(request)