diff --git a/internal/dashboard/generated/bindata/bindata.go b/internal/dashboard/generated/bindata/bindata.go index d77134e51..a88284f76 100644 --- a/internal/dashboard/generated/bindata/bindata.go +++ b/internal/dashboard/generated/bindata/bindata.go @@ -108,7 +108,7 @@ func internalAssetsCliTemplatesComponent_configYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/cli-templates/component_config.yaml", size: 163, mode: os.FileMode(420), modTime: time.Unix(1724724442, 0)} + info := bindataFileInfo{name: "internal/assets/cli-templates/component_config.yaml", size: 163, mode: os.FileMode(420), modTime: time.Unix(1725263522, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -128,7 +128,7 @@ func internalAssetsMetric_en_usYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/metric_en_US.yaml", size: 27520, mode: os.FileMode(420), modTime: time.Unix(1715839515, 0)} + info := bindataFileInfo{name: "internal/assets/metric_en_US.yaml", size: 27520, mode: os.FileMode(420), modTime: time.Unix(1717678285, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -148,7 +148,7 @@ func internalAssetsMetric_exprYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/metric_expr.yaml", size: 37653, mode: os.FileMode(420), modTime: time.Unix(1715839515, 0)} + info := bindataFileInfo{name: "internal/assets/metric_expr.yaml", size: 37653, mode: os.FileMode(420), modTime: time.Unix(1717678285, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -168,7 +168,7 @@ func internalAssetsMetric_zh_cnYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/metric_zh_CN.yaml", size: 31134, mode: os.FileMode(420), modTime: time.Unix(1719989335, 0)} + info := bindataFileInfo{name: "internal/assets/metric_zh_CN.yaml", size: 31134, mode: os.FileMode(420), modTime: time.Unix(1718871532, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -188,7 +188,7 @@ func internalAssetsReceiver_templatesDiscord_configYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/receiver_templates/discord_config.yaml", size: 228, mode: os.FileMode(420), modTime: time.Unix(1717645444, 0)} + info := bindataFileInfo{name: "internal/assets/receiver_templates/discord_config.yaml", size: 228, mode: os.FileMode(420), modTime: time.Unix(1717678285, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -208,7 +208,7 @@ func internalAssetsReceiver_templatesEmail_configYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/receiver_templates/email_config.yaml", size: 351, mode: os.FileMode(420), modTime: time.Unix(1717645444, 0)} + info := bindataFileInfo{name: "internal/assets/receiver_templates/email_config.yaml", size: 351, mode: os.FileMode(420), modTime: time.Unix(1717678285, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -228,7 +228,7 @@ func internalAssetsReceiver_templatesMsteams_configYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/receiver_templates/msteams_config.yaml", size: 197, mode: os.FileMode(420), modTime: time.Unix(1717645444, 0)} + info := bindataFileInfo{name: "internal/assets/receiver_templates/msteams_config.yaml", size: 197, mode: os.FileMode(420), modTime: time.Unix(1717678285, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -248,7 +248,7 @@ func internalAssetsReceiver_templatesOpsgenie_configYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/receiver_templates/opsgenie_config.yaml", size: 774, mode: os.FileMode(420), modTime: time.Unix(1717645444, 0)} + info := bindataFileInfo{name: "internal/assets/receiver_templates/opsgenie_config.yaml", size: 774, mode: os.FileMode(420), modTime: time.Unix(1717678285, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -268,7 +268,7 @@ func internalAssetsReceiver_templatesPagerduty_configYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/receiver_templates/pagerduty_config.yaml", size: 1065, mode: os.FileMode(420), modTime: time.Unix(1717645444, 0)} + info := bindataFileInfo{name: "internal/assets/receiver_templates/pagerduty_config.yaml", size: 1065, mode: os.FileMode(420), modTime: time.Unix(1717678285, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -288,7 +288,7 @@ func internalAssetsReceiver_templatesPushover_configYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/receiver_templates/pushover_config.yaml", size: 940, mode: os.FileMode(420), modTime: time.Unix(1717645444, 0)} + info := bindataFileInfo{name: "internal/assets/receiver_templates/pushover_config.yaml", size: 940, mode: os.FileMode(420), modTime: time.Unix(1717678285, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -308,7 +308,7 @@ func internalAssetsReceiver_templatesSlack_configYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/receiver_templates/slack_config.yaml", size: 254, mode: os.FileMode(420), modTime: time.Unix(1717645444, 0)} + info := bindataFileInfo{name: "internal/assets/receiver_templates/slack_config.yaml", size: 254, mode: os.FileMode(420), modTime: time.Unix(1717678285, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -328,7 +328,7 @@ func internalAssetsReceiver_templatesSns_configYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/receiver_templates/sns_config.yaml", size: 477, mode: os.FileMode(420), modTime: time.Unix(1717645444, 0)} + info := bindataFileInfo{name: "internal/assets/receiver_templates/sns_config.yaml", size: 477, mode: os.FileMode(420), modTime: time.Unix(1717678285, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -348,7 +348,7 @@ func internalAssetsReceiver_templatesTelegram_configYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/receiver_templates/telegram_config.yaml", size: 441, mode: os.FileMode(420), modTime: time.Unix(1717645444, 0)} + info := bindataFileInfo{name: "internal/assets/receiver_templates/telegram_config.yaml", size: 441, mode: os.FileMode(420), modTime: time.Unix(1717678285, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -368,7 +368,7 @@ func internalAssetsReceiver_templatesVictorops_configYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/receiver_templates/victorops_config.yaml", size: 534, mode: os.FileMode(420), modTime: time.Unix(1717645444, 0)} + info := bindataFileInfo{name: "internal/assets/receiver_templates/victorops_config.yaml", size: 534, mode: os.FileMode(420), modTime: time.Unix(1717678285, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -388,7 +388,7 @@ func internalAssetsReceiver_templatesWebex_configYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/receiver_templates/webex_config.yaml", size: 313, mode: os.FileMode(420), modTime: time.Unix(1717645444, 0)} + info := bindataFileInfo{name: "internal/assets/receiver_templates/webex_config.yaml", size: 313, mode: os.FileMode(420), modTime: time.Unix(1717678285, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -408,7 +408,7 @@ func internalAssetsReceiver_templatesWebhook_configYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/receiver_templates/webhook_config.yaml", size: 183, mode: os.FileMode(420), modTime: time.Unix(1717645444, 0)} + info := bindataFileInfo{name: "internal/assets/receiver_templates/webhook_config.yaml", size: 183, mode: os.FileMode(420), modTime: time.Unix(1717678285, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -428,7 +428,7 @@ func internalAssetsReceiver_templatesWechat_configYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "internal/assets/receiver_templates/wechat_config.yaml", size: 491, mode: os.FileMode(420), modTime: time.Unix(1717645444, 0)} + info := bindataFileInfo{name: "internal/assets/receiver_templates/wechat_config.yaml", size: 491, mode: os.FileMode(420), modTime: time.Unix(1717678285, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/internal/dashboard/generated/swagger/docs.go b/internal/dashboard/generated/swagger/docs.go index 3d08767c3..2761dd4d6 100644 --- a/internal/dashboard/generated/swagger/docs.go +++ b/internal/dashboard/generated/swagger/docs.go @@ -4929,6 +4929,84 @@ const docTemplate = `{ } } }, + "/api/v1/obtenants/{namespace}/{name}/databases": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "List all the databases under obtenant", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "OBTenant" + ], + "summary": "List obtenant databases", + "operationId": "ListOBTenantDatabases", + "parameters": [ + { + "type": "string", + "description": "obtenant namespace", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "obtenant name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/api/v1/obtenants/{namespace}/{name}/logreplay": { "post": { "security": [ @@ -5604,6 +5682,84 @@ const docTemplate = `{ } } }, + "/api/v1/obtenants/{namespace}/{name}/users": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "List all the users under obtenant", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "OBTenant" + ], + "summary": "List obtenant users", + "operationId": "ListOBTenantUsers", + "parameters": [ + { + "type": "string", + "description": "obtenant namespace", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "obtenant name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/api/v1/obtenants/{namespace}/{name}/version": { "post": { "security": [ @@ -5679,14 +5835,14 @@ const docTemplate = `{ } } }, - "/api/v1/statistics": { + "/api/v1/sql/metrics": { "get": { "security": [ { "ApiKeyAuth": [] } ], - "description": "get statistic data", + "description": "list sqls metrics", "consumes": [ "application/json" ], @@ -5694,10 +5850,10 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Info" + "Sql" ], - "summary": "get statistic data", - "operationId": "GetStatistics", + "summary": "list sql metrics", + "operationId": "ListSqlMetrics", "responses": { "200": { "description": "OK", @@ -5710,7 +5866,10 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/response.StatisticData" + "type": "array", + "items": { + "$ref": "#/definitions/sql.SqlMetricMetaCategory" + } } } } @@ -5738,9 +5897,14 @@ const docTemplate = `{ } } }, - "/api/v1/webhook/alert/log": { + "/api/v1/sql/queryPlanDetailInfo": { "post": { - "description": "Log alerts sent by alertmanager.", + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "query detailed statistic info of a plan", "consumes": [ "application/json" ], @@ -5748,18 +5912,18 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Webhook" + "Sql" ], - "summary": "Log alerts", - "operationId": "LogAlerts", + "summary": "query plan detail info", + "operationId": "QueryPlanDetailInfo", "parameters": [ { - "description": "payload", + "description": "param for query detailed plan info", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/payload.WebhookPayload" + "$ref": "#/definitions/sql.PlanDetailParam" } } ], @@ -5775,7 +5939,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/response.DashboardInfo" + "$ref": "#/definitions/sql.PlanDetail" } } } @@ -5802,36 +5966,449 @@ const docTemplate = `{ } } } - } - }, - "definitions": { - "ac.Account": { - "type": "object", - "required": [ - "roles", - "username" - ], - "properties": { - "description": { - "type": "string" - }, - "lastLoginAt": { - "type": "string" - }, - "needReset": { - "type": "boolean" - }, - "nickname": { - "type": "string" - }, - "roles": { - "type": "array", - "items": { - "$ref": "#/definitions/ac.Role" + }, + "/api/v1/sql/querySqlDetailInfo": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "query detailed statistic info of a SQL", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Sql" + ], + "summary": "query SQL detail info", + "operationId": "QuerySqlDetailInfo", + "parameters": [ + { + "description": "param for query detailed sql info", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/sql.SqlDetailParam" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/sql.SqlDetailedInfo" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } } - }, - "username": { - "type": "string" + } + } + }, + "/api/v1/sql/requestStatistics": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "list request statistics", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Sql" + ], + "summary": "list request statistics", + "operationId": "RequestStatistics", + "parameters": [ + { + "description": "sql request statistic param", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/sql.SqlRequestStatisticParam" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.RequestStatisticInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, + "/api/v1/sql/suspiciousSqls": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "list suspicious sqls", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Sql" + ], + "summary": "list suspicious sqls", + "operationId": "ListSuspiciousSqls", + "parameters": [ + { + "description": "sql filter", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/sql.SqlFilter" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.SqlInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, + "/api/v1/sql/topSqls": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "list top sqls ordering by spcecific metrics", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Sql" + ], + "summary": "list top sqls", + "operationId": "ListTopSqls", + "parameters": [ + { + "description": "sql filter", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/sql.SqlFilter" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.SqlInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, + "/api/v1/statistics": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "get statistic data", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Info" + ], + "summary": "get statistic data", + "operationId": "GetStatistics", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.StatisticData" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, + "/api/v1/webhook/alert/log": { + "post": { + "description": "Log alerts sent by alertmanager.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Webhook" + ], + "summary": "Log alerts", + "operationId": "LogAlerts", + "parameters": [ + { + "description": "payload", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/payload.WebhookPayload" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.DashboardInfo" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + } + }, + "definitions": { + "ac.Account": { + "type": "object", + "required": [ + "roles", + "username" + ], + "properties": { + "description": { + "type": "string" + }, + "lastLoginAt": { + "type": "string" + }, + "needReset": { + "type": "boolean" + }, + "nickname": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/ac.Role" + } + }, + "username": { + "type": "string" } } }, @@ -7946,511 +8523,829 @@ const docTemplate = `{ "memoryTotal": { "type": "number" }, - "memoryUsed": { - "type": "number" + "memoryUsed": { + "type": "number" + } + } + }, + "response.K8sPodInfo": { + "type": "object", + "required": [ + "containers", + "message", + "name", + "namespace", + "nodeName", + "podIP", + "reason", + "startTime", + "status" + ], + "properties": { + "containers": { + "type": "array", + "items": { + "$ref": "#/definitions/response.ContainerInfo" + } + }, + "message": { + "type": "string" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "nodeName": { + "type": "string" + }, + "podIP": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "startTime": { + "type": "string" + }, + "status": { + "type": "string" + } + } + }, + "response.K8sService": { + "type": "object", + "required": [ + "clusterIP", + "name", + "namespace", + "ports", + "type" + ], + "properties": { + "clusterIP": { + "type": "string" + }, + "externalIP": { + "type": "string" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "ports": { + "type": "array", + "items": { + "$ref": "#/definitions/response.K8sServicePort" + } + }, + "type": { + "type": "string" + } + } + }, + "response.K8sServicePort": { + "type": "object", + "required": [ + "port", + "targetPort" + ], + "properties": { + "name": { + "type": "string" + }, + "nodePort": { + "type": "integer" + }, + "port": { + "type": "integer" + }, + "targetPort": { + "type": "integer" + } + } + }, + "response.Metric": { + "type": "object", + "properties": { + "labels": { + "type": "array", + "items": { + "$ref": "#/definitions/common.KVPair" + } + }, + "name": { + "type": "string" + } + } + }, + "response.MetricClass": { + "type": "object", + "required": [ + "description", + "metricGroups", + "name" + ], + "properties": { + "description": { + "type": "string" + }, + "metricGroups": { + "type": "array", + "items": { + "$ref": "#/definitions/response.MetricGroup" + } + }, + "name": { + "type": "string" + } + } + }, + "response.MetricData": { + "type": "object", + "required": [ + "metric", + "values" + ], + "properties": { + "metric": { + "$ref": "#/definitions/response.Metric" + }, + "values": { + "type": "array", + "items": { + "$ref": "#/definitions/response.MetricValue" + } + } + } + }, + "response.MetricGroup": { + "type": "object", + "required": [ + "description", + "metrics", + "name" + ], + "properties": { + "description": { + "type": "string" + }, + "metrics": { + "type": "array", + "items": { + "$ref": "#/definitions/response.MetricMeta" + } + }, + "name": { + "type": "string" + } + } + }, + "response.MetricMeta": { + "type": "object", + "required": [ + "description", + "key", + "name", + "unit" + ], + "properties": { + "description": { + "type": "string" + }, + "key": { + "type": "string" + }, + "name": { + "type": "string" + }, + "unit": { + "type": "string" + } + } + }, + "response.MetricValue": { + "type": "object", + "required": [ + "timestamp", + "value" + ], + "properties": { + "timestamp": { + "type": "number" + }, + "value": { + "type": "number" + } + } + }, + "response.MonitorSpec": { + "type": "object", + "required": [ + "image", + "resource" + ], + "properties": { + "image": { + "type": "string" + }, + "resource": { + "$ref": "#/definitions/response.ResourceSpecRender" + } + } + }, + "response.NFSVolumeSpec": { + "type": "object", + "required": [ + "address", + "path" + ], + "properties": { + "address": { + "type": "string" + }, + "path": { + "type": "string" } } }, - "response.K8sPodInfo": { + "response.Namespace": { "type": "object", "required": [ - "containers", - "message", - "name", "namespace", - "nodeName", - "podIP", - "reason", - "startTime", "status" ], "properties": { - "containers": { - "type": "array", - "items": { - "$ref": "#/definitions/response.ContainerInfo" - } - }, - "message": { - "type": "string" - }, - "name": { - "type": "string" - }, "namespace": { "type": "string" }, - "nodeName": { - "type": "string" - }, - "podIP": { - "type": "string" - }, - "reason": { - "type": "string" - }, - "startTime": { - "type": "string" - }, "status": { "type": "string" } } }, - "response.K8sService": { + "response.OBCluster": { "type": "object", "required": [ - "clusterIP", + "clusterId", + "clusterName", + "createTime", + "image", + "mode", "name", "namespace", - "ports", - "type" + "parameters", + "resource", + "rootPasswordSecret", + "status", + "statusDetail", + "storage", + "topology", + "uid" ], "properties": { - "clusterIP": { + "backupVolume": { + "$ref": "#/definitions/response.NFSVolumeSpec" + }, + "clusterId": { + "type": "integer" + }, + "clusterName": { "type": "string" }, - "externalIP": { + "createTime": { + "type": "integer" + }, + "image": { "type": "string" }, + "metrics": { + "$ref": "#/definitions/response.OBMetrics" + }, + "mode": { + "$ref": "#/definitions/common.ClusterMode" + }, + "monitor": { + "$ref": "#/definitions/response.MonitorSpec" + }, "name": { "type": "string" }, "namespace": { "type": "string" }, - "ports": { + "parameters": { "type": "array", "items": { - "$ref": "#/definitions/response.K8sServicePort" + "$ref": "#/definitions/common.KVPair" } }, - "type": { + "resource": { + "$ref": "#/definitions/response.ResourceSpecRender" + }, + "rootPasswordSecret": { "type": "string" - } - } - }, - "response.K8sServicePort": { - "type": "object", - "required": [ - "port", - "targetPort" - ], - "properties": { - "name": { + }, + "status": { "type": "string" }, - "nodePort": { - "type": "integer" + "statusDetail": { + "type": "string" }, - "port": { - "type": "integer" + "storage": { + "$ref": "#/definitions/response.OBServerStorage" }, - "targetPort": { - "type": "integer" - } - } - }, - "response.Metric": { - "type": "object", - "properties": { - "labels": { + "topology": { "type": "array", "items": { - "$ref": "#/definitions/common.KVPair" + "$ref": "#/definitions/response.OBZone" } }, - "name": { + "uid": { + "type": "string" + }, + "version": { "type": "string" } } }, - "response.MetricClass": { + "response.OBClusterOverview": { "type": "object", "required": [ - "description", - "metricGroups", - "name" + "clusterId", + "clusterName", + "createTime", + "image", + "mode", + "name", + "namespace", + "status", + "statusDetail", + "topology", + "uid" ], "properties": { - "description": { + "clusterId": { + "type": "integer" + }, + "clusterName": { "type": "string" }, - "metricGroups": { + "createTime": { + "type": "integer" + }, + "image": { + "type": "string" + }, + "mode": { + "$ref": "#/definitions/common.ClusterMode" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "status": { + "type": "string" + }, + "statusDetail": { + "type": "string" + }, + "topology": { "type": "array", "items": { - "$ref": "#/definitions/response.MetricGroup" + "$ref": "#/definitions/response.OBZone" } }, - "name": { + "uid": { "type": "string" } } }, - "response.MetricData": { + "response.OBClusterResources": { "type": "object", "required": [ - "metric", - "values" + "minPoolMemory" ], "properties": { - "metric": { - "$ref": "#/definitions/response.Metric" + "minPoolMemory": { + "type": "integer", + "example": 2147483648 }, - "values": { + "obServerResources": { "type": "array", "items": { - "$ref": "#/definitions/response.MetricValue" + "$ref": "#/definitions/response.OBServerAvailableResource" + } + }, + "obZoneResourceMap": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/response.OBZoneAvailableResource" } } } }, - "response.MetricGroup": { + "response.OBClusterStatistic": { "type": "object", "required": [ - "description", - "metrics", - "name" + "count", + "status" ], "properties": { - "description": { - "type": "string" - }, - "metrics": { - "type": "array", - "items": { - "$ref": "#/definitions/response.MetricMeta" - } + "count": { + "type": "integer" }, - "name": { + "status": { "type": "string" } } }, - "response.MetricMeta": { + "response.OBConnection": { "type": "object", - "required": [ - "description", - "key", - "name", - "unit" - ], "properties": { - "description": { + "clientIp": { "type": "string" }, - "key": { + "cluster": { "type": "string" }, - "name": { + "namespace": { "type": "string" }, - "unit": { + "odcConnectionURL": { + "type": "string" + }, + "pod": { + "type": "string" + }, + "tenant": { + "type": "string" + }, + "terminalId": { + "type": "string" + }, + "user": { "type": "string" } } }, - "response.MetricValue": { + "response.OBMetrics": { "type": "object", "required": [ - "timestamp", - "value" + "cpuPercent", + "diskPercent", + "memoryPercent" ], - "properties": { - "timestamp": { - "type": "number" + "properties": { + "cpuPercent": { + "type": "integer" }, - "value": { - "type": "number" + "diskPercent": { + "type": "integer" + }, + "memoryPercent": { + "type": "integer" } } }, - "response.MonitorSpec": { + "response.OBServer": { "type": "object", "required": [ - "image", - "resource" + "address", + "name", + "namespace", + "status", + "statusDetail" ], "properties": { - "image": { + "address": { "type": "string" }, - "resource": { - "$ref": "#/definitions/response.ResourceSpecRender" + "metrics": { + "$ref": "#/definitions/response.OBMetrics" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "status": { + "type": "string" + }, + "statusDetail": { + "type": "string" } } }, - "response.NFSVolumeSpec": { + "response.OBServerAvailableResource": { "type": "object", "required": [ - "address", - "path" + "availableCPU", + "availableDataDisk", + "availableLogDisk", + "availableMemory", + "obServerIP", + "obZone", + "serverCount" ], "properties": { - "address": { - "type": "string" + "availableCPU": { + "type": "integer", + "example": 12 }, - "path": { + "availableDataDisk": { + "type": "integer", + "example": 16106127360 + }, + "availableLogDisk": { + "type": "integer", + "example": 5368709120 + }, + "availableMemory": { + "type": "integer", + "example": 5368709120 + }, + "obServerIP": { "type": "string" + }, + "obZone": { + "type": "string", + "example": "zone1" + }, + "serverCount": { + "type": "integer", + "example": 3 } } }, - "response.Namespace": { + "response.OBServerStorage": { "type": "object", "required": [ - "namespace", - "status" + "dataStorage", + "redoLogStorage", + "sysLogStorage" ], "properties": { - "namespace": { - "type": "string" + "dataStorage": { + "$ref": "#/definitions/response.StorageSpec" }, - "status": { - "type": "string" + "redoLogStorage": { + "$ref": "#/definitions/response.StorageSpec" + }, + "sysLogStorage": { + "$ref": "#/definitions/response.StorageSpec" } } }, - "response.OBCluster": { + "response.OBTenantDetail": { "type": "object", "required": [ - "clusterId", - "clusterName", + "charset", + "clusterResourceName", "createTime", - "image", - "mode", + "locality", "name", "namespace", - "parameters", - "resource", - "rootPasswordSecret", + "primaryZone", "status", - "statusDetail", - "storage", - "topology", - "uid" + "tenantName", + "tenantRole", + "uid", + "unitNumber" ], "properties": { - "backupVolume": { - "$ref": "#/definitions/response.NFSVolumeSpec" - }, - "clusterId": { - "type": "integer" + "charset": { + "description": "Charset of the tenant", + "type": "string" }, - "clusterName": { + "clusterResourceName": { + "description": "Name of the cluster belonging to", "type": "string" }, "createTime": { - "type": "integer" - }, - "image": { + "description": "Creation time of the tenant", "type": "string" }, - "metrics": { - "$ref": "#/definitions/response.OBMetrics" - }, - "mode": { - "$ref": "#/definitions/common.ClusterMode" - }, - "monitor": { - "$ref": "#/definitions/response.MonitorSpec" + "locality": { + "description": "Locality of the tenant units", + "type": "string" }, "name": { + "description": "Name of the resource", "type": "string" }, "namespace": { + "description": "Namespace of the resource", "type": "string" }, - "parameters": { - "type": "array", - "items": { - "$ref": "#/definitions/common.KVPair" - } + "primaryTenant": { + "type": "string" }, - "resource": { - "$ref": "#/definitions/response.ResourceSpecRender" + "primaryZone": { + "description": "Primary zone of the tenant", + "type": "string" }, - "rootPasswordSecret": { + "restoreSource": { + "$ref": "#/definitions/response.RestoreSource" + }, + "rootCredential": { + "type": "string" + }, + "standbyROCredential": { "type": "string" }, "status": { + "description": "Status of the tenant", "type": "string" }, - "statusDetail": { + "tenantName": { + "description": "Name of the tenant in the database", "type": "string" }, - "storage": { - "$ref": "#/definitions/response.OBServerStorage" + "tenantRole": { + "description": "Enum: Primary, Standby", + "type": "string" }, "topology": { + "description": "Topology of the tenant", "type": "array", "items": { - "$ref": "#/definitions/response.OBZone" + "$ref": "#/definitions/response.OBTenantReplica" } }, "uid": { + "description": "Unique identifier of the resource", "type": "string" }, + "unitNumber": { + "description": "Number of units in every zone", + "type": "integer" + }, "version": { "type": "string" } } }, - "response.OBClusterOverview": { + "response.OBTenantOverview": { + "description": "Brief information about OBTenant", "type": "object", "required": [ - "clusterId", - "clusterName", + "charset", + "clusterResourceName", "createTime", - "image", - "mode", + "locality", "name", "namespace", + "primaryZone", "status", - "statusDetail", - "topology", - "uid" + "tenantName", + "tenantRole", + "uid", + "unitNumber" ], "properties": { - "clusterId": { - "type": "integer" + "charset": { + "description": "Charset of the tenant", + "type": "string" }, - "clusterName": { + "clusterResourceName": { + "description": "Name of the cluster belonging to", "type": "string" }, "createTime": { - "type": "integer" - }, - "image": { + "description": "Creation time of the tenant", "type": "string" }, - "mode": { - "$ref": "#/definitions/common.ClusterMode" + "locality": { + "description": "Locality of the tenant units", + "type": "string" }, "name": { + "description": "Name of the resource", "type": "string" }, "namespace": { + "description": "Namespace of the resource", + "type": "string" + }, + "primaryZone": { + "description": "Primary zone of the tenant", "type": "string" }, "status": { + "description": "Status of the tenant", "type": "string" }, - "statusDetail": { + "tenantName": { + "description": "Name of the tenant in the database", + "type": "string" + }, + "tenantRole": { + "description": "Enum: Primary, Standby", "type": "string" }, "topology": { + "description": "Topology of the tenant", "type": "array", "items": { - "$ref": "#/definitions/response.OBZone" + "$ref": "#/definitions/response.OBTenantReplica" } }, "uid": { + "description": "Unique identifier of the resource", "type": "string" + }, + "unitNumber": { + "description": "Number of units in every zone", + "type": "integer" } } }, - "response.OBClusterResources": { - "type": "object", - "required": [ - "minPoolMemory" - ], - "properties": { - "minPoolMemory": { - "type": "integer", - "example": 2147483648 - }, - "obServerResources": { - "type": "array", - "items": { - "$ref": "#/definitions/response.OBServerAvailableResource" - } - }, - "obZoneResourceMap": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/response.OBZoneAvailableResource" - } - } - } - }, - "response.OBClusterStatistic": { + "response.OBTenantReplica": { "type": "object", "required": [ - "count", - "status" + "iopsWeight", + "logDiskSize", + "maxCPU", + "maxIops", + "memorySize", + "minCPU", + "minIops", + "priority", + "type", + "zone" ], "properties": { - "count": { + "iopsWeight": { "type": "integer" }, - "status": { - "type": "string" - } - } - }, - "response.OBConnection": { - "type": "object", - "properties": { - "clientIp": { - "type": "string" + "logDiskSize": { + "type": "integer" }, - "cluster": { - "type": "string" + "maxCPU": { + "type": "integer" }, - "namespace": { - "type": "string" + "maxIops": { + "type": "integer" }, - "odcConnectionURL": { - "type": "string" + "memorySize": { + "type": "integer" }, - "pod": { - "type": "string" + "minCPU": { + "type": "integer" }, - "tenant": { - "type": "string" + "minIops": { + "type": "integer" }, - "terminalId": { + "priority": { + "type": "integer" + }, + "type": { + "description": "Enum: Readonly, Full", "type": "string" }, - "user": { + "zone": { "type": "string" } } }, - "response.OBMetrics": { + "response.OBTenantStatistic": { "type": "object", "required": [ - "cpuPercent", - "diskPercent", - "memoryPercent" + "count", + "status" ], "properties": { - "cpuPercent": { - "type": "integer" - }, - "diskPercent": { + "count": { "type": "integer" }, - "memoryPercent": { - "type": "integer" + "status": { + "type": "string" } } }, - "response.OBServer": { + "response.OBZone": { "type": "object", "required": [ - "address", "name", "namespace", + "replicas", "status", - "statusDetail" + "statusDetail", + "zone" ], "properties": { - "address": { - "type": "string" - }, - "metrics": { - "$ref": "#/definitions/response.OBMetrics" + "affinities": { + "type": "array", + "items": { + "$ref": "#/definitions/common.AffinitySpec" + } }, "name": { "type": "string" @@ -8458,22 +9353,48 @@ const docTemplate = `{ "namespace": { "type": "string" }, + "nodeSelector": { + "type": "array", + "items": { + "$ref": "#/definitions/common.KVPair" + } + }, + "observers": { + "type": "array", + "items": { + "$ref": "#/definitions/response.OBServer" + } + }, + "replicas": { + "type": "integer" + }, + "rootService": { + "type": "string" + }, "status": { "type": "string" }, "statusDetail": { "type": "string" + }, + "tolerations": { + "type": "array", + "items": { + "$ref": "#/definitions/common.KVPair" + } + }, + "zone": { + "type": "string" } } }, - "response.OBServerAvailableResource": { + "response.OBZoneAvailableResource": { "type": "object", "required": [ "availableCPU", "availableDataDisk", "availableLogDisk", "availableMemory", - "obServerIP", "obZone", "serverCount" ], @@ -8494,9 +9415,6 @@ const docTemplate = `{ "type": "integer", "example": 5368709120 }, - "obServerIP": { - "type": "string" - }, "obZone": { "type": "string", "example": "zone1" @@ -8507,895 +9425,1137 @@ const docTemplate = `{ } } }, - "response.OBServerStorage": { + "response.ResourceSpecRender": { "type": "object", "required": [ - "dataStorage", - "redoLogStorage", - "sysLogStorage" + "cpu", + "memory" ], "properties": { - "dataStorage": { - "$ref": "#/definitions/response.StorageSpec" + "cpu": { + "type": "integer" }, - "redoLogStorage": { - "$ref": "#/definitions/response.StorageSpec" + "memory": { + "type": "integer" + } + } + }, + "response.RestoreSource": { + "type": "object", + "required": [ + "archiveSource", + "bakDataSource", + "type" + ], + "properties": { + "archiveSource": { + "type": "string" }, - "sysLogStorage": { - "$ref": "#/definitions/response.StorageSpec" + "bakDataSource": { + "type": "string" + }, + "bakEncryptionSecret": { + "type": "string" + }, + "ossAccessSecret": { + "type": "string" + }, + "type": { + "description": "Enum: OSS, NFS", + "type": "string" + }, + "until": { + "type": "string" } } }, - "response.OBTenantDetail": { + "response.StatisticData": { "type": "object", "required": [ - "charset", - "clusterResourceName", - "createTime", - "locality", - "name", - "namespace", - "primaryZone", - "status", - "tenantName", - "tenantRole", - "uid", - "unitNumber" + "backupPolicies", + "clusters", + "k8sNodes", + "servers", + "tenants", + "warningEvents", + "zones" ], "properties": { - "charset": { - "description": "Charset of the tenant", + "backupPolicies": { + "type": "array", + "items": { + "$ref": "#/definitions/models.OBBackupPolicy" + } + }, + "clusters": { + "type": "array", + "items": { + "$ref": "#/definitions/models.OBCluster" + } + }, + "k8sNodes": { + "type": "array", + "items": { + "$ref": "#/definitions/response.K8sNode" + } + }, + "operatorVersion": { "type": "string" }, - "clusterResourceName": { - "description": "Name of the cluster belonging to", + "servers": { + "type": "array", + "items": { + "$ref": "#/definitions/models.OBServer" + } + }, + "tenants": { + "type": "array", + "items": { + "$ref": "#/definitions/models.OBTenant" + } + }, + "warningEvents": { + "type": "array", + "items": { + "$ref": "#/definitions/models.K8sEvent" + } + }, + "zones": { + "type": "array", + "items": { + "$ref": "#/definitions/models.OBZone" + } + } + } + }, + "response.StorageClass": { + "type": "object", + "required": [ + "allowVolumeExpansion", + "name", + "provisioner", + "reclaimPolicy", + "volumeBindingMode" + ], + "properties": { + "allowVolumeExpansion": { + "type": "boolean" + }, + "mountOptions": { + "type": "array", + "items": { + "type": "string" + } + }, + "name": { "type": "string" }, - "createTime": { - "description": "Creation time of the tenant", - "type": "string" + "parameters": { + "type": "array", + "items": { + "$ref": "#/definitions/common.KVPair" + } }, - "locality": { - "description": "Locality of the tenant units", + "provisioner": { "type": "string" }, - "name": { - "description": "Name of the resource", + "reclaimPolicy": { "type": "string" }, - "namespace": { - "description": "Namespace of the resource", + "volumeBindingMode": { "type": "string" + } + } + }, + "response.StorageSpec": { + "type": "object", + "required": [ + "size", + "storageClass" + ], + "properties": { + "size": { + "type": "integer" }, - "primaryTenant": { + "storageClass": { "type": "string" + } + } + }, + "route.RouteParam": { + "type": "object", + "required": [ + "aggregateLabels", + "groupInterval", + "groupWait", + "matchers", + "receiver", + "repeatInterval" + ], + "properties": { + "aggregateLabels": { + "type": "array", + "items": { + "type": "string" + } }, - "primaryZone": { - "description": "Primary zone of the tenant", - "type": "string" + "groupInterval": { + "type": "integer" }, - "restoreSource": { - "$ref": "#/definitions/response.RestoreSource" + "groupWait": { + "type": "integer" }, - "rootCredential": { + "id": { "type": "string" }, - "standbyROCredential": { - "type": "string" + "matchers": { + "type": "array", + "items": { + "$ref": "#/definitions/alarm.Matcher" + } }, - "status": { - "description": "Status of the tenant", + "receiver": { "type": "string" }, - "tenantName": { - "description": "Name of the tenant in the database", - "type": "string" + "repeatInterval": { + "type": "integer" + } + } + }, + "route.RouteResponse": { + "type": "object", + "required": [ + "aggregateLabels", + "groupInterval", + "groupWait", + "id", + "matchers", + "receiver", + "repeatInterval" + ], + "properties": { + "aggregateLabels": { + "type": "array", + "items": { + "type": "string" + } }, - "tenantRole": { - "description": "Enum: Primary, Standby", + "groupInterval": { + "type": "integer" + }, + "groupWait": { + "type": "integer" + }, + "id": { "type": "string" }, - "topology": { - "description": "Topology of the tenant", + "matchers": { "type": "array", "items": { - "$ref": "#/definitions/response.OBTenantReplica" + "$ref": "#/definitions/alarm.Matcher" } }, - "uid": { - "description": "Unique identifier of the resource", + "receiver": { "type": "string" }, - "unitNumber": { - "description": "Number of units in every zone", + "repeatInterval": { "type": "integer" - }, - "version": { - "type": "string" } } }, - "response.OBTenantOverview": { - "description": "Brief information about OBTenant", + "rule.Rule": { "type": "object", "required": [ - "charset", - "clusterResourceName", - "createTime", - "locality", + "description", + "duration", + "instanceType", + "labels", "name", - "namespace", - "primaryZone", - "status", - "tenantName", - "tenantRole", - "uid", - "unitNumber" + "query", + "severity", + "summary" ], "properties": { - "charset": { - "description": "Charset of the tenant", + "description": { "type": "string" }, - "clusterResourceName": { - "description": "Name of the cluster belonging to", - "type": "string" + "duration": { + "type": "integer" }, - "createTime": { - "description": "Creation time of the tenant", - "type": "string" + "instanceType": { + "$ref": "#/definitions/oceanbase.OBInstanceType" }, - "locality": { - "description": "Locality of the tenant units", - "type": "string" + "labels": { + "type": "array", + "items": { + "$ref": "#/definitions/common.KVPair" + } }, "name": { - "description": "Name of the resource", - "type": "string" - }, - "namespace": { - "description": "Namespace of the resource", - "type": "string" - }, - "primaryZone": { - "description": "Primary zone of the tenant", "type": "string" }, - "status": { - "description": "Status of the tenant", + "query": { "type": "string" }, - "tenantName": { - "description": "Name of the tenant in the database", - "type": "string" + "severity": { + "$ref": "#/definitions/alarm.Severity" }, - "tenantRole": { - "description": "Enum: Primary, Standby", + "summary": { "type": "string" }, - "topology": { - "description": "Topology of the tenant", - "type": "array", - "items": { - "$ref": "#/definitions/response.OBTenantReplica" - } + "type": { + "default": "customized", + "allOf": [ + { + "$ref": "#/definitions/rule.RuleType" + } + ] + } + } + }, + "rule.RuleFilter": { + "type": "object", + "properties": { + "instanceType": { + "$ref": "#/definitions/oceanbase.OBInstanceType" }, - "uid": { - "description": "Unique identifier of the resource", + "keyword": { "type": "string" }, - "unitNumber": { - "description": "Number of units in every zone", - "type": "integer" + "severity": { + "$ref": "#/definitions/alarm.Severity" } } }, - "response.OBTenantReplica": { + "rule.RuleHealth": { + "type": "string", + "enum": [ + "unknown", + "ok", + "error" + ], + "x-enum-varnames": [ + "HealthUnknown", + "HealthOK", + "HealthError" + ] + }, + "rule.RuleResponse": { "type": "object", "required": [ - "iopsWeight", - "logDiskSize", - "maxCPU", - "maxIops", - "memorySize", - "minCPU", - "minIops", - "priority", - "type", - "zone" + "description", + "duration", + "evaluationTime", + "health", + "instanceType", + "keepFiringFor", + "labels", + "lastEvaluation", + "name", + "query", + "severity", + "state", + "summary" ], "properties": { - "iopsWeight": { - "type": "integer" + "description": { + "type": "string" }, - "logDiskSize": { + "duration": { "type": "integer" }, - "maxCPU": { - "type": "integer" + "evaluationTime": { + "type": "number" }, - "maxIops": { - "type": "integer" + "health": { + "$ref": "#/definitions/rule.RuleHealth" }, - "memorySize": { - "type": "integer" + "instanceType": { + "$ref": "#/definitions/oceanbase.OBInstanceType" }, - "minCPU": { + "keepFiringFor": { "type": "integer" }, - "minIops": { - "type": "integer" + "labels": { + "type": "array", + "items": { + "$ref": "#/definitions/common.KVPair" + } }, - "priority": { + "lastError": { + "type": "string" + }, + "lastEvaluation": { "type": "integer" }, - "type": { - "description": "Enum: Readonly, Full", + "name": { "type": "string" }, - "zone": { + "query": { + "type": "string" + }, + "severity": { + "$ref": "#/definitions/alarm.Severity" + }, + "state": { + "$ref": "#/definitions/rule.RuleState" + }, + "summary": { "type": "string" + }, + "type": { + "default": "customized", + "allOf": [ + { + "$ref": "#/definitions/rule.RuleType" + } + ] } } }, - "response.OBTenantStatistic": { - "type": "object", - "required": [ - "count", - "status" + "rule.RuleState": { + "type": "string", + "enum": [ + "active", + "inactive" + ], + "x-enum-varnames": [ + "StateActive", + "StateInactive" + ] + }, + "rule.RuleType": { + "type": "string", + "enum": [ + "builtin", + "customized" ], + "x-enum-varnames": [ + "TypeBuiltin", + "TypeCustomized" + ] + }, + "silence.SilencerFilter": { + "type": "object", "properties": { - "count": { - "type": "integer" + "instance": { + "$ref": "#/definitions/oceanbase.OBInstance" }, - "status": { + "instanceType": { + "$ref": "#/definitions/oceanbase.OBInstanceType" + }, + "keyword": { "type": "string" } } }, - "response.OBZone": { + "silence.SilencerParam": { "type": "object", "required": [ - "name", - "namespace", - "replicas", - "status", - "statusDetail", - "zone" + "comment", + "createdBy", + "endsAt", + "instances", + "matchers", + "rules", + "startsAt" ], "properties": { - "affinities": { - "type": "array", - "items": { - "$ref": "#/definitions/common.AffinitySpec" - } + "comment": { + "type": "string" }, - "name": { + "createdBy": { "type": "string" }, - "namespace": { + "endsAt": { + "type": "integer" + }, + "id": { "type": "string" }, - "nodeSelector": { + "instances": { "type": "array", "items": { - "$ref": "#/definitions/common.KVPair" + "$ref": "#/definitions/oceanbase.OBInstance" } }, - "observers": { + "matchers": { "type": "array", "items": { - "$ref": "#/definitions/response.OBServer" + "$ref": "#/definitions/alarm.Matcher" } }, - "replicas": { - "type": "integer" + "rules": { + "type": "array", + "items": { + "type": "string" + } }, - "rootService": { + "startsAt": { + "type": "integer" + } + } + }, + "silence.SilencerResponse": { + "type": "object", + "required": [ + "comment", + "createdBy", + "endsAt", + "id", + "instances", + "matchers", + "rules", + "startsAt", + "status", + "updatedAt" + ], + "properties": { + "comment": { "type": "string" }, - "status": { + "createdBy": { "type": "string" }, - "statusDetail": { + "endsAt": { + "type": "integer" + }, + "id": { "type": "string" }, - "tolerations": { + "instances": { "type": "array", "items": { - "$ref": "#/definitions/common.KVPair" + "$ref": "#/definitions/oceanbase.OBInstance" } }, - "zone": { - "type": "string" + "matchers": { + "type": "array", + "items": { + "$ref": "#/definitions/alarm.Matcher" + } + }, + "rules": { + "type": "array", + "items": { + "type": "string" + } + }, + "startsAt": { + "type": "integer" + }, + "status": { + "$ref": "#/definitions/silence.Status" + }, + "updatedAt": { + "type": "integer" } } }, - "response.OBZoneAvailableResource": { + "silence.State": { + "type": "string", + "enum": [ + "active", + "expired", + "pending" + ], + "x-enum-varnames": [ + "StateActive", + "StateExpired", + "StatePending" + ] + }, + "silence.Status": { "type": "object", "required": [ - "availableCPU", - "availableDataDisk", - "availableLogDisk", - "availableMemory", - "obZone", - "serverCount" + "state" ], "properties": { - "availableCPU": { - "type": "integer", - "example": 12 - }, - "availableDataDisk": { - "type": "integer", - "example": 16106127360 + "state": { + "$ref": "#/definitions/silence.State" + } + } + }, + "sql.IndexCategory": { + "type": "string", + "enum": [ + "primaryKey", + "globalNormal", + "globalUnique", + "localNormal", + "localUnique" + ], + "x-enum-varnames": [ + "IndexCategoryPrimaryKey", + "IndexCategoryGlobalNormal", + "IndexCategoryGlobalUnique", + "IndexCategoryLocalNormal", + "IndexCategoryLocalUnique" + ] + }, + "sql.IndexInfo": { + "type": "object", + "required": [ + "category", + "columns", + "indexName", + "status", + "tableName" + ], + "properties": { + "category": { + "$ref": "#/definitions/sql.IndexCategory" }, - "availableLogDisk": { - "type": "integer", - "example": 5368709120 + "columns": { + "type": "array", + "items": { + "type": "string" + } }, - "availableMemory": { - "type": "integer", - "example": 5368709120 + "indexName": { + "type": "string" }, - "obZone": { - "type": "string", - "example": "zone1" + "status": { + "$ref": "#/definitions/sql.IndexStatus" }, - "serverCount": { - "type": "integer", - "example": 3 + "tableName": { + "type": "string" } } }, - "response.ResourceSpecRender": { + "sql.IndexStatus": { + "type": "string", + "enum": [ + "creating", + "available", + "error" + ], + "x-enum-varnames": [ + "IndexStatusCreating", + "IndexStatusAvailable", + "IndexStatusError" + ] + }, + "sql.MetricCategory": { + "type": "string", + "enum": [ + "meta", + "latency", + "execution" + ], + "x-enum-varnames": [ + "Meta", + "Latency", + "Execution" + ] + }, + "sql.PlanCategory": { + "type": "string", + "enum": [ + "local", + "remote", + "distributed" + ], + "x-enum-varnames": [ + "PlanCategoryLocal", + "PlanCategoryRemote", + "PlanCategoryDistributed" + ] + }, + "sql.PlanDetail": { "type": "object", "required": [ - "cpu", - "memory" + "category", + "generatedTime", + "mergedVersion", + "planDetail", + "planHash", + "planStatistics" ], "properties": { - "cpu": { + "category": { + "$ref": "#/definitions/sql.PlanCategory" + }, + "generatedTime": { "type": "integer" }, - "memory": { + "mergedVersion": { "type": "integer" + }, + "planDetail": { + "$ref": "#/definitions/sql.PlanOperator" + }, + "planHash": { + "type": "string" + }, + "planStatistics": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.PlanStatisticByServer" + } } } }, - "response.RestoreSource": { + "sql.PlanDetailParam": { "type": "object", "required": [ - "archiveSource", - "bakDataSource", - "type" + "namespace", + "obcluster", + "planHash" ], "properties": { - "archiveSource": { + "database": { "type": "string" }, - "bakDataSource": { + "endTime": { + "type": "integer" + }, + "namespace": { "type": "string" }, - "bakEncryptionSecret": { + "obcluster": { "type": "string" }, - "ossAccessSecret": { + "obtenant": { "type": "string" }, - "type": { - "description": "Enum: OSS, NFS", + "planHash": { "type": "string" }, - "until": { + "startTime": { + "type": "integer" + }, + "user": { "type": "string" } } }, - "response.StatisticData": { + "sql.PlanOperator": { "type": "object", "required": [ - "backupPolicies", - "clusters", - "k8sNodes", - "servers", - "tenants", - "warningEvents", - "zones" + "cost", + "estimatedRows", + "operator" ], "properties": { - "backupPolicies": { + "childOperators": { "type": "array", "items": { - "$ref": "#/definitions/models.OBBackupPolicy" + "$ref": "#/definitions/sql.PlanOperator" } }, - "clusters": { - "type": "array", - "items": { - "$ref": "#/definitions/models.OBCluster" - } + "cost": { + "type": "integer" }, - "k8sNodes": { - "type": "array", - "items": { - "$ref": "#/definitions/response.K8sNode" - } + "estimatedRows": { + "type": "integer" }, - "operatorVersion": { + "name": { "type": "string" }, - "servers": { - "type": "array", - "items": { - "$ref": "#/definitions/models.OBServer" - } - }, - "tenants": { - "type": "array", - "items": { - "$ref": "#/definitions/models.OBTenant" - } - }, - "warningEvents": { - "type": "array", - "items": { - "$ref": "#/definitions/models.K8sEvent" - } + "operator": { + "type": "string" }, - "zones": { - "type": "array", - "items": { - "$ref": "#/definitions/models.OBZone" - } + "outputOrFilter": { + "type": "string" } } }, - "response.StorageClass": { + "sql.PlanStatistic": { "type": "object", "required": [ - "allowVolumeExpansion", - "name", - "provisioner", - "reclaimPolicy", - "volumeBindingMode" + "category", + "cost", + "cpuTime", + "generatedTime", + "mergedVersion", + "planHash" ], "properties": { - "allowVolumeExpansion": { - "type": "boolean" - }, - "mountOptions": { - "type": "array", - "items": { - "type": "string" - } + "category": { + "$ref": "#/definitions/sql.PlanCategory" }, - "name": { - "type": "string" + "cost": { + "type": "integer" }, - "parameters": { - "type": "array", - "items": { - "$ref": "#/definitions/common.KVPair" - } + "cpuTime": { + "type": "integer" }, - "provisioner": { - "type": "string" + "generatedTime": { + "type": "integer" }, - "reclaimPolicy": { - "type": "string" + "mergedVersion": { + "type": "integer" }, - "volumeBindingMode": { + "planHash": { "type": "string" } } }, - "response.StorageSpec": { + "sql.PlanStatisticByServer": { "type": "object", "required": [ - "size", - "storageClass" + "category", + "cost", + "cpuTime", + "generatedTime", + "mergedVersion", + "planHash", + "planId", + "server" ], "properties": { - "size": { + "category": { + "$ref": "#/definitions/sql.PlanCategory" + }, + "cost": { "type": "integer" }, - "storageClass": { + "cpuTime": { + "type": "integer" + }, + "generatedTime": { + "type": "integer" + }, + "mergedVersion": { + "type": "integer" + }, + "planHash": { + "type": "string" + }, + "planId": { + "type": "integer" + }, + "server": { "type": "string" } } }, - "route.RouteParam": { + "sql.RequestStatisticInfo": { "type": "object", "required": [ - "aggregateLabels", - "groupInterval", - "groupWait", - "matchers", - "receiver", - "repeatInterval" + "database", + "executionStatistics", + "executionTrend", + "latencyStatistics", + "latencyTrend", + "planCategoryStatistics", + "tenant", + "user" ], "properties": { - "aggregateLabels": { + "database": { + "type": "string" + }, + "executionStatistics": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/sql.SqlStatisticMetric" } }, - "groupInterval": { - "type": "integer" + "executionTrend": { + "$ref": "#/definitions/response.MetricData" }, - "groupWait": { - "type": "integer" + "latencyStatistics": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.SqlStatisticMetric" + } }, - "id": { - "type": "string" + "latencyTrend": { + "$ref": "#/definitions/response.MetricData" }, - "matchers": { + "planCategoryStatistics": { "type": "array", "items": { - "$ref": "#/definitions/alarm.Matcher" + "$ref": "#/definitions/sql.SqlStatisticMetric" } }, - "receiver": { + "tenant": { "type": "string" }, - "repeatInterval": { - "type": "integer" + "user": { + "type": "string" } } }, - "route.RouteResponse": { + "sql.SqlDetailParam": { "type": "object", "required": [ - "aggregateLabels", - "groupInterval", - "groupWait", - "id", - "matchers", - "receiver", - "repeatInterval" + "interval", + "namespace", + "obcluster", + "sqlId" ], "properties": { - "aggregateLabels": { - "type": "array", - "items": { - "type": "string" - } + "database": { + "type": "string" }, - "groupInterval": { + "endTime": { "type": "integer" }, - "groupWait": { + "interval": { "type": "integer" }, - "id": { + "namespace": { "type": "string" }, - "matchers": { - "type": "array", - "items": { - "$ref": "#/definitions/alarm.Matcher" - } + "obcluster": { + "type": "string" }, - "receiver": { + "obtenant": { "type": "string" }, - "repeatInterval": { + "sqlId": { + "type": "string" + }, + "startTime": { "type": "integer" + }, + "user": { + "type": "string" } } }, - "rule.Rule": { + "sql.SqlDetailedInfo": { "type": "object", "required": [ - "description", - "duration", - "instanceType", - "labels", - "name", - "query", - "severity", - "summary" + "executionTrend", + "latencyTrend", + "plans" ], "properties": { - "description": { - "type": "string" - }, - "duration": { - "type": "integer" - }, - "instanceType": { - "$ref": "#/definitions/oceanbase.OBInstanceType" - }, - "labels": { + "diagnoseInfo": { "type": "array", "items": { - "$ref": "#/definitions/common.KVPair" + "$ref": "#/definitions/sql.SqlDiagnoseInfo" } }, - "name": { - "type": "string" - }, - "query": { - "type": "string" + "executionTrend": { + "type": "array", + "items": { + "$ref": "#/definitions/response.MetricData" + } }, - "severity": { - "$ref": "#/definitions/alarm.Severity" + "indexies": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.IndexInfo" + } }, - "summary": { - "type": "string" + "latencyTrend": { + "type": "array", + "items": { + "$ref": "#/definitions/response.MetricData" + } }, - "type": { - "default": "customized", - "allOf": [ - { - "$ref": "#/definitions/rule.RuleType" - } - ] + "plans": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.PlanStatistic" + } } } }, - "rule.RuleFilter": { + "sql.SqlDiagnoseInfo": { "type": "object", + "required": [ + "reason" + ], "properties": { - "instanceType": { - "$ref": "#/definitions/oceanbase.OBInstanceType" - }, - "keyword": { + "reason": { "type": "string" }, - "severity": { - "$ref": "#/definitions/alarm.Severity" + "suggestion": { + "type": "string" } } }, - "rule.RuleHealth": { - "type": "string", - "enum": [ - "unknown", - "ok", - "error" - ], - "x-enum-varnames": [ - "HealthUnknown", - "HealthOK", - "HealthError" - ] - }, - "rule.RuleResponse": { + "sql.SqlFilter": { "type": "object", "required": [ - "description", - "duration", - "evaluationTime", - "health", - "instanceType", - "keepFiringFor", - "labels", - "lastEvaluation", - "name", - "query", - "severity", - "state", - "summary" + "namespace", + "obcluster" ], "properties": { - "description": { + "database": { "type": "string" }, - "duration": { + "endTime": { "type": "integer" }, - "evaluationTime": { - "type": "number" + "includeInnerSql": { + "type": "boolean" }, - "health": { - "$ref": "#/definitions/rule.RuleHealth" + "keyword": { + "type": "string" }, - "instanceType": { - "$ref": "#/definitions/oceanbase.OBInstanceType" + "namespace": { + "type": "string" }, - "keepFiringFor": { + "obcluster": { + "type": "string" + }, + "obtenant": { + "type": "string" + }, + "startTime": { "type": "integer" }, - "labels": { + "user": { + "type": "string" + } + } + }, + "sql.SqlInfo": { + "type": "object", + "required": [ + "database", + "executionStatistics", + "isInner", + "latencyStatistics", + "observer", + "sqlID", + "sqlText", + "sqlType", + "tenant", + "user" + ], + "properties": { + "database": { + "type": "string" + }, + "diagnoseInfo": { "type": "array", "items": { - "$ref": "#/definitions/common.KVPair" + "$ref": "#/definitions/sql.SqlDiagnoseInfo" } }, - "lastError": { - "type": "string" + "executionStatistics": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.SqlStatisticMetric" + } }, - "lastEvaluation": { - "type": "integer" + "isInner": { + "type": "boolean" }, - "name": { + "latencyStatistics": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.SqlStatisticMetric" + } + }, + "observer": { "type": "string" }, - "query": { + "sqlID": { "type": "string" }, - "severity": { - "$ref": "#/definitions/alarm.Severity" + "sqlText": { + "type": "string" }, - "state": { - "$ref": "#/definitions/rule.RuleState" + "sqlType": { + "type": "string" }, - "summary": { + "tenant": { "type": "string" }, - "type": { - "default": "customized", - "allOf": [ - { - "$ref": "#/definitions/rule.RuleType" - } - ] + "user": { + "type": "string" } } }, - "rule.RuleState": { - "type": "string", - "enum": [ - "active", - "inactive" - ], - "x-enum-varnames": [ - "StateActive", - "StateInactive" - ] - }, - "rule.RuleType": { - "type": "string", - "enum": [ - "builtin", - "customized" - ], - "x-enum-varnames": [ - "TypeBuiltin", - "TypeCustomized" - ] - }, - "silence.SilencerFilter": { + "sql.SqlMetricMeta": { "type": "object", + "required": [ + "category", + "description", + "displayByDefault", + "name" + ], "properties": { - "instance": { - "$ref": "#/definitions/oceanbase.OBInstance" + "category": { + "$ref": "#/definitions/sql.MetricCategory" }, - "instanceType": { - "$ref": "#/definitions/oceanbase.OBInstanceType" + "description": { + "type": "string" }, - "keyword": { + "displayByDefault": { + "type": "boolean" + }, + "name": { "type": "string" } } }, - "silence.SilencerParam": { + "sql.SqlMetricMetaCategory": { "type": "object", "required": [ - "comment", - "createdBy", - "endsAt", - "instances", - "matchers", - "rules", - "startsAt" + "category", + "metrics" ], "properties": { - "comment": { - "type": "string" - }, - "createdBy": { - "type": "string" - }, - "endsAt": { - "type": "integer" - }, - "id": { - "type": "string" - }, - "instances": { - "type": "array", - "items": { - "$ref": "#/definitions/oceanbase.OBInstance" - } - }, - "matchers": { - "type": "array", - "items": { - "$ref": "#/definitions/alarm.Matcher" - } + "category": { + "$ref": "#/definitions/sql.MetricCategory" }, - "rules": { + "metrics": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/sql.SqlMetricMeta" } - }, - "startsAt": { - "type": "integer" } } }, - "silence.SilencerResponse": { + "sql.SqlRequestStatisticParam": { "type": "object", "required": [ - "comment", - "createdBy", - "endsAt", - "id", - "instances", - "matchers", - "rules", - "startsAt", - "status", - "updatedAt" + "namespace", + "obcluster", + "statisticScopes" ], "properties": { - "comment": { - "type": "string" - }, - "createdBy": { + "database": { "type": "string" }, - "endsAt": { + "endTime": { "type": "integer" }, - "id": { + "namespace": { "type": "string" }, - "instances": { - "type": "array", - "items": { - "$ref": "#/definitions/oceanbase.OBInstance" - } + "obcluster": { + "type": "string" }, - "matchers": { - "type": "array", - "items": { - "$ref": "#/definitions/alarm.Matcher" - } + "obtenant": { + "type": "string" }, - "rules": { + "startTime": { + "type": "integer" + }, + "statisticScopes": { "type": "array", "items": { "type": "string" } }, - "startsAt": { - "type": "integer" - }, - "status": { - "$ref": "#/definitions/silence.Status" - }, - "updatedAt": { - "type": "integer" + "user": { + "type": "string" } } }, - "silence.State": { - "type": "string", - "enum": [ - "active", - "expired", - "pending" - ], - "x-enum-varnames": [ - "StateActive", - "StateExpired", - "StatePending" - ] - }, - "silence.Status": { + "sql.SqlStatisticMetric": { "type": "object", "required": [ - "state" + "name", + "value" ], "properties": { - "state": { - "$ref": "#/definitions/silence.State" + "name": { + "type": "string" + }, + "value": { + "type": "number" } } } diff --git a/internal/dashboard/generated/swagger/swagger.json b/internal/dashboard/generated/swagger/swagger.json index f6d8a5350..30a09986e 100644 --- a/internal/dashboard/generated/swagger/swagger.json +++ b/internal/dashboard/generated/swagger/swagger.json @@ -4922,6 +4922,84 @@ } } }, + "/api/v1/obtenants/{namespace}/{name}/databases": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "List all the databases under obtenant", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "OBTenant" + ], + "summary": "List obtenant databases", + "operationId": "ListOBTenantDatabases", + "parameters": [ + { + "type": "string", + "description": "obtenant namespace", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "obtenant name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/api/v1/obtenants/{namespace}/{name}/logreplay": { "post": { "security": [ @@ -5597,6 +5675,84 @@ } } }, + "/api/v1/obtenants/{namespace}/{name}/users": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "List all the users under obtenant", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "OBTenant" + ], + "summary": "List obtenant users", + "operationId": "ListOBTenantUsers", + "parameters": [ + { + "type": "string", + "description": "obtenant namespace", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "obtenant name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/api/v1/obtenants/{namespace}/{name}/version": { "post": { "security": [ @@ -5672,14 +5828,14 @@ } } }, - "/api/v1/statistics": { + "/api/v1/sql/metrics": { "get": { "security": [ { "ApiKeyAuth": [] } ], - "description": "get statistic data", + "description": "list sqls metrics", "consumes": [ "application/json" ], @@ -5687,10 +5843,10 @@ "application/json" ], "tags": [ - "Info" + "Sql" ], - "summary": "get statistic data", - "operationId": "GetStatistics", + "summary": "list sql metrics", + "operationId": "ListSqlMetrics", "responses": { "200": { "description": "OK", @@ -5703,7 +5859,10 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/response.StatisticData" + "type": "array", + "items": { + "$ref": "#/definitions/sql.SqlMetricMetaCategory" + } } } } @@ -5731,9 +5890,14 @@ } } }, - "/api/v1/webhook/alert/log": { + "/api/v1/sql/queryPlanDetailInfo": { "post": { - "description": "Log alerts sent by alertmanager.", + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "query detailed statistic info of a plan", "consumes": [ "application/json" ], @@ -5741,18 +5905,18 @@ "application/json" ], "tags": [ - "Webhook" + "Sql" ], - "summary": "Log alerts", - "operationId": "LogAlerts", + "summary": "query plan detail info", + "operationId": "QueryPlanDetailInfo", "parameters": [ { - "description": "payload", + "description": "param for query detailed plan info", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/payload.WebhookPayload" + "$ref": "#/definitions/sql.PlanDetailParam" } } ], @@ -5768,7 +5932,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/response.DashboardInfo" + "$ref": "#/definitions/sql.PlanDetail" } } } @@ -5795,36 +5959,449 @@ } } } - } - }, - "definitions": { - "ac.Account": { - "type": "object", - "required": [ - "roles", - "username" - ], - "properties": { - "description": { - "type": "string" - }, - "lastLoginAt": { - "type": "string" - }, - "needReset": { - "type": "boolean" - }, - "nickname": { - "type": "string" - }, - "roles": { - "type": "array", - "items": { - "$ref": "#/definitions/ac.Role" + }, + "/api/v1/sql/querySqlDetailInfo": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "query detailed statistic info of a SQL", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Sql" + ], + "summary": "query SQL detail info", + "operationId": "QuerySqlDetailInfo", + "parameters": [ + { + "description": "param for query detailed sql info", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/sql.SqlDetailParam" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/sql.SqlDetailedInfo" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } } - }, - "username": { - "type": "string" + } + } + }, + "/api/v1/sql/requestStatistics": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "list request statistics", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Sql" + ], + "summary": "list request statistics", + "operationId": "RequestStatistics", + "parameters": [ + { + "description": "sql request statistic param", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/sql.SqlRequestStatisticParam" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.RequestStatisticInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, + "/api/v1/sql/suspiciousSqls": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "list suspicious sqls", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Sql" + ], + "summary": "list suspicious sqls", + "operationId": "ListSuspiciousSqls", + "parameters": [ + { + "description": "sql filter", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/sql.SqlFilter" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.SqlInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, + "/api/v1/sql/topSqls": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "list top sqls ordering by spcecific metrics", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Sql" + ], + "summary": "list top sqls", + "operationId": "ListTopSqls", + "parameters": [ + { + "description": "sql filter", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/sql.SqlFilter" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.SqlInfo" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, + "/api/v1/statistics": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "get statistic data", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Info" + ], + "summary": "get statistic data", + "operationId": "GetStatistics", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.StatisticData" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, + "/api/v1/webhook/alert/log": { + "post": { + "description": "Log alerts sent by alertmanager.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Webhook" + ], + "summary": "Log alerts", + "operationId": "LogAlerts", + "parameters": [ + { + "description": "payload", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/payload.WebhookPayload" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.DashboardInfo" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + } + }, + "definitions": { + "ac.Account": { + "type": "object", + "required": [ + "roles", + "username" + ], + "properties": { + "description": { + "type": "string" + }, + "lastLoginAt": { + "type": "string" + }, + "needReset": { + "type": "boolean" + }, + "nickname": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/ac.Role" + } + }, + "username": { + "type": "string" } } }, @@ -7939,511 +8516,829 @@ "memoryTotal": { "type": "number" }, - "memoryUsed": { - "type": "number" + "memoryUsed": { + "type": "number" + } + } + }, + "response.K8sPodInfo": { + "type": "object", + "required": [ + "containers", + "message", + "name", + "namespace", + "nodeName", + "podIP", + "reason", + "startTime", + "status" + ], + "properties": { + "containers": { + "type": "array", + "items": { + "$ref": "#/definitions/response.ContainerInfo" + } + }, + "message": { + "type": "string" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "nodeName": { + "type": "string" + }, + "podIP": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "startTime": { + "type": "string" + }, + "status": { + "type": "string" + } + } + }, + "response.K8sService": { + "type": "object", + "required": [ + "clusterIP", + "name", + "namespace", + "ports", + "type" + ], + "properties": { + "clusterIP": { + "type": "string" + }, + "externalIP": { + "type": "string" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "ports": { + "type": "array", + "items": { + "$ref": "#/definitions/response.K8sServicePort" + } + }, + "type": { + "type": "string" + } + } + }, + "response.K8sServicePort": { + "type": "object", + "required": [ + "port", + "targetPort" + ], + "properties": { + "name": { + "type": "string" + }, + "nodePort": { + "type": "integer" + }, + "port": { + "type": "integer" + }, + "targetPort": { + "type": "integer" + } + } + }, + "response.Metric": { + "type": "object", + "properties": { + "labels": { + "type": "array", + "items": { + "$ref": "#/definitions/common.KVPair" + } + }, + "name": { + "type": "string" + } + } + }, + "response.MetricClass": { + "type": "object", + "required": [ + "description", + "metricGroups", + "name" + ], + "properties": { + "description": { + "type": "string" + }, + "metricGroups": { + "type": "array", + "items": { + "$ref": "#/definitions/response.MetricGroup" + } + }, + "name": { + "type": "string" + } + } + }, + "response.MetricData": { + "type": "object", + "required": [ + "metric", + "values" + ], + "properties": { + "metric": { + "$ref": "#/definitions/response.Metric" + }, + "values": { + "type": "array", + "items": { + "$ref": "#/definitions/response.MetricValue" + } + } + } + }, + "response.MetricGroup": { + "type": "object", + "required": [ + "description", + "metrics", + "name" + ], + "properties": { + "description": { + "type": "string" + }, + "metrics": { + "type": "array", + "items": { + "$ref": "#/definitions/response.MetricMeta" + } + }, + "name": { + "type": "string" + } + } + }, + "response.MetricMeta": { + "type": "object", + "required": [ + "description", + "key", + "name", + "unit" + ], + "properties": { + "description": { + "type": "string" + }, + "key": { + "type": "string" + }, + "name": { + "type": "string" + }, + "unit": { + "type": "string" + } + } + }, + "response.MetricValue": { + "type": "object", + "required": [ + "timestamp", + "value" + ], + "properties": { + "timestamp": { + "type": "number" + }, + "value": { + "type": "number" + } + } + }, + "response.MonitorSpec": { + "type": "object", + "required": [ + "image", + "resource" + ], + "properties": { + "image": { + "type": "string" + }, + "resource": { + "$ref": "#/definitions/response.ResourceSpecRender" + } + } + }, + "response.NFSVolumeSpec": { + "type": "object", + "required": [ + "address", + "path" + ], + "properties": { + "address": { + "type": "string" + }, + "path": { + "type": "string" } } }, - "response.K8sPodInfo": { + "response.Namespace": { "type": "object", "required": [ - "containers", - "message", - "name", "namespace", - "nodeName", - "podIP", - "reason", - "startTime", "status" ], "properties": { - "containers": { - "type": "array", - "items": { - "$ref": "#/definitions/response.ContainerInfo" - } - }, - "message": { - "type": "string" - }, - "name": { - "type": "string" - }, "namespace": { "type": "string" }, - "nodeName": { - "type": "string" - }, - "podIP": { - "type": "string" - }, - "reason": { - "type": "string" - }, - "startTime": { - "type": "string" - }, "status": { "type": "string" } } }, - "response.K8sService": { + "response.OBCluster": { "type": "object", "required": [ - "clusterIP", + "clusterId", + "clusterName", + "createTime", + "image", + "mode", "name", "namespace", - "ports", - "type" + "parameters", + "resource", + "rootPasswordSecret", + "status", + "statusDetail", + "storage", + "topology", + "uid" ], "properties": { - "clusterIP": { + "backupVolume": { + "$ref": "#/definitions/response.NFSVolumeSpec" + }, + "clusterId": { + "type": "integer" + }, + "clusterName": { "type": "string" }, - "externalIP": { + "createTime": { + "type": "integer" + }, + "image": { "type": "string" }, + "metrics": { + "$ref": "#/definitions/response.OBMetrics" + }, + "mode": { + "$ref": "#/definitions/common.ClusterMode" + }, + "monitor": { + "$ref": "#/definitions/response.MonitorSpec" + }, "name": { "type": "string" }, "namespace": { "type": "string" }, - "ports": { + "parameters": { "type": "array", "items": { - "$ref": "#/definitions/response.K8sServicePort" + "$ref": "#/definitions/common.KVPair" } }, - "type": { + "resource": { + "$ref": "#/definitions/response.ResourceSpecRender" + }, + "rootPasswordSecret": { "type": "string" - } - } - }, - "response.K8sServicePort": { - "type": "object", - "required": [ - "port", - "targetPort" - ], - "properties": { - "name": { + }, + "status": { "type": "string" }, - "nodePort": { - "type": "integer" + "statusDetail": { + "type": "string" }, - "port": { - "type": "integer" + "storage": { + "$ref": "#/definitions/response.OBServerStorage" }, - "targetPort": { - "type": "integer" - } - } - }, - "response.Metric": { - "type": "object", - "properties": { - "labels": { + "topology": { "type": "array", "items": { - "$ref": "#/definitions/common.KVPair" + "$ref": "#/definitions/response.OBZone" } }, - "name": { + "uid": { + "type": "string" + }, + "version": { "type": "string" } } }, - "response.MetricClass": { + "response.OBClusterOverview": { "type": "object", "required": [ - "description", - "metricGroups", - "name" + "clusterId", + "clusterName", + "createTime", + "image", + "mode", + "name", + "namespace", + "status", + "statusDetail", + "topology", + "uid" ], "properties": { - "description": { + "clusterId": { + "type": "integer" + }, + "clusterName": { "type": "string" }, - "metricGroups": { + "createTime": { + "type": "integer" + }, + "image": { + "type": "string" + }, + "mode": { + "$ref": "#/definitions/common.ClusterMode" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "status": { + "type": "string" + }, + "statusDetail": { + "type": "string" + }, + "topology": { "type": "array", "items": { - "$ref": "#/definitions/response.MetricGroup" + "$ref": "#/definitions/response.OBZone" } }, - "name": { + "uid": { "type": "string" } } }, - "response.MetricData": { + "response.OBClusterResources": { "type": "object", "required": [ - "metric", - "values" + "minPoolMemory" ], "properties": { - "metric": { - "$ref": "#/definitions/response.Metric" + "minPoolMemory": { + "type": "integer", + "example": 2147483648 }, - "values": { + "obServerResources": { "type": "array", "items": { - "$ref": "#/definitions/response.MetricValue" + "$ref": "#/definitions/response.OBServerAvailableResource" + } + }, + "obZoneResourceMap": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/response.OBZoneAvailableResource" } } } }, - "response.MetricGroup": { + "response.OBClusterStatistic": { "type": "object", "required": [ - "description", - "metrics", - "name" + "count", + "status" ], "properties": { - "description": { - "type": "string" - }, - "metrics": { - "type": "array", - "items": { - "$ref": "#/definitions/response.MetricMeta" - } + "count": { + "type": "integer" }, - "name": { + "status": { "type": "string" } } }, - "response.MetricMeta": { + "response.OBConnection": { "type": "object", - "required": [ - "description", - "key", - "name", - "unit" - ], "properties": { - "description": { + "clientIp": { "type": "string" }, - "key": { + "cluster": { "type": "string" }, - "name": { + "namespace": { "type": "string" }, - "unit": { + "odcConnectionURL": { + "type": "string" + }, + "pod": { + "type": "string" + }, + "tenant": { + "type": "string" + }, + "terminalId": { + "type": "string" + }, + "user": { "type": "string" } } }, - "response.MetricValue": { + "response.OBMetrics": { "type": "object", "required": [ - "timestamp", - "value" + "cpuPercent", + "diskPercent", + "memoryPercent" ], - "properties": { - "timestamp": { - "type": "number" + "properties": { + "cpuPercent": { + "type": "integer" }, - "value": { - "type": "number" + "diskPercent": { + "type": "integer" + }, + "memoryPercent": { + "type": "integer" } } }, - "response.MonitorSpec": { + "response.OBServer": { "type": "object", "required": [ - "image", - "resource" + "address", + "name", + "namespace", + "status", + "statusDetail" ], "properties": { - "image": { + "address": { "type": "string" }, - "resource": { - "$ref": "#/definitions/response.ResourceSpecRender" + "metrics": { + "$ref": "#/definitions/response.OBMetrics" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "status": { + "type": "string" + }, + "statusDetail": { + "type": "string" } } }, - "response.NFSVolumeSpec": { + "response.OBServerAvailableResource": { "type": "object", "required": [ - "address", - "path" + "availableCPU", + "availableDataDisk", + "availableLogDisk", + "availableMemory", + "obServerIP", + "obZone", + "serverCount" ], "properties": { - "address": { - "type": "string" + "availableCPU": { + "type": "integer", + "example": 12 }, - "path": { + "availableDataDisk": { + "type": "integer", + "example": 16106127360 + }, + "availableLogDisk": { + "type": "integer", + "example": 5368709120 + }, + "availableMemory": { + "type": "integer", + "example": 5368709120 + }, + "obServerIP": { "type": "string" + }, + "obZone": { + "type": "string", + "example": "zone1" + }, + "serverCount": { + "type": "integer", + "example": 3 } } }, - "response.Namespace": { + "response.OBServerStorage": { "type": "object", "required": [ - "namespace", - "status" + "dataStorage", + "redoLogStorage", + "sysLogStorage" ], "properties": { - "namespace": { - "type": "string" + "dataStorage": { + "$ref": "#/definitions/response.StorageSpec" }, - "status": { - "type": "string" + "redoLogStorage": { + "$ref": "#/definitions/response.StorageSpec" + }, + "sysLogStorage": { + "$ref": "#/definitions/response.StorageSpec" } } }, - "response.OBCluster": { + "response.OBTenantDetail": { "type": "object", "required": [ - "clusterId", - "clusterName", + "charset", + "clusterResourceName", "createTime", - "image", - "mode", + "locality", "name", "namespace", - "parameters", - "resource", - "rootPasswordSecret", + "primaryZone", "status", - "statusDetail", - "storage", - "topology", - "uid" + "tenantName", + "tenantRole", + "uid", + "unitNumber" ], "properties": { - "backupVolume": { - "$ref": "#/definitions/response.NFSVolumeSpec" - }, - "clusterId": { - "type": "integer" + "charset": { + "description": "Charset of the tenant", + "type": "string" }, - "clusterName": { + "clusterResourceName": { + "description": "Name of the cluster belonging to", "type": "string" }, "createTime": { - "type": "integer" - }, - "image": { + "description": "Creation time of the tenant", "type": "string" }, - "metrics": { - "$ref": "#/definitions/response.OBMetrics" - }, - "mode": { - "$ref": "#/definitions/common.ClusterMode" - }, - "monitor": { - "$ref": "#/definitions/response.MonitorSpec" + "locality": { + "description": "Locality of the tenant units", + "type": "string" }, "name": { + "description": "Name of the resource", "type": "string" }, "namespace": { + "description": "Namespace of the resource", "type": "string" }, - "parameters": { - "type": "array", - "items": { - "$ref": "#/definitions/common.KVPair" - } + "primaryTenant": { + "type": "string" }, - "resource": { - "$ref": "#/definitions/response.ResourceSpecRender" + "primaryZone": { + "description": "Primary zone of the tenant", + "type": "string" }, - "rootPasswordSecret": { + "restoreSource": { + "$ref": "#/definitions/response.RestoreSource" + }, + "rootCredential": { + "type": "string" + }, + "standbyROCredential": { "type": "string" }, "status": { + "description": "Status of the tenant", "type": "string" }, - "statusDetail": { + "tenantName": { + "description": "Name of the tenant in the database", "type": "string" }, - "storage": { - "$ref": "#/definitions/response.OBServerStorage" + "tenantRole": { + "description": "Enum: Primary, Standby", + "type": "string" }, "topology": { + "description": "Topology of the tenant", "type": "array", "items": { - "$ref": "#/definitions/response.OBZone" + "$ref": "#/definitions/response.OBTenantReplica" } }, "uid": { + "description": "Unique identifier of the resource", "type": "string" }, + "unitNumber": { + "description": "Number of units in every zone", + "type": "integer" + }, "version": { "type": "string" } } }, - "response.OBClusterOverview": { + "response.OBTenantOverview": { + "description": "Brief information about OBTenant", "type": "object", "required": [ - "clusterId", - "clusterName", + "charset", + "clusterResourceName", "createTime", - "image", - "mode", + "locality", "name", "namespace", + "primaryZone", "status", - "statusDetail", - "topology", - "uid" + "tenantName", + "tenantRole", + "uid", + "unitNumber" ], "properties": { - "clusterId": { - "type": "integer" + "charset": { + "description": "Charset of the tenant", + "type": "string" }, - "clusterName": { + "clusterResourceName": { + "description": "Name of the cluster belonging to", "type": "string" }, "createTime": { - "type": "integer" - }, - "image": { + "description": "Creation time of the tenant", "type": "string" }, - "mode": { - "$ref": "#/definitions/common.ClusterMode" + "locality": { + "description": "Locality of the tenant units", + "type": "string" }, "name": { + "description": "Name of the resource", "type": "string" }, "namespace": { + "description": "Namespace of the resource", + "type": "string" + }, + "primaryZone": { + "description": "Primary zone of the tenant", "type": "string" }, "status": { + "description": "Status of the tenant", "type": "string" }, - "statusDetail": { + "tenantName": { + "description": "Name of the tenant in the database", + "type": "string" + }, + "tenantRole": { + "description": "Enum: Primary, Standby", "type": "string" }, "topology": { + "description": "Topology of the tenant", "type": "array", "items": { - "$ref": "#/definitions/response.OBZone" + "$ref": "#/definitions/response.OBTenantReplica" } }, "uid": { + "description": "Unique identifier of the resource", "type": "string" + }, + "unitNumber": { + "description": "Number of units in every zone", + "type": "integer" } } }, - "response.OBClusterResources": { - "type": "object", - "required": [ - "minPoolMemory" - ], - "properties": { - "minPoolMemory": { - "type": "integer", - "example": 2147483648 - }, - "obServerResources": { - "type": "array", - "items": { - "$ref": "#/definitions/response.OBServerAvailableResource" - } - }, - "obZoneResourceMap": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/response.OBZoneAvailableResource" - } - } - } - }, - "response.OBClusterStatistic": { + "response.OBTenantReplica": { "type": "object", "required": [ - "count", - "status" + "iopsWeight", + "logDiskSize", + "maxCPU", + "maxIops", + "memorySize", + "minCPU", + "minIops", + "priority", + "type", + "zone" ], "properties": { - "count": { + "iopsWeight": { "type": "integer" }, - "status": { - "type": "string" - } - } - }, - "response.OBConnection": { - "type": "object", - "properties": { - "clientIp": { - "type": "string" + "logDiskSize": { + "type": "integer" }, - "cluster": { - "type": "string" + "maxCPU": { + "type": "integer" }, - "namespace": { - "type": "string" + "maxIops": { + "type": "integer" }, - "odcConnectionURL": { - "type": "string" + "memorySize": { + "type": "integer" }, - "pod": { - "type": "string" + "minCPU": { + "type": "integer" }, - "tenant": { - "type": "string" + "minIops": { + "type": "integer" }, - "terminalId": { + "priority": { + "type": "integer" + }, + "type": { + "description": "Enum: Readonly, Full", "type": "string" }, - "user": { + "zone": { "type": "string" } } }, - "response.OBMetrics": { + "response.OBTenantStatistic": { "type": "object", "required": [ - "cpuPercent", - "diskPercent", - "memoryPercent" + "count", + "status" ], "properties": { - "cpuPercent": { - "type": "integer" - }, - "diskPercent": { + "count": { "type": "integer" }, - "memoryPercent": { - "type": "integer" + "status": { + "type": "string" } } }, - "response.OBServer": { + "response.OBZone": { "type": "object", "required": [ - "address", "name", "namespace", + "replicas", "status", - "statusDetail" + "statusDetail", + "zone" ], "properties": { - "address": { - "type": "string" - }, - "metrics": { - "$ref": "#/definitions/response.OBMetrics" + "affinities": { + "type": "array", + "items": { + "$ref": "#/definitions/common.AffinitySpec" + } }, "name": { "type": "string" @@ -8451,22 +9346,48 @@ "namespace": { "type": "string" }, + "nodeSelector": { + "type": "array", + "items": { + "$ref": "#/definitions/common.KVPair" + } + }, + "observers": { + "type": "array", + "items": { + "$ref": "#/definitions/response.OBServer" + } + }, + "replicas": { + "type": "integer" + }, + "rootService": { + "type": "string" + }, "status": { "type": "string" }, "statusDetail": { "type": "string" + }, + "tolerations": { + "type": "array", + "items": { + "$ref": "#/definitions/common.KVPair" + } + }, + "zone": { + "type": "string" } } }, - "response.OBServerAvailableResource": { + "response.OBZoneAvailableResource": { "type": "object", "required": [ "availableCPU", "availableDataDisk", "availableLogDisk", "availableMemory", - "obServerIP", "obZone", "serverCount" ], @@ -8487,9 +9408,6 @@ "type": "integer", "example": 5368709120 }, - "obServerIP": { - "type": "string" - }, "obZone": { "type": "string", "example": "zone1" @@ -8500,895 +9418,1137 @@ } } }, - "response.OBServerStorage": { + "response.ResourceSpecRender": { "type": "object", "required": [ - "dataStorage", - "redoLogStorage", - "sysLogStorage" + "cpu", + "memory" ], "properties": { - "dataStorage": { - "$ref": "#/definitions/response.StorageSpec" + "cpu": { + "type": "integer" }, - "redoLogStorage": { - "$ref": "#/definitions/response.StorageSpec" + "memory": { + "type": "integer" + } + } + }, + "response.RestoreSource": { + "type": "object", + "required": [ + "archiveSource", + "bakDataSource", + "type" + ], + "properties": { + "archiveSource": { + "type": "string" }, - "sysLogStorage": { - "$ref": "#/definitions/response.StorageSpec" + "bakDataSource": { + "type": "string" + }, + "bakEncryptionSecret": { + "type": "string" + }, + "ossAccessSecret": { + "type": "string" + }, + "type": { + "description": "Enum: OSS, NFS", + "type": "string" + }, + "until": { + "type": "string" } } }, - "response.OBTenantDetail": { + "response.StatisticData": { "type": "object", "required": [ - "charset", - "clusterResourceName", - "createTime", - "locality", - "name", - "namespace", - "primaryZone", - "status", - "tenantName", - "tenantRole", - "uid", - "unitNumber" + "backupPolicies", + "clusters", + "k8sNodes", + "servers", + "tenants", + "warningEvents", + "zones" ], "properties": { - "charset": { - "description": "Charset of the tenant", + "backupPolicies": { + "type": "array", + "items": { + "$ref": "#/definitions/models.OBBackupPolicy" + } + }, + "clusters": { + "type": "array", + "items": { + "$ref": "#/definitions/models.OBCluster" + } + }, + "k8sNodes": { + "type": "array", + "items": { + "$ref": "#/definitions/response.K8sNode" + } + }, + "operatorVersion": { "type": "string" }, - "clusterResourceName": { - "description": "Name of the cluster belonging to", + "servers": { + "type": "array", + "items": { + "$ref": "#/definitions/models.OBServer" + } + }, + "tenants": { + "type": "array", + "items": { + "$ref": "#/definitions/models.OBTenant" + } + }, + "warningEvents": { + "type": "array", + "items": { + "$ref": "#/definitions/models.K8sEvent" + } + }, + "zones": { + "type": "array", + "items": { + "$ref": "#/definitions/models.OBZone" + } + } + } + }, + "response.StorageClass": { + "type": "object", + "required": [ + "allowVolumeExpansion", + "name", + "provisioner", + "reclaimPolicy", + "volumeBindingMode" + ], + "properties": { + "allowVolumeExpansion": { + "type": "boolean" + }, + "mountOptions": { + "type": "array", + "items": { + "type": "string" + } + }, + "name": { "type": "string" }, - "createTime": { - "description": "Creation time of the tenant", - "type": "string" + "parameters": { + "type": "array", + "items": { + "$ref": "#/definitions/common.KVPair" + } }, - "locality": { - "description": "Locality of the tenant units", + "provisioner": { "type": "string" }, - "name": { - "description": "Name of the resource", + "reclaimPolicy": { "type": "string" }, - "namespace": { - "description": "Namespace of the resource", + "volumeBindingMode": { "type": "string" + } + } + }, + "response.StorageSpec": { + "type": "object", + "required": [ + "size", + "storageClass" + ], + "properties": { + "size": { + "type": "integer" }, - "primaryTenant": { + "storageClass": { "type": "string" + } + } + }, + "route.RouteParam": { + "type": "object", + "required": [ + "aggregateLabels", + "groupInterval", + "groupWait", + "matchers", + "receiver", + "repeatInterval" + ], + "properties": { + "aggregateLabels": { + "type": "array", + "items": { + "type": "string" + } }, - "primaryZone": { - "description": "Primary zone of the tenant", - "type": "string" + "groupInterval": { + "type": "integer" }, - "restoreSource": { - "$ref": "#/definitions/response.RestoreSource" + "groupWait": { + "type": "integer" }, - "rootCredential": { + "id": { "type": "string" }, - "standbyROCredential": { - "type": "string" + "matchers": { + "type": "array", + "items": { + "$ref": "#/definitions/alarm.Matcher" + } }, - "status": { - "description": "Status of the tenant", + "receiver": { "type": "string" }, - "tenantName": { - "description": "Name of the tenant in the database", - "type": "string" + "repeatInterval": { + "type": "integer" + } + } + }, + "route.RouteResponse": { + "type": "object", + "required": [ + "aggregateLabels", + "groupInterval", + "groupWait", + "id", + "matchers", + "receiver", + "repeatInterval" + ], + "properties": { + "aggregateLabels": { + "type": "array", + "items": { + "type": "string" + } }, - "tenantRole": { - "description": "Enum: Primary, Standby", + "groupInterval": { + "type": "integer" + }, + "groupWait": { + "type": "integer" + }, + "id": { "type": "string" }, - "topology": { - "description": "Topology of the tenant", + "matchers": { "type": "array", "items": { - "$ref": "#/definitions/response.OBTenantReplica" + "$ref": "#/definitions/alarm.Matcher" } }, - "uid": { - "description": "Unique identifier of the resource", + "receiver": { "type": "string" }, - "unitNumber": { - "description": "Number of units in every zone", + "repeatInterval": { "type": "integer" - }, - "version": { - "type": "string" } } }, - "response.OBTenantOverview": { - "description": "Brief information about OBTenant", + "rule.Rule": { "type": "object", "required": [ - "charset", - "clusterResourceName", - "createTime", - "locality", + "description", + "duration", + "instanceType", + "labels", "name", - "namespace", - "primaryZone", - "status", - "tenantName", - "tenantRole", - "uid", - "unitNumber" + "query", + "severity", + "summary" ], "properties": { - "charset": { - "description": "Charset of the tenant", + "description": { "type": "string" }, - "clusterResourceName": { - "description": "Name of the cluster belonging to", - "type": "string" + "duration": { + "type": "integer" }, - "createTime": { - "description": "Creation time of the tenant", - "type": "string" + "instanceType": { + "$ref": "#/definitions/oceanbase.OBInstanceType" }, - "locality": { - "description": "Locality of the tenant units", - "type": "string" + "labels": { + "type": "array", + "items": { + "$ref": "#/definitions/common.KVPair" + } }, "name": { - "description": "Name of the resource", - "type": "string" - }, - "namespace": { - "description": "Namespace of the resource", - "type": "string" - }, - "primaryZone": { - "description": "Primary zone of the tenant", "type": "string" }, - "status": { - "description": "Status of the tenant", + "query": { "type": "string" }, - "tenantName": { - "description": "Name of the tenant in the database", - "type": "string" + "severity": { + "$ref": "#/definitions/alarm.Severity" }, - "tenantRole": { - "description": "Enum: Primary, Standby", + "summary": { "type": "string" }, - "topology": { - "description": "Topology of the tenant", - "type": "array", - "items": { - "$ref": "#/definitions/response.OBTenantReplica" - } + "type": { + "default": "customized", + "allOf": [ + { + "$ref": "#/definitions/rule.RuleType" + } + ] + } + } + }, + "rule.RuleFilter": { + "type": "object", + "properties": { + "instanceType": { + "$ref": "#/definitions/oceanbase.OBInstanceType" }, - "uid": { - "description": "Unique identifier of the resource", + "keyword": { "type": "string" }, - "unitNumber": { - "description": "Number of units in every zone", - "type": "integer" + "severity": { + "$ref": "#/definitions/alarm.Severity" } } }, - "response.OBTenantReplica": { + "rule.RuleHealth": { + "type": "string", + "enum": [ + "unknown", + "ok", + "error" + ], + "x-enum-varnames": [ + "HealthUnknown", + "HealthOK", + "HealthError" + ] + }, + "rule.RuleResponse": { "type": "object", "required": [ - "iopsWeight", - "logDiskSize", - "maxCPU", - "maxIops", - "memorySize", - "minCPU", - "minIops", - "priority", - "type", - "zone" + "description", + "duration", + "evaluationTime", + "health", + "instanceType", + "keepFiringFor", + "labels", + "lastEvaluation", + "name", + "query", + "severity", + "state", + "summary" ], "properties": { - "iopsWeight": { - "type": "integer" + "description": { + "type": "string" }, - "logDiskSize": { + "duration": { "type": "integer" }, - "maxCPU": { - "type": "integer" + "evaluationTime": { + "type": "number" }, - "maxIops": { - "type": "integer" + "health": { + "$ref": "#/definitions/rule.RuleHealth" }, - "memorySize": { - "type": "integer" + "instanceType": { + "$ref": "#/definitions/oceanbase.OBInstanceType" }, - "minCPU": { + "keepFiringFor": { "type": "integer" }, - "minIops": { - "type": "integer" + "labels": { + "type": "array", + "items": { + "$ref": "#/definitions/common.KVPair" + } }, - "priority": { + "lastError": { + "type": "string" + }, + "lastEvaluation": { "type": "integer" }, - "type": { - "description": "Enum: Readonly, Full", + "name": { "type": "string" }, - "zone": { + "query": { + "type": "string" + }, + "severity": { + "$ref": "#/definitions/alarm.Severity" + }, + "state": { + "$ref": "#/definitions/rule.RuleState" + }, + "summary": { "type": "string" + }, + "type": { + "default": "customized", + "allOf": [ + { + "$ref": "#/definitions/rule.RuleType" + } + ] } } }, - "response.OBTenantStatistic": { - "type": "object", - "required": [ - "count", - "status" + "rule.RuleState": { + "type": "string", + "enum": [ + "active", + "inactive" + ], + "x-enum-varnames": [ + "StateActive", + "StateInactive" + ] + }, + "rule.RuleType": { + "type": "string", + "enum": [ + "builtin", + "customized" ], + "x-enum-varnames": [ + "TypeBuiltin", + "TypeCustomized" + ] + }, + "silence.SilencerFilter": { + "type": "object", "properties": { - "count": { - "type": "integer" + "instance": { + "$ref": "#/definitions/oceanbase.OBInstance" }, - "status": { + "instanceType": { + "$ref": "#/definitions/oceanbase.OBInstanceType" + }, + "keyword": { "type": "string" } } }, - "response.OBZone": { + "silence.SilencerParam": { "type": "object", "required": [ - "name", - "namespace", - "replicas", - "status", - "statusDetail", - "zone" + "comment", + "createdBy", + "endsAt", + "instances", + "matchers", + "rules", + "startsAt" ], "properties": { - "affinities": { - "type": "array", - "items": { - "$ref": "#/definitions/common.AffinitySpec" - } + "comment": { + "type": "string" }, - "name": { + "createdBy": { "type": "string" }, - "namespace": { + "endsAt": { + "type": "integer" + }, + "id": { "type": "string" }, - "nodeSelector": { + "instances": { "type": "array", "items": { - "$ref": "#/definitions/common.KVPair" + "$ref": "#/definitions/oceanbase.OBInstance" } }, - "observers": { + "matchers": { "type": "array", "items": { - "$ref": "#/definitions/response.OBServer" + "$ref": "#/definitions/alarm.Matcher" } }, - "replicas": { - "type": "integer" + "rules": { + "type": "array", + "items": { + "type": "string" + } }, - "rootService": { + "startsAt": { + "type": "integer" + } + } + }, + "silence.SilencerResponse": { + "type": "object", + "required": [ + "comment", + "createdBy", + "endsAt", + "id", + "instances", + "matchers", + "rules", + "startsAt", + "status", + "updatedAt" + ], + "properties": { + "comment": { "type": "string" }, - "status": { + "createdBy": { "type": "string" }, - "statusDetail": { + "endsAt": { + "type": "integer" + }, + "id": { "type": "string" }, - "tolerations": { + "instances": { "type": "array", "items": { - "$ref": "#/definitions/common.KVPair" + "$ref": "#/definitions/oceanbase.OBInstance" } }, - "zone": { - "type": "string" + "matchers": { + "type": "array", + "items": { + "$ref": "#/definitions/alarm.Matcher" + } + }, + "rules": { + "type": "array", + "items": { + "type": "string" + } + }, + "startsAt": { + "type": "integer" + }, + "status": { + "$ref": "#/definitions/silence.Status" + }, + "updatedAt": { + "type": "integer" } } }, - "response.OBZoneAvailableResource": { + "silence.State": { + "type": "string", + "enum": [ + "active", + "expired", + "pending" + ], + "x-enum-varnames": [ + "StateActive", + "StateExpired", + "StatePending" + ] + }, + "silence.Status": { "type": "object", "required": [ - "availableCPU", - "availableDataDisk", - "availableLogDisk", - "availableMemory", - "obZone", - "serverCount" + "state" ], "properties": { - "availableCPU": { - "type": "integer", - "example": 12 - }, - "availableDataDisk": { - "type": "integer", - "example": 16106127360 + "state": { + "$ref": "#/definitions/silence.State" + } + } + }, + "sql.IndexCategory": { + "type": "string", + "enum": [ + "primaryKey", + "globalNormal", + "globalUnique", + "localNormal", + "localUnique" + ], + "x-enum-varnames": [ + "IndexCategoryPrimaryKey", + "IndexCategoryGlobalNormal", + "IndexCategoryGlobalUnique", + "IndexCategoryLocalNormal", + "IndexCategoryLocalUnique" + ] + }, + "sql.IndexInfo": { + "type": "object", + "required": [ + "category", + "columns", + "indexName", + "status", + "tableName" + ], + "properties": { + "category": { + "$ref": "#/definitions/sql.IndexCategory" }, - "availableLogDisk": { - "type": "integer", - "example": 5368709120 + "columns": { + "type": "array", + "items": { + "type": "string" + } }, - "availableMemory": { - "type": "integer", - "example": 5368709120 + "indexName": { + "type": "string" }, - "obZone": { - "type": "string", - "example": "zone1" + "status": { + "$ref": "#/definitions/sql.IndexStatus" }, - "serverCount": { - "type": "integer", - "example": 3 + "tableName": { + "type": "string" } } }, - "response.ResourceSpecRender": { + "sql.IndexStatus": { + "type": "string", + "enum": [ + "creating", + "available", + "error" + ], + "x-enum-varnames": [ + "IndexStatusCreating", + "IndexStatusAvailable", + "IndexStatusError" + ] + }, + "sql.MetricCategory": { + "type": "string", + "enum": [ + "meta", + "latency", + "execution" + ], + "x-enum-varnames": [ + "Meta", + "Latency", + "Execution" + ] + }, + "sql.PlanCategory": { + "type": "string", + "enum": [ + "local", + "remote", + "distributed" + ], + "x-enum-varnames": [ + "PlanCategoryLocal", + "PlanCategoryRemote", + "PlanCategoryDistributed" + ] + }, + "sql.PlanDetail": { "type": "object", "required": [ - "cpu", - "memory" + "category", + "generatedTime", + "mergedVersion", + "planDetail", + "planHash", + "planStatistics" ], "properties": { - "cpu": { + "category": { + "$ref": "#/definitions/sql.PlanCategory" + }, + "generatedTime": { "type": "integer" }, - "memory": { + "mergedVersion": { "type": "integer" + }, + "planDetail": { + "$ref": "#/definitions/sql.PlanOperator" + }, + "planHash": { + "type": "string" + }, + "planStatistics": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.PlanStatisticByServer" + } } } }, - "response.RestoreSource": { + "sql.PlanDetailParam": { "type": "object", "required": [ - "archiveSource", - "bakDataSource", - "type" + "namespace", + "obcluster", + "planHash" ], "properties": { - "archiveSource": { + "database": { "type": "string" }, - "bakDataSource": { + "endTime": { + "type": "integer" + }, + "namespace": { "type": "string" }, - "bakEncryptionSecret": { + "obcluster": { "type": "string" }, - "ossAccessSecret": { + "obtenant": { "type": "string" }, - "type": { - "description": "Enum: OSS, NFS", + "planHash": { "type": "string" }, - "until": { + "startTime": { + "type": "integer" + }, + "user": { "type": "string" } } }, - "response.StatisticData": { + "sql.PlanOperator": { "type": "object", "required": [ - "backupPolicies", - "clusters", - "k8sNodes", - "servers", - "tenants", - "warningEvents", - "zones" + "cost", + "estimatedRows", + "operator" ], "properties": { - "backupPolicies": { + "childOperators": { "type": "array", "items": { - "$ref": "#/definitions/models.OBBackupPolicy" + "$ref": "#/definitions/sql.PlanOperator" } }, - "clusters": { - "type": "array", - "items": { - "$ref": "#/definitions/models.OBCluster" - } + "cost": { + "type": "integer" }, - "k8sNodes": { - "type": "array", - "items": { - "$ref": "#/definitions/response.K8sNode" - } + "estimatedRows": { + "type": "integer" }, - "operatorVersion": { + "name": { "type": "string" }, - "servers": { - "type": "array", - "items": { - "$ref": "#/definitions/models.OBServer" - } - }, - "tenants": { - "type": "array", - "items": { - "$ref": "#/definitions/models.OBTenant" - } - }, - "warningEvents": { - "type": "array", - "items": { - "$ref": "#/definitions/models.K8sEvent" - } + "operator": { + "type": "string" }, - "zones": { - "type": "array", - "items": { - "$ref": "#/definitions/models.OBZone" - } + "outputOrFilter": { + "type": "string" } } }, - "response.StorageClass": { + "sql.PlanStatistic": { "type": "object", "required": [ - "allowVolumeExpansion", - "name", - "provisioner", - "reclaimPolicy", - "volumeBindingMode" + "category", + "cost", + "cpuTime", + "generatedTime", + "mergedVersion", + "planHash" ], "properties": { - "allowVolumeExpansion": { - "type": "boolean" - }, - "mountOptions": { - "type": "array", - "items": { - "type": "string" - } + "category": { + "$ref": "#/definitions/sql.PlanCategory" }, - "name": { - "type": "string" + "cost": { + "type": "integer" }, - "parameters": { - "type": "array", - "items": { - "$ref": "#/definitions/common.KVPair" - } + "cpuTime": { + "type": "integer" }, - "provisioner": { - "type": "string" + "generatedTime": { + "type": "integer" }, - "reclaimPolicy": { - "type": "string" + "mergedVersion": { + "type": "integer" }, - "volumeBindingMode": { + "planHash": { "type": "string" } } }, - "response.StorageSpec": { + "sql.PlanStatisticByServer": { "type": "object", "required": [ - "size", - "storageClass" + "category", + "cost", + "cpuTime", + "generatedTime", + "mergedVersion", + "planHash", + "planId", + "server" ], "properties": { - "size": { + "category": { + "$ref": "#/definitions/sql.PlanCategory" + }, + "cost": { "type": "integer" }, - "storageClass": { + "cpuTime": { + "type": "integer" + }, + "generatedTime": { + "type": "integer" + }, + "mergedVersion": { + "type": "integer" + }, + "planHash": { + "type": "string" + }, + "planId": { + "type": "integer" + }, + "server": { "type": "string" } } }, - "route.RouteParam": { + "sql.RequestStatisticInfo": { "type": "object", "required": [ - "aggregateLabels", - "groupInterval", - "groupWait", - "matchers", - "receiver", - "repeatInterval" + "database", + "executionStatistics", + "executionTrend", + "latencyStatistics", + "latencyTrend", + "planCategoryStatistics", + "tenant", + "user" ], "properties": { - "aggregateLabels": { + "database": { + "type": "string" + }, + "executionStatistics": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/sql.SqlStatisticMetric" } }, - "groupInterval": { - "type": "integer" + "executionTrend": { + "$ref": "#/definitions/response.MetricData" }, - "groupWait": { - "type": "integer" + "latencyStatistics": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.SqlStatisticMetric" + } }, - "id": { - "type": "string" + "latencyTrend": { + "$ref": "#/definitions/response.MetricData" }, - "matchers": { + "planCategoryStatistics": { "type": "array", "items": { - "$ref": "#/definitions/alarm.Matcher" + "$ref": "#/definitions/sql.SqlStatisticMetric" } }, - "receiver": { + "tenant": { "type": "string" }, - "repeatInterval": { - "type": "integer" + "user": { + "type": "string" } } }, - "route.RouteResponse": { + "sql.SqlDetailParam": { "type": "object", "required": [ - "aggregateLabels", - "groupInterval", - "groupWait", - "id", - "matchers", - "receiver", - "repeatInterval" + "interval", + "namespace", + "obcluster", + "sqlId" ], "properties": { - "aggregateLabels": { - "type": "array", - "items": { - "type": "string" - } + "database": { + "type": "string" }, - "groupInterval": { + "endTime": { "type": "integer" }, - "groupWait": { + "interval": { "type": "integer" }, - "id": { + "namespace": { "type": "string" }, - "matchers": { - "type": "array", - "items": { - "$ref": "#/definitions/alarm.Matcher" - } + "obcluster": { + "type": "string" }, - "receiver": { + "obtenant": { "type": "string" }, - "repeatInterval": { + "sqlId": { + "type": "string" + }, + "startTime": { "type": "integer" + }, + "user": { + "type": "string" } } }, - "rule.Rule": { + "sql.SqlDetailedInfo": { "type": "object", "required": [ - "description", - "duration", - "instanceType", - "labels", - "name", - "query", - "severity", - "summary" + "executionTrend", + "latencyTrend", + "plans" ], "properties": { - "description": { - "type": "string" - }, - "duration": { - "type": "integer" - }, - "instanceType": { - "$ref": "#/definitions/oceanbase.OBInstanceType" - }, - "labels": { + "diagnoseInfo": { "type": "array", "items": { - "$ref": "#/definitions/common.KVPair" + "$ref": "#/definitions/sql.SqlDiagnoseInfo" } }, - "name": { - "type": "string" - }, - "query": { - "type": "string" + "executionTrend": { + "type": "array", + "items": { + "$ref": "#/definitions/response.MetricData" + } }, - "severity": { - "$ref": "#/definitions/alarm.Severity" + "indexies": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.IndexInfo" + } }, - "summary": { - "type": "string" + "latencyTrend": { + "type": "array", + "items": { + "$ref": "#/definitions/response.MetricData" + } }, - "type": { - "default": "customized", - "allOf": [ - { - "$ref": "#/definitions/rule.RuleType" - } - ] + "plans": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.PlanStatistic" + } } } }, - "rule.RuleFilter": { + "sql.SqlDiagnoseInfo": { "type": "object", + "required": [ + "reason" + ], "properties": { - "instanceType": { - "$ref": "#/definitions/oceanbase.OBInstanceType" - }, - "keyword": { + "reason": { "type": "string" }, - "severity": { - "$ref": "#/definitions/alarm.Severity" + "suggestion": { + "type": "string" } } }, - "rule.RuleHealth": { - "type": "string", - "enum": [ - "unknown", - "ok", - "error" - ], - "x-enum-varnames": [ - "HealthUnknown", - "HealthOK", - "HealthError" - ] - }, - "rule.RuleResponse": { + "sql.SqlFilter": { "type": "object", "required": [ - "description", - "duration", - "evaluationTime", - "health", - "instanceType", - "keepFiringFor", - "labels", - "lastEvaluation", - "name", - "query", - "severity", - "state", - "summary" + "namespace", + "obcluster" ], "properties": { - "description": { + "database": { "type": "string" }, - "duration": { + "endTime": { "type": "integer" }, - "evaluationTime": { - "type": "number" + "includeInnerSql": { + "type": "boolean" }, - "health": { - "$ref": "#/definitions/rule.RuleHealth" + "keyword": { + "type": "string" }, - "instanceType": { - "$ref": "#/definitions/oceanbase.OBInstanceType" + "namespace": { + "type": "string" }, - "keepFiringFor": { + "obcluster": { + "type": "string" + }, + "obtenant": { + "type": "string" + }, + "startTime": { "type": "integer" }, - "labels": { + "user": { + "type": "string" + } + } + }, + "sql.SqlInfo": { + "type": "object", + "required": [ + "database", + "executionStatistics", + "isInner", + "latencyStatistics", + "observer", + "sqlID", + "sqlText", + "sqlType", + "tenant", + "user" + ], + "properties": { + "database": { + "type": "string" + }, + "diagnoseInfo": { "type": "array", "items": { - "$ref": "#/definitions/common.KVPair" + "$ref": "#/definitions/sql.SqlDiagnoseInfo" } }, - "lastError": { - "type": "string" + "executionStatistics": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.SqlStatisticMetric" + } }, - "lastEvaluation": { - "type": "integer" + "isInner": { + "type": "boolean" }, - "name": { + "latencyStatistics": { + "type": "array", + "items": { + "$ref": "#/definitions/sql.SqlStatisticMetric" + } + }, + "observer": { "type": "string" }, - "query": { + "sqlID": { "type": "string" }, - "severity": { - "$ref": "#/definitions/alarm.Severity" + "sqlText": { + "type": "string" }, - "state": { - "$ref": "#/definitions/rule.RuleState" + "sqlType": { + "type": "string" }, - "summary": { + "tenant": { "type": "string" }, - "type": { - "default": "customized", - "allOf": [ - { - "$ref": "#/definitions/rule.RuleType" - } - ] + "user": { + "type": "string" } } }, - "rule.RuleState": { - "type": "string", - "enum": [ - "active", - "inactive" - ], - "x-enum-varnames": [ - "StateActive", - "StateInactive" - ] - }, - "rule.RuleType": { - "type": "string", - "enum": [ - "builtin", - "customized" - ], - "x-enum-varnames": [ - "TypeBuiltin", - "TypeCustomized" - ] - }, - "silence.SilencerFilter": { + "sql.SqlMetricMeta": { "type": "object", + "required": [ + "category", + "description", + "displayByDefault", + "name" + ], "properties": { - "instance": { - "$ref": "#/definitions/oceanbase.OBInstance" + "category": { + "$ref": "#/definitions/sql.MetricCategory" }, - "instanceType": { - "$ref": "#/definitions/oceanbase.OBInstanceType" + "description": { + "type": "string" }, - "keyword": { + "displayByDefault": { + "type": "boolean" + }, + "name": { "type": "string" } } }, - "silence.SilencerParam": { + "sql.SqlMetricMetaCategory": { "type": "object", "required": [ - "comment", - "createdBy", - "endsAt", - "instances", - "matchers", - "rules", - "startsAt" + "category", + "metrics" ], "properties": { - "comment": { - "type": "string" - }, - "createdBy": { - "type": "string" - }, - "endsAt": { - "type": "integer" - }, - "id": { - "type": "string" - }, - "instances": { - "type": "array", - "items": { - "$ref": "#/definitions/oceanbase.OBInstance" - } - }, - "matchers": { - "type": "array", - "items": { - "$ref": "#/definitions/alarm.Matcher" - } + "category": { + "$ref": "#/definitions/sql.MetricCategory" }, - "rules": { + "metrics": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/sql.SqlMetricMeta" } - }, - "startsAt": { - "type": "integer" } } }, - "silence.SilencerResponse": { + "sql.SqlRequestStatisticParam": { "type": "object", "required": [ - "comment", - "createdBy", - "endsAt", - "id", - "instances", - "matchers", - "rules", - "startsAt", - "status", - "updatedAt" + "namespace", + "obcluster", + "statisticScopes" ], "properties": { - "comment": { - "type": "string" - }, - "createdBy": { + "database": { "type": "string" }, - "endsAt": { + "endTime": { "type": "integer" }, - "id": { + "namespace": { "type": "string" }, - "instances": { - "type": "array", - "items": { - "$ref": "#/definitions/oceanbase.OBInstance" - } + "obcluster": { + "type": "string" }, - "matchers": { - "type": "array", - "items": { - "$ref": "#/definitions/alarm.Matcher" - } + "obtenant": { + "type": "string" }, - "rules": { + "startTime": { + "type": "integer" + }, + "statisticScopes": { "type": "array", "items": { "type": "string" } }, - "startsAt": { - "type": "integer" - }, - "status": { - "$ref": "#/definitions/silence.Status" - }, - "updatedAt": { - "type": "integer" + "user": { + "type": "string" } } }, - "silence.State": { - "type": "string", - "enum": [ - "active", - "expired", - "pending" - ], - "x-enum-varnames": [ - "StateActive", - "StateExpired", - "StatePending" - ] - }, - "silence.Status": { + "sql.SqlStatisticMetric": { "type": "object", "required": [ - "state" + "name", + "value" ], "properties": { - "state": { - "$ref": "#/definitions/silence.State" + "name": { + "type": "string" + }, + "value": { + "type": "number" } } } diff --git a/internal/dashboard/generated/swagger/swagger.yaml b/internal/dashboard/generated/swagger/swagger.yaml index 16491d129..76b43c25a 100644 --- a/internal/dashboard/generated/swagger/swagger.yaml +++ b/internal/dashboard/generated/swagger/swagger.yaml @@ -2513,6 +2513,414 @@ definitions: required: - state type: object + sql.IndexCategory: + enum: + - primaryKey + - globalNormal + - globalUnique + - localNormal + - localUnique + type: string + x-enum-varnames: + - IndexCategoryPrimaryKey + - IndexCategoryGlobalNormal + - IndexCategoryGlobalUnique + - IndexCategoryLocalNormal + - IndexCategoryLocalUnique + sql.IndexInfo: + properties: + category: + $ref: '#/definitions/sql.IndexCategory' + columns: + items: + type: string + type: array + indexName: + type: string + status: + $ref: '#/definitions/sql.IndexStatus' + tableName: + type: string + required: + - category + - columns + - indexName + - status + - tableName + type: object + sql.IndexStatus: + enum: + - creating + - available + - error + type: string + x-enum-varnames: + - IndexStatusCreating + - IndexStatusAvailable + - IndexStatusError + sql.MetricCategory: + enum: + - meta + - latency + - execution + type: string + x-enum-varnames: + - Meta + - Latency + - Execution + sql.PlanCategory: + enum: + - local + - remote + - distributed + type: string + x-enum-varnames: + - PlanCategoryLocal + - PlanCategoryRemote + - PlanCategoryDistributed + sql.PlanDetail: + properties: + category: + $ref: '#/definitions/sql.PlanCategory' + generatedTime: + type: integer + mergedVersion: + type: integer + planDetail: + $ref: '#/definitions/sql.PlanOperator' + planHash: + type: string + planStatistics: + items: + $ref: '#/definitions/sql.PlanStatisticByServer' + type: array + required: + - category + - generatedTime + - mergedVersion + - planDetail + - planHash + - planStatistics + type: object + sql.PlanDetailParam: + properties: + database: + type: string + endTime: + type: integer + namespace: + type: string + obcluster: + type: string + obtenant: + type: string + planHash: + type: string + startTime: + type: integer + user: + type: string + required: + - namespace + - obcluster + - planHash + type: object + sql.PlanOperator: + properties: + childOperators: + items: + $ref: '#/definitions/sql.PlanOperator' + type: array + cost: + type: integer + estimatedRows: + type: integer + name: + type: string + operator: + type: string + outputOrFilter: + type: string + required: + - cost + - estimatedRows + - operator + type: object + sql.PlanStatistic: + properties: + category: + $ref: '#/definitions/sql.PlanCategory' + cost: + type: integer + cpuTime: + type: integer + generatedTime: + type: integer + mergedVersion: + type: integer + planHash: + type: string + required: + - category + - cost + - cpuTime + - generatedTime + - mergedVersion + - planHash + type: object + sql.PlanStatisticByServer: + properties: + category: + $ref: '#/definitions/sql.PlanCategory' + cost: + type: integer + cpuTime: + type: integer + generatedTime: + type: integer + mergedVersion: + type: integer + planHash: + type: string + planId: + type: integer + server: + type: string + required: + - category + - cost + - cpuTime + - generatedTime + - mergedVersion + - planHash + - planId + - server + type: object + sql.RequestStatisticInfo: + properties: + database: + type: string + executionStatistics: + items: + $ref: '#/definitions/sql.SqlStatisticMetric' + type: array + executionTrend: + $ref: '#/definitions/response.MetricData' + latencyStatistics: + items: + $ref: '#/definitions/sql.SqlStatisticMetric' + type: array + latencyTrend: + $ref: '#/definitions/response.MetricData' + planCategoryStatistics: + items: + $ref: '#/definitions/sql.SqlStatisticMetric' + type: array + tenant: + type: string + user: + type: string + required: + - database + - executionStatistics + - executionTrend + - latencyStatistics + - latencyTrend + - planCategoryStatistics + - tenant + - user + type: object + sql.SqlDetailParam: + properties: + database: + type: string + endTime: + type: integer + interval: + type: integer + namespace: + type: string + obcluster: + type: string + obtenant: + type: string + sqlId: + type: string + startTime: + type: integer + user: + type: string + required: + - interval + - namespace + - obcluster + - sqlId + type: object + sql.SqlDetailedInfo: + properties: + diagnoseInfo: + items: + $ref: '#/definitions/sql.SqlDiagnoseInfo' + type: array + executionTrend: + items: + $ref: '#/definitions/response.MetricData' + type: array + indexies: + items: + $ref: '#/definitions/sql.IndexInfo' + type: array + latencyTrend: + items: + $ref: '#/definitions/response.MetricData' + type: array + plans: + items: + $ref: '#/definitions/sql.PlanStatistic' + type: array + required: + - executionTrend + - latencyTrend + - plans + type: object + sql.SqlDiagnoseInfo: + properties: + reason: + type: string + suggestion: + type: string + required: + - reason + type: object + sql.SqlFilter: + properties: + database: + type: string + endTime: + type: integer + includeInnerSql: + type: boolean + keyword: + type: string + namespace: + type: string + obcluster: + type: string + obtenant: + type: string + startTime: + type: integer + user: + type: string + required: + - namespace + - obcluster + type: object + sql.SqlInfo: + properties: + database: + type: string + diagnoseInfo: + items: + $ref: '#/definitions/sql.SqlDiagnoseInfo' + type: array + executionStatistics: + items: + $ref: '#/definitions/sql.SqlStatisticMetric' + type: array + isInner: + type: boolean + latencyStatistics: + items: + $ref: '#/definitions/sql.SqlStatisticMetric' + type: array + observer: + type: string + sqlID: + type: string + sqlText: + type: string + sqlType: + type: string + tenant: + type: string + user: + type: string + required: + - database + - executionStatistics + - isInner + - latencyStatistics + - observer + - sqlID + - sqlText + - sqlType + - tenant + - user + type: object + sql.SqlMetricMeta: + properties: + category: + $ref: '#/definitions/sql.MetricCategory' + description: + type: string + displayByDefault: + type: boolean + name: + type: string + required: + - category + - description + - displayByDefault + - name + type: object + sql.SqlMetricMetaCategory: + properties: + category: + $ref: '#/definitions/sql.MetricCategory' + metrics: + items: + $ref: '#/definitions/sql.SqlMetricMeta' + type: array + required: + - category + - metrics + type: object + sql.SqlRequestStatisticParam: + properties: + database: + type: string + endTime: + type: integer + namespace: + type: string + obcluster: + type: string + obtenant: + type: string + startTime: + type: integer + statisticScopes: + items: + type: string + type: array + user: + type: string + required: + - namespace + - obcluster + - statisticScopes + type: object + sql.SqlStatisticMetric: + properties: + name: + type: string + value: + type: number + required: + - name + - value + type: object info: contact: {} description: OceanBase Dashboard @@ -5504,12 +5912,12 @@ paths: summary: Create backup policy of specific tenant tags: - OBTenant - /api/v1/obtenants/{namespace}/{name}/logreplay: - post: + /api/v1/obtenants/{namespace}/{name}/databases: + get: consumes: - application/json - description: Replay standby log of specific standby tenant - operationId: ReplayStandbyLog + description: List all the databases under obtenant + operationId: ListOBTenantDatabases parameters: - description: obtenant namespace in: path @@ -5521,12 +5929,6 @@ paths: name: name required: true type: string - - description: target timestamp to replay to - in: body - name: body - required: true - schema: - $ref: '#/definitions/param.ReplayStandbyLog' produces: - application/json responses: @@ -5537,7 +5939,9 @@ paths: - $ref: '#/definitions/response.APIResponse' - properties: data: - $ref: '#/definitions/response.OBTenantDetail' + items: + type: string + type: array type: object "400": description: Bad Request @@ -5553,15 +5957,15 @@ paths: $ref: '#/definitions/response.APIResponse' security: - ApiKeyAuth: [] - summary: Replay standby log of specific standby tenant + summary: List obtenant databases tags: - OBTenant - /api/v1/obtenants/{namespace}/{name}/pools/{zoneName}: - delete: + /api/v1/obtenants/{namespace}/{name}/logreplay: + post: consumes: - application/json - description: Delete an obtenant pool in a specific namespace - operationId: DeleteOBTenantPool + description: Replay standby log of specific standby tenant + operationId: ReplayStandbyLog parameters: - description: obtenant namespace in: path @@ -5573,11 +5977,63 @@ paths: name: name required: true type: string - - description: obzone name - in: path - name: zoneName + - description: target timestamp to replay to + in: body + name: body required: true - type: string + schema: + $ref: '#/definitions/param.ReplayStandbyLog' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.APIResponse' + - properties: + data: + $ref: '#/definitions/response.OBTenantDetail' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + security: + - ApiKeyAuth: [] + summary: Replay standby log of specific standby tenant + tags: + - OBTenant + /api/v1/obtenants/{namespace}/{name}/pools/{zoneName}: + delete: + consumes: + - application/json + description: Delete an obtenant pool in a specific namespace + operationId: DeleteOBTenantPool + parameters: + - description: obtenant namespace + in: path + name: namespace + required: true + type: string + - description: obtenant name + in: path + name: name + required: true + type: string + - description: obzone name + in: path + name: zoneName + required: true + type: string produces: - application/json responses: @@ -5926,6 +6382,54 @@ paths: summary: Change root password of specific tenant tags: - OBTenant + /api/v1/obtenants/{namespace}/{name}/users: + get: + consumes: + - application/json + description: List all the users under obtenant + operationId: ListOBTenantUsers + parameters: + - description: obtenant namespace + in: path + name: namespace + required: true + type: string + - description: obtenant name + in: path + name: name + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.APIResponse' + - properties: + data: + items: + type: string + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + security: + - ApiKeyAuth: [] + summary: List obtenant users + tags: + - OBTenant /api/v1/obtenants/{namespace}/{name}/version: post: consumes: @@ -6010,6 +6514,259 @@ paths: summary: List statistics information of tenants tags: - OBTenant + /api/v1/sql/metrics: + get: + consumes: + - application/json + description: list sqls metrics + operationId: ListSqlMetrics + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.APIResponse' + - properties: + data: + items: + $ref: '#/definitions/sql.SqlMetricMetaCategory' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + security: + - ApiKeyAuth: [] + summary: list sql metrics + tags: + - Sql + /api/v1/sql/queryPlanDetailInfo: + post: + consumes: + - application/json + description: query detailed statistic info of a plan + operationId: QueryPlanDetailInfo + parameters: + - description: param for query detailed plan info + in: body + name: body + required: true + schema: + $ref: '#/definitions/sql.PlanDetailParam' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.APIResponse' + - properties: + data: + $ref: '#/definitions/sql.PlanDetail' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + security: + - ApiKeyAuth: [] + summary: query plan detail info + tags: + - Sql + /api/v1/sql/querySqlDetailInfo: + post: + consumes: + - application/json + description: query detailed statistic info of a SQL + operationId: QuerySqlDetailInfo + parameters: + - description: param for query detailed sql info + in: body + name: body + required: true + schema: + $ref: '#/definitions/sql.SqlDetailParam' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.APIResponse' + - properties: + data: + $ref: '#/definitions/sql.SqlDetailedInfo' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + security: + - ApiKeyAuth: [] + summary: query SQL detail info + tags: + - Sql + /api/v1/sql/requestStatistics: + post: + consumes: + - application/json + description: list request statistics + operationId: RequestStatistics + parameters: + - description: sql request statistic param + in: body + name: body + required: true + schema: + $ref: '#/definitions/sql.SqlRequestStatisticParam' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.APIResponse' + - properties: + data: + items: + $ref: '#/definitions/sql.RequestStatisticInfo' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + security: + - ApiKeyAuth: [] + summary: list request statistics + tags: + - Sql + /api/v1/sql/suspiciousSqls: + post: + consumes: + - application/json + description: list suspicious sqls + operationId: ListSuspiciousSqls + parameters: + - description: sql filter + in: body + name: body + required: true + schema: + $ref: '#/definitions/sql.SqlFilter' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.APIResponse' + - properties: + data: + items: + $ref: '#/definitions/sql.SqlInfo' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + security: + - ApiKeyAuth: [] + summary: list suspicious sqls + tags: + - Sql + /api/v1/sql/topSqls: + post: + consumes: + - application/json + description: list top sqls ordering by spcecific metrics + operationId: ListTopSqls + parameters: + - description: sql filter + in: body + name: body + required: true + schema: + $ref: '#/definitions/sql.SqlFilter' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.APIResponse' + - properties: + data: + items: + $ref: '#/definitions/sql.SqlInfo' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + security: + - ApiKeyAuth: [] + summary: list top sqls + tags: + - Sql /api/v1/statistics: get: consumes: diff --git a/internal/dashboard/handler/obtenant_handler.go b/internal/dashboard/handler/obtenant_handler.go index e04644356..d82c6eef2 100644 --- a/internal/dashboard/handler/obtenant_handler.go +++ b/internal/dashboard/handler/obtenant_handler.go @@ -32,6 +32,7 @@ import ( "github.com/oceanbase/ob-operator/internal/dashboard/model/param" "github.com/oceanbase/ob-operator/internal/dashboard/model/response" crypto "github.com/oceanbase/ob-operator/pkg/crypto" + "github.com/oceanbase/ob-operator/pkg/errors" httpErr "github.com/oceanbase/ob-operator/pkg/errors" "github.com/oceanbase/ob-operator/pkg/k8s/client" ) @@ -817,3 +818,39 @@ func ListOBTenantRelatedEvents(c *gin.Context) ([]response.K8sEvent, error) { logger.Debugf("Get related events of obtenant: %v", nn) return events, nil } + +// @ID ListOBTenantUsers +// @Tags OBTenant +// @Summary List obtenant users +// @Description List all the users under obtenant +// @Accept application/json +// @Produce application/json +// @Success 200 object response.APIResponse{data=[]string} +// @Failure 400 object response.APIResponse +// @Failure 401 object response.APIResponse +// @Failure 500 object response.APIResponse +// @Param namespace path string true "obtenant namespace" +// @Param name path string true "obtenant name" +// @Router /api/v1/obtenants/{namespace}/{name}/users [GET] +// @Security ApiKeyAuth +func ListOBTenantUsers(_ *gin.Context) ([]string, error) { + return nil, errors.NewNotImplemented("") +} + +// @ID ListOBTenantDatabases +// @Tags OBTenant +// @Summary List obtenant databases +// @Description List all the databases under obtenant +// @Accept application/json +// @Produce application/json +// @Success 200 object response.APIResponse{data=[]string} +// @Failure 400 object response.APIResponse +// @Failure 401 object response.APIResponse +// @Failure 500 object response.APIResponse +// @Param namespace path string true "obtenant namespace" +// @Param name path string true "obtenant name" +// @Router /api/v1/obtenants/{namespace}/{name}/databases [GET] +// @Security ApiKeyAuth +func ListOBTenantDatabases(_ *gin.Context) ([]string, error) { + return nil, errors.NewNotImplemented("") +} diff --git a/internal/dashboard/handler/sql_handler.go b/internal/dashboard/handler/sql_handler.go new file mode 100644 index 000000000..ba17411fb --- /dev/null +++ b/internal/dashboard/handler/sql_handler.go @@ -0,0 +1,121 @@ +/* +Copyright (c) 2023 OceanBase +ob-operator is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. +*/ + +package handler + +import ( + "github.com/gin-gonic/gin" + + "github.com/oceanbase/ob-operator/internal/dashboard/model/sql" + httpErr "github.com/oceanbase/ob-operator/pkg/errors" +) + +// @ID ListSqlMetrics +// @Summary list sql metrics +// @Description list sqls metrics +// @Tags Sql +// @Accept application/json +// @Produce application/json +// @Success 200 object response.APIResponse{data=[]sql.SqlMetricMetaCategory} +// @Failure 400 object response.APIResponse +// @Failure 401 object response.APIResponse +// @Failure 500 object response.APIResponse +// @Router /api/v1/sql/metrics [GET] +// @Security ApiKeyAuth +func ListSqlMetrics(_ *gin.Context) ([]sql.SqlMetricMetaCategory, error) { + return nil, httpErr.NewNotImplemented("") +} + +// @ID ListTopSqls +// @Summary list top sqls +// @Description list top sqls ordering by spcecific metrics +// @Tags Sql +// @Accept application/json +// @Produce application/json +// @Param body body sql.SqlFilter true "sql filter" +// @Success 200 object response.APIResponse{data=[]sql.SqlInfo} +// @Failure 400 object response.APIResponse +// @Failure 401 object response.APIResponse +// @Failure 500 object response.APIResponse +// @Router /api/v1/sql/topSqls [POST] +// @Security ApiKeyAuth +func ListTopSqls(_ *gin.Context) ([]sql.SqlInfo, error) { + return nil, httpErr.NewNotImplemented("") +} + +// @ID ListSuspiciousSqls +// @Summary list suspicious sqls +// @Description list suspicious sqls +// @Tags Sql +// @Accept application/json +// @Produce application/json +// @Param body body sql.SqlFilter true "sql filter" +// @Success 200 object response.APIResponse{data=[]sql.SqlInfo} +// @Failure 400 object response.APIResponse +// @Failure 401 object response.APIResponse +// @Failure 500 object response.APIResponse +// @Router /api/v1/sql/suspiciousSqls [POST] +// @Security ApiKeyAuth +func ListSuspiciousSqls(_ *gin.Context) ([]sql.SqlInfo, error) { + return nil, httpErr.NewNotImplemented("") +} + +// @ID RequestStatistics +// @Summary list request statistics +// @Description list request statistics +// @Tags Sql +// @Accept application/json +// @Produce application/json +// @Param body body sql.SqlRequestStatisticParam true "sql request statistic param" +// @Success 200 object response.APIResponse{data=[]sql.RequestStatisticInfo} +// @Failure 400 object response.APIResponse +// @Failure 401 object response.APIResponse +// @Failure 500 object response.APIResponse +// @Router /api/v1/sql/requestStatistics [POST] +// @Security ApiKeyAuth +func RequestStatistics(_ *gin.Context) ([]sql.RequestStatisticInfo, error) { + return nil, httpErr.NewNotImplemented("") +} + +// @ID QuerySqlDetailInfo +// @Summary query SQL detail info +// @Description query detailed statistic info of a SQL +// @Tags Sql +// @Accept application/json +// @Produce application/json +// @Param body body sql.SqlDetailParam true "param for query detailed sql info" +// @Success 200 object response.APIResponse{data=sql.SqlDetailedInfo} +// @Failure 400 object response.APIResponse +// @Failure 401 object response.APIResponse +// @Failure 500 object response.APIResponse +// @Router /api/v1/sql/querySqlDetailInfo [POST] +// @Security ApiKeyAuth +func QuerySqlDetailInfo(_ *gin.Context) (*sql.SqlDetailedInfo, error) { + return nil, httpErr.NewNotImplemented("") +} + +// @ID QueryPlanDetailInfo +// @Summary query plan detail info +// @Description query detailed statistic info of a plan +// @Tags Sql +// @Accept application/json +// @Produce application/json +// @Param body body sql.PlanDetailParam true "param for query detailed plan info" +// @Success 200 object response.APIResponse{data=sql.PlanDetail} +// @Failure 400 object response.APIResponse +// @Failure 401 object response.APIResponse +// @Failure 500 object response.APIResponse +// @Router /api/v1/sql/queryPlanDetailInfo [POST] +// @Security ApiKeyAuth +func QueryPlanDetailInfo(_ *gin.Context) (*sql.PlanDetail, error) { + return nil, httpErr.NewNotImplemented("") +} diff --git a/internal/dashboard/model/sql/index_info.go b/internal/dashboard/model/sql/index_info.go new file mode 100644 index 000000000..73727d988 --- /dev/null +++ b/internal/dashboard/model/sql/index_info.go @@ -0,0 +1,38 @@ +/* +Copyright (c) 2023 OceanBase +ob-operator is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. +*/ + +package sql + +type IndexCategory string +type IndexStatus string + +const ( + IndexCategoryPrimaryKey IndexCategory = "primaryKey" + IndexCategoryGlobalNormal IndexCategory = "globalNormal" + IndexCategoryGlobalUnique IndexCategory = "globalUnique" + IndexCategoryLocalNormal IndexCategory = "localNormal" + IndexCategoryLocalUnique IndexCategory = "localUnique" +) + +const ( + IndexStatusCreating IndexStatus = "creating" + IndexStatusAvailable IndexStatus = "available" + IndexStatusError IndexStatus = "error" +) + +type IndexInfo struct { + TableName string `json:"tableName" binding:"required"` + Category IndexCategory `json:"category" binding:"required"` + IndexName string `json:"indexName" binding:"required"` + Columns []string `json:"columns" binding:"required"` + Status IndexStatus `json:"status" binding:"required"` +} diff --git a/internal/dashboard/model/sql/plan_info.go b/internal/dashboard/model/sql/plan_info.go new file mode 100644 index 000000000..f21e63915 --- /dev/null +++ b/internal/dashboard/model/sql/plan_info.go @@ -0,0 +1,55 @@ +/* +Copyright (c) 2023 OceanBase +ob-operator is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. +*/ + +package sql + +type PlanCategory string + +const ( + PlanCategoryLocal PlanCategory = "local" + PlanCategoryRemote PlanCategory = "remote" + PlanCategoryDistributed PlanCategory = "distributed" +) + +type PlanMeta struct { + PlanHash string `json:"planHash" binding:"required"` + Category PlanCategory `json:"category" binding:"required"` + MergedVersion int `json:"mergedVersion" binding:"required"` + GeneratedTime int64 `json:"generatedTime" binding:"required"` +} + +type PlanStatistic struct { + PlanMeta `json:",inline"` + CpuTime int64 `json:"cpuTime" binding:"required"` + Cost int64 `json:"cost" binding:"required"` +} + +type PlanStatisticByServer struct { + PlanStatistic `json:",inline"` + Server string `json:"server" binding:"required"` + PlanId int64 `json:"planId" binding:"required"` +} + +type PlanOperator struct { + Operator string `json:"operator" binding:"required"` + Name string `json:"name,omitempty"` + EstimatedRows int `json:"estimatedRows" binding:"required"` + Cost int64 `json:"cost" binding:"required"` + OutputOrFilter string `json:"outputOrFilter,omitempty"` + ChildOperators []*PlanOperator `json:"childOperators,omitempty"` +} + +type PlanDetail struct { + PlanMeta `json:",inline"` + PlanStatistics []PlanStatisticByServer `json:"planStatistics" binding:"required"` + PlanDetail *PlanOperator `json:"planDetail" binding:"required"` +} diff --git a/internal/dashboard/model/sql/request_statistics.go b/internal/dashboard/model/sql/request_statistics.go new file mode 100644 index 000000000..55a8305ce --- /dev/null +++ b/internal/dashboard/model/sql/request_statistics.go @@ -0,0 +1,28 @@ +/* +Copyright (c) 2023 OceanBase +ob-operator is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. +*/ + +package sql + +import ( + "github.com/oceanbase/ob-operator/internal/dashboard/model/response" +) + +type RequestStatisticInfo struct { + Tenant string `json:"tenant" binding:"required"` + User string `json:"user" binding:"required"` + Database string `json:"database" binding:"required"` + PlanCategoryStatistics []SqlStatisticMetric `json:"planCategoryStatistics" binding:"required"` + ExecutionStatistics []SqlStatisticMetric `json:"executionStatistics" binding:"required"` + LatencyStatistics []SqlStatisticMetric `json:"latencyStatistics" binding:"required"` + ExecutionTrend response.MetricData `json:"executionTrend" binding:"required"` + LatencyTrend response.MetricData `json:"latencyTrend" binding:"required"` +} diff --git a/internal/dashboard/model/sql/sql_info.go b/internal/dashboard/model/sql/sql_info.go new file mode 100644 index 000000000..523af33f3 --- /dev/null +++ b/internal/dashboard/model/sql/sql_info.go @@ -0,0 +1,53 @@ +/* +Copyright (c) 2023 OceanBase +ob-operator is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. +*/ + +package sql + +import ( + "github.com/oceanbase/ob-operator/internal/dashboard/model/response" +) + +type SqlStatisticMetric struct { + Name string `json:"name" binding:"required"` + Value float64 `json:"value" binding:"required"` +} + +type SqlDiagnoseInfo struct { + Reason string `json:"reason" binding:"required"` + Suggestion string `json:"suggestion,omitempty"` +} + +type SqlMetaInfo struct { + OBServer string `json:"observer" binding:"required"` + Tenant string `json:"tenant" binding:"required"` + User string `json:"user" binding:"required"` + Database string `json:"database" binding:"required"` + SqlType string `json:"sqlType" binding:"required"` + SqlID string `json:"sqlID" binding:"required"` + IsInner bool `json:"isInner" binding:"required"` + SqlText string `json:"sqlText" binding:"required"` +} + +type SqlInfo struct { + SqlMetaInfo `json:",inline"` + ExecutionStatistics []SqlStatisticMetric `json:"executionStatistics" binding:"required"` + LatencyStatistics []SqlStatisticMetric `json:"latencyStatistics" binding:"required"` + DiagnoseInfo []SqlDiagnoseInfo `json:"diagnoseInfo,omitempty"` +} + +type SqlDetailedInfo struct { + ExecutionTrend []response.MetricData `json:"executionTrend" binding:"required"` + LatencyTrend []response.MetricData `json:"latencyTrend" binding:"required"` + DiagnoseInfo []SqlDiagnoseInfo `json:"diagnoseInfo,omitempty"` + Plans []PlanStatistic `json:"plans" binding:"required"` + Indexies []IndexInfo `json:"indexies,omitempty"` +} diff --git a/internal/dashboard/model/sql/sql_metric.go b/internal/dashboard/model/sql/sql_metric.go new file mode 100644 index 000000000..1c88e0434 --- /dev/null +++ b/internal/dashboard/model/sql/sql_metric.go @@ -0,0 +1,33 @@ +/* +Copyright (c) 2023 OceanBase +ob-operator is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. +*/ + +package sql + +type MetricCategory string + +const ( + Meta MetricCategory = "meta" + Latency MetricCategory = "latency" + Execution MetricCategory = "execution" +) + +type SqlMetricMeta struct { + Name string `json:"name" binding:"required"` + Description string `json:"description" binding:"required"` + DisplayByDefault bool `json:"displayByDefault" binding:"required"` + Category MetricCategory `json:"category" binding:"required"` +} + +type SqlMetricMetaCategory struct { + Category MetricCategory `json:"category" binding:"required"` + Metrics []SqlMetricMeta `json:"metrics" binding:"required"` +} diff --git a/internal/dashboard/model/sql/sql_param.go b/internal/dashboard/model/sql/sql_param.go new file mode 100644 index 000000000..e3d74625d --- /dev/null +++ b/internal/dashboard/model/sql/sql_param.go @@ -0,0 +1,45 @@ +/* +Copyright (c) 2023 OceanBase +ob-operator is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. +*/ + +package sql + +type BaseSqlRequestParam struct { + Namespace string `json:"namespace" binding:"required"` + OBClusterCR string `json:"obcluster" binding:"required"` + OBTenantCR string `json:"obtenant,omitempty"` + OBUser string `json:"user,omitempty"` + OBDatabase string `json:"database,omitempty"` + StartTime int64 `json:"startTime,omitempty"` + EndTime int64 `json:"endTime,omitempty"` +} + +type SqlFilter struct { + BaseSqlRequestParam `json:",inline"` + Keyword string `json:"keyword,omitempty"` + IncludeInnerSql bool `json:"includeInnerSql,omitempty"` +} + +type SqlRequestStatisticParam struct { + BaseSqlRequestParam `json:",inline"` + StatisticScopes []string `json:"statisticScopes" binding:"required"` +} + +type SqlDetailParam struct { + BaseSqlRequestParam `json:",inline"` + Interval int `json:"interval" binding:"required"` + SqlId string `json:"sqlId" binding:"required"` +} + +type PlanDetailParam struct { + BaseSqlRequestParam `json:",inline"` + PlanHash string `json:"planHash" binding:"required"` +} diff --git a/internal/dashboard/router/router.go b/internal/dashboard/router/router.go index caf1cebe5..51931a35a 100644 --- a/internal/dashboard/router/router.go +++ b/internal/dashboard/router/router.go @@ -84,4 +84,5 @@ func InitRoutes(router *gin.Engine) { v1.InitAlarmRoutes(v1Group) v1.InitOBProxyRoutes(v1Group) v1.InitAccessControlRoutes(v1Group) + v1.InitSqlRoutes(v1Group) } diff --git a/internal/dashboard/router/v1/obtenant_router.go b/internal/dashboard/router/v1/obtenant_router.go index c4d6f86c5..3adc61b4b 100644 --- a/internal/dashboard/router/v1/obtenant_router.go +++ b/internal/dashboard/router/v1/obtenant_router.go @@ -32,6 +32,8 @@ func InitOBTenantRoutes(g *gin.RouterGroup) { g.POST("/obtenants/:namespace/:name/logreplay", h.Wrap(h.ReplayStandbyLog, oceanbase.TenantGuard(":namespace", ":name", "write"))) g.POST("/obtenants/:namespace/:name/version", h.Wrap(h.UpgradeTenantVersion, oceanbase.TenantGuard(":namespace", ":name", "write"))) g.POST("/obtenants/:namespace/:name/role", h.Wrap(h.ChangeTenantRole, oceanbase.TenantGuard(":namespace", ":name", "write"))) + g.GET("/obtenants/:namespace/:name/users", h.Wrap(h.ListOBTenantUsers, oceanbase.TenantGuard(":namespace", ":name", "read"))) + g.GET("/obtenants/:namespace/:name/databases", h.Wrap(h.ListOBTenantDatabases, oceanbase.TenantGuard(":namespace", ":name", "read"))) g.GET("/obtenants/:namespace/:name/backupPolicy", h.Wrap(h.GetBackupPolicy, oceanbase.TenantGuard(":namespace", ":name", "read"))) g.PUT("/obtenants/:namespace/:name/backupPolicy", h.Wrap(h.CreateBackupPolicy, oceanbase.TenantGuard(":namespace", ":name", "write"))) g.PATCH("/obtenants/:namespace/:name/backupPolicy", h.Wrap(h.UpdateBackupPolicy, oceanbase.TenantGuard(":namespace", ":name", "write"))) diff --git a/internal/dashboard/router/v1/sql_router.go b/internal/dashboard/router/v1/sql_router.go new file mode 100644 index 000000000..beefa8132 --- /dev/null +++ b/internal/dashboard/router/v1/sql_router.go @@ -0,0 +1,29 @@ +/* +Copyright (c) 2023 OceanBase +ob-operator is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. +*/ + +package v1 + +import ( + "github.com/gin-gonic/gin" + + acbiz "github.com/oceanbase/ob-operator/internal/dashboard/business/ac" + h "github.com/oceanbase/ob-operator/internal/dashboard/handler" +) + +func InitSqlRoutes(g *gin.RouterGroup) { + g.GET("/sql/metrics", h.Wrap(h.ListSqlMetrics, acbiz.PathGuard("obcluster", "*", "read"))) + g.POST("/sql/topSqls", h.Wrap(h.ListTopSqls, acbiz.PathGuard("obcluster", "*", "read"))) + g.POST("/sql/suspiciousSqls", h.Wrap(h.ListSuspiciousSqls, acbiz.PathGuard("obcluster", "*", "read"))) + g.POST("/sql/requestStatistics", h.Wrap(h.RequestStatistics, acbiz.PathGuard("obcluster", "*", "read"))) + g.POST("/sql/querySqlDetailInfo", h.Wrap(h.QuerySqlDetailInfo, acbiz.PathGuard("obcluster", "*", "read"))) + g.POST("/sql/queryPlanDetailInfo", h.Wrap(h.QueryPlanDetailInfo, acbiz.PathGuard("obcluster", "*", "read"))) +} diff --git a/make/dashboard.mk b/make/dashboard.mk index a68043219..b8589a7d7 100644 --- a/make/dashboard.mk +++ b/make/dashboard.mk @@ -22,7 +22,7 @@ GOTEST_PACKAGES = $(shell go list ./... | grep -v -f tests/excludes.txt) UNFMT_FILES ?= $(shell gofmt -l -s $(filter-out , $(GOFILES))) .PHONY: dashboard-doc-gen -dashboard-doc: dashboard-dep-install ## Generate swagger docs +dashboard-doc-gen: dashboard-dep-install ## Generate swagger docs swag init -g cmd/dashboard/main.go -o internal/dashboard/generated/swagger .PHONY: dashboard-build