From 7ca66d4a6acc522a0abf5c730d3ff6f6e6cf7077 Mon Sep 17 00:00:00 2001
From: panjiayao <44628544+Counterflowwind@users.noreply.github.com>
Date: Wed, 28 Jul 2021 23:03:40 +0800
Subject: [PATCH] move monitor and change details to proto (#1196)
* move alert to core/monitor and change details-apis to proto
* solve conflict in main.go
* solve conflict in main.go
* modify monitor.yaml
* modify monitor.yaml
* modify import in monitor/main.go
---
cmd/monitor/monitor/main.go | 5 +-
cmd/monitor/streaming/main.go | 2 +-
conf/monitor/monitor/monitor.yaml | 5 +-
go.mod | 4 +-
go.sum | 12 ++-
.../monitor/alert/alert-apis/adapt/adapt.go | 4 +-
.../monitor/alert/alert-apis/adapt/alert.go | 2 +-
.../alert/alert-apis/adapt/alert_convert.go | 2 +-
.../alert-apis/adapt/alert_convert_test.go | 2 +-
.../alert/alert-apis/adapt/alert_route.go | 0
.../alert/alert-apis/adapt/alert_test.go | 4 +-
.../alert/alert-apis/adapt/customize.go | 2 +-
.../alert-apis/adapt/customize_convert.go | 2 +-
.../alert/alert-apis/adapt/dashboard.go | 0
.../alert/alert-apis/adapt/expression.go | 0
.../alert/alert-apis/adapt/expression_test.go | 0
.../monitor/alert/alert-apis/adapt/record.go | 0
.../alert/alert-apis/adapt/record_convert.go | 4 +-
.../monitor/alert/alert-apis/alert.service.go | 2 +-
.../alert/alert-apis/cql/alert_history.go | 0
.../monitor/alert/alert-apis/cql/cql.go | 0
.../monitor/alert/alert-apis/cql/models.go | 0
.../monitor/alert/alert-apis/db/alert.go | 0
.../alert/alert-apis/db/alert_expression.go | 0
.../alert/alert-apis/db/alert_notify.go | 0
.../alert-apis/db/alert_notify_template.go | 0
.../alert/alert-apis/db/alert_record.go | 0
.../monitor/alert/alert-apis/db/alert_rule.go | 0
.../alert/alert-apis/db/customize_alert.go | 0
.../db/customize_alert_notify_template.go | 0
.../alert-apis/db/customize_alert_rule.go | 0
.../monitor/alert/alert-apis/db/db.go | 0
.../monitor/alert/alert-apis/db/tables.go | 0
.../monitor/alert/alert-apis/interfaces.go | 2 +-
.../monitor/alert/alert-apis/provider.go | 6 +-
.../monitor/alert/alert-apis/test.http | 0
.../alert/details-apis/alertdetail.service.go | 50 +++++++++++
.../monitor/alert/details-apis/kubernetes.go | 0
.../monitor/alert/details-apis/permission.go | 39 ++++++++
.../monitor/alert/details-apis/provider.go | 88 +++++++++++++++++++
.../monitor/alert/details-apis/routes.go | 19 ----
.../monitor/alert/details-apis/test.http | 0
.../alert/storage/alert-record/consumer.go | 4 +-
.../alert/storage/alert-record/provider.go | 0
.../monitor/alert/details-apis/provider.go | 56 ------------
modules/msp/apm/alert/alert.service.go | 2 +-
46 files changed, 213 insertions(+), 105 deletions(-)
rename modules/{ => core}/monitor/alert/alert-apis/adapt/adapt.go (95%)
rename modules/{ => core}/monitor/alert/alert-apis/adapt/alert.go (99%)
rename modules/{ => core}/monitor/alert/alert-apis/adapt/alert_convert.go (99%)
rename modules/{ => core}/monitor/alert/alert-apis/adapt/alert_convert_test.go (98%)
rename modules/{ => core}/monitor/alert/alert-apis/adapt/alert_route.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/adapt/alert_test.go (96%)
rename modules/{ => core}/monitor/alert/alert-apis/adapt/customize.go (99%)
rename modules/{ => core}/monitor/alert/alert-apis/adapt/customize_convert.go (99%)
rename modules/{ => core}/monitor/alert/alert-apis/adapt/dashboard.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/adapt/expression.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/adapt/expression_test.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/adapt/record.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/adapt/record_convert.go (95%)
rename modules/{ => core}/monitor/alert/alert-apis/alert.service.go (99%)
rename modules/{ => core}/monitor/alert/alert-apis/cql/alert_history.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/cql/cql.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/cql/models.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/db/alert.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/db/alert_expression.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/db/alert_notify.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/db/alert_notify_template.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/db/alert_record.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/db/alert_rule.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/db/customize_alert.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/db/customize_alert_notify_template.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/db/customize_alert_rule.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/db/db.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/db/tables.go (100%)
rename modules/{ => core}/monitor/alert/alert-apis/interfaces.go (99%)
rename modules/{ => core}/monitor/alert/alert-apis/provider.go (97%)
rename modules/{ => core}/monitor/alert/alert-apis/test.http (100%)
create mode 100644 modules/core/monitor/alert/details-apis/alertdetail.service.go
rename modules/{ => core}/monitor/alert/details-apis/kubernetes.go (100%)
rename modules/{ => core}/monitor/alert/details-apis/permission.go (58%)
create mode 100644 modules/core/monitor/alert/details-apis/provider.go
rename modules/{ => core}/monitor/alert/details-apis/routes.go (71%)
rename modules/{ => core}/monitor/alert/details-apis/test.http (100%)
rename modules/{ => core}/monitor/alert/storage/alert-record/consumer.go (91%)
rename modules/{ => core}/monitor/alert/storage/alert-record/provider.go (100%)
delete mode 100644 modules/monitor/alert/details-apis/provider.go
diff --git a/cmd/monitor/monitor/main.go b/cmd/monitor/monitor/main.go
index bc859c7b5c4..c05449cd259 100644
--- a/cmd/monitor/monitor/main.go
+++ b/cmd/monitor/monitor/main.go
@@ -19,6 +19,9 @@ import (
"github.com/erda-project/erda/modules/extensions/loghub"
"github.com/erda-project/erda/pkg/common"
+ _ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis"
+ _ "github.com/erda-project/erda/modules/core/monitor/alert/details-apis"
+
// modules
_ "github.com/erda-project/erda/modules/core/monitor/log/query"
_ "github.com/erda-project/erda/modules/core/monitor/metric/index"
@@ -28,8 +31,6 @@ import (
_ "github.com/erda-project/erda/modules/core/monitor/settings"
_ "github.com/erda-project/erda/modules/extensions/loghub/index/query"
_ "github.com/erda-project/erda/modules/extensions/loghub/metrics/rules"
- _ "github.com/erda-project/erda/modules/monitor/alert/alert-apis"
- _ "github.com/erda-project/erda/modules/monitor/alert/details-apis"
_ "github.com/erda-project/erda/modules/monitor/apm/report"
_ "github.com/erda-project/erda/modules/monitor/apm/runtime"
_ "github.com/erda-project/erda/modules/monitor/apm/topology"
diff --git a/cmd/monitor/streaming/main.go b/cmd/monitor/streaming/main.go
index ff1af69b10e..228632a8dd1 100644
--- a/cmd/monitor/streaming/main.go
+++ b/cmd/monitor/streaming/main.go
@@ -19,9 +19,9 @@ import (
"github.com/erda-project/erda/pkg/common"
// modules
+ _ "github.com/erda-project/erda/modules/core/monitor/alert/storage/alert-record"
_ "github.com/erda-project/erda/modules/core/monitor/log/storage"
_ "github.com/erda-project/erda/modules/core/monitor/metric/storage"
- _ "github.com/erda-project/erda/modules/monitor/alert/storage/alert-record"
_ "github.com/erda-project/erda/modules/monitor/notify/storage/notify-record"
_ "github.com/erda-project/erda/modules/msp/apm/browser"
_ "github.com/erda-project/erda/modules/msp/apm/trace/storage"
diff --git a/conf/monitor/monitor/monitor.yaml b/conf/monitor/monitor/monitor.yaml
index f72c45e0806..ab7dc2090f3 100644
--- a/conf/monitor/monitor/monitor.yaml
+++ b/conf/monitor/monitor/monitor.yaml
@@ -59,6 +59,9 @@ erda.core.monitor.metric:
- "${CONFIG_PATH}/metricmeta/groups/org.yml"
- "${CONFIG_PATH}/metricmeta/groups/micro_service.yml"
metric_meta_path: "${CONFIG_PATH}/metricmeta/metrics"
+
+erda.core.monitor.alertdetail:
+
metric-query-example:
_enable: ${METRIC_QUERY_EXAMPLE_ENABLE:false}
metrics-query-compatibility:
@@ -91,7 +94,6 @@ apm-topology:
class: ${CASSANDRA_KEYSPACE_REPLICATION_CLASS:SimpleStrategy}
factor: ${CASSANDRA_KEYSPACE_REPLICATION_FACTOR:2}
apm-report:
-#apm-alert:
erda.core.monitor.alert:
# micro_service_filter_tags: "${MICRO_SERVICE_FILTER_TAGS:metric_name,_metric_name,metric_scope,_metric_scope,metric_scope_id,_metric_scope_id,cluster_name,host_ip,org_id,org_name,project_id,project_name,application_id,application_name,runtime_id,runtime_name,service_id,service_name,component_name,addon_name,workspace,cpu_request,cpu_limit,cpu_origin,mem_request,mem_limit,mem_origin,job_id,addon_id,instance_id,instance_type,edas_app_id,edas_app_name,edas_group_id,pod_name,pod_namespace,pod_ip,terminus_key}"
@@ -105,7 +107,6 @@ erda.core.monitor.alert:
keyspace:
name: "spot_prod"
gc_grace_seconds: 86400
-alert-details-apis:
report-apis:
pipeline:
diff --git a/go.mod b/go.mod
index 50cd3e01231..f67abbc3227 100644
--- a/go.mod
+++ b/go.mod
@@ -30,8 +30,8 @@ require (
github.com/dsnet/compress v0.0.1 // indirect
github.com/elastic/cloud-on-k8s v0.0.0-20210205172912-5ce0eca90c60
github.com/elazarl/goproxy v0.0.0-20200421181703-e76ad31c14f6
- github.com/erda-project/erda-infra v0.0.0-20210727055933-be7518b10590
- github.com/erda-project/erda-proto-go v0.0.0-20210727101457-c8e2cf5f8687
+ github.com/erda-project/erda-infra v0.0.0-20210725152943-8d1044e4fc39
+ github.com/erda-project/erda-proto-go v0.0.0-20210728101536-42e74f28ce7c
github.com/extrame/ole2 v0.0.0-20160812065207-d69429661ad7 // indirect
github.com/extrame/xls v0.0.1
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
diff --git a/go.sum b/go.sum
index 77c4d30cf73..f6a2471ded4 100644
--- a/go.sum
+++ b/go.sum
@@ -432,10 +432,14 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/erda-project/elastic v0.0.1-ex h1:5ajfxQ5S5YjpzFqY9LzL9hiKWCn6q/JDT4n8sNv7+pU=
github.com/erda-project/elastic v0.0.1-ex/go.mod h1:iAVsas6fcmt9pxtge1+dErMhecv+RLSXlD4rnZRJVW0=
github.com/erda-project/erda-infra v0.0.0-20210706133120-0a742437972c/go.mod h1:TUQYSZ60w9dk7m0q3U3AVg7U74APj/sdEVvRWR3wYv8=
-github.com/erda-project/erda-infra v0.0.0-20210727055933-be7518b10590 h1:OPDlqUAh1A+nOLzMqa84XmjPA47ysTf1sYVLXlZv5Vg=
-github.com/erda-project/erda-infra v0.0.0-20210727055933-be7518b10590/go.mod h1:L+fFQghY2po2P3H9pzwEOufDLAhL+mRRhPGdZ7vFnAw=
-github.com/erda-project/erda-proto-go v0.0.0-20210727101457-c8e2cf5f8687 h1:GdzfpwdNSEdvoPx2MbK4wRwUC66Ce8UdyhB2nNkDyug=
-github.com/erda-project/erda-proto-go v0.0.0-20210727101457-c8e2cf5f8687/go.mod h1:rSETXX3nKxxIhgrVn7fKDM3mla1nNlWcPz4AkepixaU=
+github.com/erda-project/erda-infra v0.0.0-20210725152943-8d1044e4fc39 h1:P03+DWh0qorAc9WUMsjj4P6Gq+jVDyhFUupCfyI3488=
+github.com/erda-project/erda-infra v0.0.0-20210725152943-8d1044e4fc39/go.mod h1:L+fFQghY2po2P3H9pzwEOufDLAhL+mRRhPGdZ7vFnAw=
+github.com/erda-project/erda-proto-go v0.0.0-20210726090325-2a861ab665ec h1:ge68Kqj5izVExtFznErr/+hqZuGPblEDBO+aDiCpIxA=
+github.com/erda-project/erda-proto-go v0.0.0-20210726090325-2a861ab665ec/go.mod h1:rSETXX3nKxxIhgrVn7fKDM3mla1nNlWcPz4AkepixaU=
+github.com/erda-project/erda-proto-go v0.0.0-20210727031539-cace26f0e407 h1:zr4cUAOHfEOZXX9gVI74HdEkC0PIuTCOfSlH2sxYQpA=
+github.com/erda-project/erda-proto-go v0.0.0-20210727031539-cace26f0e407/go.mod h1:rSETXX3nKxxIhgrVn7fKDM3mla1nNlWcPz4AkepixaU=
+github.com/erda-project/erda-proto-go v0.0.0-20210728101536-42e74f28ce7c h1:2pTXn1Lp7Td/qokddLOcj++45nFBPUZDUiWDahr0aOs=
+github.com/erda-project/erda-proto-go v0.0.0-20210728101536-42e74f28ce7c/go.mod h1:rSETXX3nKxxIhgrVn7fKDM3mla1nNlWcPz4AkepixaU=
github.com/erda-project/influxql v1.1.0-ex h1:NgP5+S5Qo234IVSIJ3N/egvzCNYJURfMAett3e8a9LE=
github.com/erda-project/influxql v1.1.0-ex/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk=
github.com/erda-project/remotedialer v0.2.6-0.20210713103000-da03eb9e4b23 h1:NaKo6voQVqZM6DMBVhcTT4gjd+lr1C3zE17RROspfg0=
diff --git a/modules/monitor/alert/alert-apis/adapt/adapt.go b/modules/core/monitor/alert/alert-apis/adapt/adapt.go
similarity index 95%
rename from modules/monitor/alert/alert-apis/adapt/adapt.go
rename to modules/core/monitor/alert/alert-apis/adapt/adapt.go
index fb3d24c7d18..407d14614d9 100644
--- a/modules/monitor/alert/alert-apis/adapt/adapt.go
+++ b/modules/core/monitor/alert/alert-apis/adapt/adapt.go
@@ -19,9 +19,9 @@ import (
"github.com/erda-project/erda-infra/base/logs"
"github.com/erda-project/erda-infra/providers/i18n"
"github.com/erda-project/erda/bundle"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/cql"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/db"
"github.com/erda-project/erda/modules/core/monitor/metric/query/metricq"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/cql"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/db"
block "github.com/erda-project/erda/modules/monitor/dashboard/chart-block"
"github.com/erda-project/erda/modules/pkg/bundle-ex/cmdb"
)
diff --git a/modules/monitor/alert/alert-apis/adapt/alert.go b/modules/core/monitor/alert/alert-apis/adapt/alert.go
similarity index 99%
rename from modules/monitor/alert/alert-apis/adapt/alert.go
rename to modules/core/monitor/alert/alert-apis/adapt/alert.go
index 355450d35ce..3d1c62473ea 100644
--- a/modules/monitor/alert/alert-apis/adapt/alert.go
+++ b/modules/core/monitor/alert/alert-apis/adapt/alert.go
@@ -25,7 +25,7 @@ import (
"github.com/erda-project/erda-infra/providers/i18n"
"github.com/erda-project/erda-proto-go/core/monitor/alert/pb"
"github.com/erda-project/erda/apistructs"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/db"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/db"
"github.com/erda-project/erda/modules/monitor/utils"
)
diff --git a/modules/monitor/alert/alert-apis/adapt/alert_convert.go b/modules/core/monitor/alert/alert-apis/adapt/alert_convert.go
similarity index 99%
rename from modules/monitor/alert/alert-apis/adapt/alert_convert.go
rename to modules/core/monitor/alert/alert-apis/adapt/alert_convert.go
index db358e1d2a1..a7859c18d6b 100644
--- a/modules/monitor/alert/alert-apis/adapt/alert_convert.go
+++ b/modules/core/monitor/alert/alert-apis/adapt/alert_convert.go
@@ -24,7 +24,7 @@ import (
"github.com/erda-project/erda-infra/providers/i18n"
"github.com/erda-project/erda-proto-go/core/monitor/alert/pb"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/db"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/db"
"github.com/erda-project/erda/modules/monitor/utils"
"github.com/erda-project/erda/pkg/encoding/jsonmap"
)
diff --git a/modules/monitor/alert/alert-apis/adapt/alert_convert_test.go b/modules/core/monitor/alert/alert-apis/adapt/alert_convert_test.go
similarity index 98%
rename from modules/monitor/alert/alert-apis/adapt/alert_convert_test.go
rename to modules/core/monitor/alert/alert-apis/adapt/alert_convert_test.go
index 5a5883d1a12..b67b08bf72e 100644
--- a/modules/monitor/alert/alert-apis/adapt/alert_convert_test.go
+++ b/modules/core/monitor/alert/alert-apis/adapt/alert_convert_test.go
@@ -19,7 +19,7 @@ import (
"github.com/erda-project/erda-infra/providers/i18n"
"github.com/erda-project/erda/apistructs"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/db"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/db"
"github.com/erda-project/erda/pkg/encoding/jsonmap"
)
diff --git a/modules/monitor/alert/alert-apis/adapt/alert_route.go b/modules/core/monitor/alert/alert-apis/adapt/alert_route.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/adapt/alert_route.go
rename to modules/core/monitor/alert/alert-apis/adapt/alert_route.go
diff --git a/modules/monitor/alert/alert-apis/adapt/alert_test.go b/modules/core/monitor/alert/alert-apis/adapt/alert_test.go
similarity index 96%
rename from modules/monitor/alert/alert-apis/adapt/alert_test.go
rename to modules/core/monitor/alert/alert-apis/adapt/alert_test.go
index 46d73a4a5b8..1810f60ba20 100644
--- a/modules/monitor/alert/alert-apis/adapt/alert_test.go
+++ b/modules/core/monitor/alert/alert-apis/adapt/alert_test.go
@@ -21,8 +21,8 @@ import (
"github.com/erda-project/erda-infra/providers/i18n"
"github.com/erda-project/erda-proto-go/core/monitor/alert/pb"
"github.com/erda-project/erda/bundle"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/cql"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/db"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/cql"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/db"
"github.com/erda-project/erda/modules/pkg/bundle-ex/cmdb"
"github.com/erda-project/erda/pkg/encoding/jsonmap"
)
diff --git a/modules/monitor/alert/alert-apis/adapt/customize.go b/modules/core/monitor/alert/alert-apis/adapt/customize.go
similarity index 99%
rename from modules/monitor/alert/alert-apis/adapt/customize.go
rename to modules/core/monitor/alert/alert-apis/adapt/customize.go
index 5d2f43b9b81..f224540fcaf 100644
--- a/modules/monitor/alert/alert-apis/adapt/customize.go
+++ b/modules/core/monitor/alert/alert-apis/adapt/customize.go
@@ -25,7 +25,7 @@ import (
"github.com/erda-project/erda-infra/providers/i18n"
"github.com/erda-project/erda-proto-go/core/monitor/alert/pb"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/db"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/db"
"github.com/erda-project/erda/modules/monitor/utils"
"github.com/erda-project/erda/pkg/encoding/jsonmap"
)
diff --git a/modules/monitor/alert/alert-apis/adapt/customize_convert.go b/modules/core/monitor/alert/alert-apis/adapt/customize_convert.go
similarity index 99%
rename from modules/monitor/alert/alert-apis/adapt/customize_convert.go
rename to modules/core/monitor/alert/alert-apis/adapt/customize_convert.go
index 102b2a082b5..0b78ab6042a 100644
--- a/modules/monitor/alert/alert-apis/adapt/customize_convert.go
+++ b/modules/core/monitor/alert/alert-apis/adapt/customize_convert.go
@@ -23,7 +23,7 @@ import (
"github.com/erda-project/erda-infra/providers/i18n"
"github.com/erda-project/erda-proto-go/core/monitor/alert/pb"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/db"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/db"
"github.com/erda-project/erda/modules/monitor/utils"
)
diff --git a/modules/monitor/alert/alert-apis/adapt/dashboard.go b/modules/core/monitor/alert/alert-apis/adapt/dashboard.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/adapt/dashboard.go
rename to modules/core/monitor/alert/alert-apis/adapt/dashboard.go
diff --git a/modules/monitor/alert/alert-apis/adapt/expression.go b/modules/core/monitor/alert/alert-apis/adapt/expression.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/adapt/expression.go
rename to modules/core/monitor/alert/alert-apis/adapt/expression.go
diff --git a/modules/monitor/alert/alert-apis/adapt/expression_test.go b/modules/core/monitor/alert/alert-apis/adapt/expression_test.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/adapt/expression_test.go
rename to modules/core/monitor/alert/alert-apis/adapt/expression_test.go
diff --git a/modules/monitor/alert/alert-apis/adapt/record.go b/modules/core/monitor/alert/alert-apis/adapt/record.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/adapt/record.go
rename to modules/core/monitor/alert/alert-apis/adapt/record.go
diff --git a/modules/monitor/alert/alert-apis/adapt/record_convert.go b/modules/core/monitor/alert/alert-apis/adapt/record_convert.go
similarity index 95%
rename from modules/monitor/alert/alert-apis/adapt/record_convert.go
rename to modules/core/monitor/alert/alert-apis/adapt/record_convert.go
index 94e88ba66bf..2d8b5006e0f 100644
--- a/modules/monitor/alert/alert-apis/adapt/record_convert.go
+++ b/modules/core/monitor/alert/alert-apis/adapt/record_convert.go
@@ -17,8 +17,8 @@ import (
"time"
"github.com/erda-project/erda-proto-go/core/monitor/alert/pb"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/cql"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/db"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/cql"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/db"
"github.com/erda-project/erda/modules/monitor/utils"
)
diff --git a/modules/monitor/alert/alert-apis/alert.service.go b/modules/core/monitor/alert/alert-apis/alert.service.go
similarity index 99%
rename from modules/monitor/alert/alert-apis/alert.service.go
rename to modules/core/monitor/alert/alert-apis/alert.service.go
index 05fb8715fbd..8830dd6c56e 100644
--- a/modules/monitor/alert/alert-apis/alert.service.go
+++ b/modules/core/monitor/alert/alert-apis/alert.service.go
@@ -28,7 +28,7 @@ import (
"github.com/erda-project/erda-proto-go/core/monitor/alert/pb"
metricpb "github.com/erda-project/erda-proto-go/core/monitor/metric/pb"
"github.com/erda-project/erda/apistructs"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/adapt"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/adapt"
"github.com/erda-project/erda/modules/monitor/utils"
"github.com/erda-project/erda/pkg/common/apis"
"github.com/erda-project/erda/pkg/common/errors"
diff --git a/modules/monitor/alert/alert-apis/cql/alert_history.go b/modules/core/monitor/alert/alert-apis/cql/alert_history.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/cql/alert_history.go
rename to modules/core/monitor/alert/alert-apis/cql/alert_history.go
diff --git a/modules/monitor/alert/alert-apis/cql/cql.go b/modules/core/monitor/alert/alert-apis/cql/cql.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/cql/cql.go
rename to modules/core/monitor/alert/alert-apis/cql/cql.go
diff --git a/modules/monitor/alert/alert-apis/cql/models.go b/modules/core/monitor/alert/alert-apis/cql/models.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/cql/models.go
rename to modules/core/monitor/alert/alert-apis/cql/models.go
diff --git a/modules/monitor/alert/alert-apis/db/alert.go b/modules/core/monitor/alert/alert-apis/db/alert.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/db/alert.go
rename to modules/core/monitor/alert/alert-apis/db/alert.go
diff --git a/modules/monitor/alert/alert-apis/db/alert_expression.go b/modules/core/monitor/alert/alert-apis/db/alert_expression.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/db/alert_expression.go
rename to modules/core/monitor/alert/alert-apis/db/alert_expression.go
diff --git a/modules/monitor/alert/alert-apis/db/alert_notify.go b/modules/core/monitor/alert/alert-apis/db/alert_notify.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/db/alert_notify.go
rename to modules/core/monitor/alert/alert-apis/db/alert_notify.go
diff --git a/modules/monitor/alert/alert-apis/db/alert_notify_template.go b/modules/core/monitor/alert/alert-apis/db/alert_notify_template.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/db/alert_notify_template.go
rename to modules/core/monitor/alert/alert-apis/db/alert_notify_template.go
diff --git a/modules/monitor/alert/alert-apis/db/alert_record.go b/modules/core/monitor/alert/alert-apis/db/alert_record.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/db/alert_record.go
rename to modules/core/monitor/alert/alert-apis/db/alert_record.go
diff --git a/modules/monitor/alert/alert-apis/db/alert_rule.go b/modules/core/monitor/alert/alert-apis/db/alert_rule.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/db/alert_rule.go
rename to modules/core/monitor/alert/alert-apis/db/alert_rule.go
diff --git a/modules/monitor/alert/alert-apis/db/customize_alert.go b/modules/core/monitor/alert/alert-apis/db/customize_alert.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/db/customize_alert.go
rename to modules/core/monitor/alert/alert-apis/db/customize_alert.go
diff --git a/modules/monitor/alert/alert-apis/db/customize_alert_notify_template.go b/modules/core/monitor/alert/alert-apis/db/customize_alert_notify_template.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/db/customize_alert_notify_template.go
rename to modules/core/monitor/alert/alert-apis/db/customize_alert_notify_template.go
diff --git a/modules/monitor/alert/alert-apis/db/customize_alert_rule.go b/modules/core/monitor/alert/alert-apis/db/customize_alert_rule.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/db/customize_alert_rule.go
rename to modules/core/monitor/alert/alert-apis/db/customize_alert_rule.go
diff --git a/modules/monitor/alert/alert-apis/db/db.go b/modules/core/monitor/alert/alert-apis/db/db.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/db/db.go
rename to modules/core/monitor/alert/alert-apis/db/db.go
diff --git a/modules/monitor/alert/alert-apis/db/tables.go b/modules/core/monitor/alert/alert-apis/db/tables.go
similarity index 100%
rename from modules/monitor/alert/alert-apis/db/tables.go
rename to modules/core/monitor/alert/alert-apis/db/tables.go
diff --git a/modules/monitor/alert/alert-apis/interfaces.go b/modules/core/monitor/alert/alert-apis/interfaces.go
similarity index 99%
rename from modules/monitor/alert/alert-apis/interfaces.go
rename to modules/core/monitor/alert/alert-apis/interfaces.go
index bb0bbde7626..eacfc195873 100644
--- a/modules/monitor/alert/alert-apis/interfaces.go
+++ b/modules/core/monitor/alert/alert-apis/interfaces.go
@@ -20,7 +20,7 @@ import (
"github.com/erda-project/erda-infra/providers/i18n"
"github.com/erda-project/erda-proto-go/core/monitor/alert/pb"
"github.com/erda-project/erda/apistructs"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/adapt"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/adapt"
block "github.com/erda-project/erda/modules/monitor/dashboard/chart-block"
api "github.com/erda-project/erda/pkg/common/httpapi"
)
diff --git a/modules/monitor/alert/alert-apis/provider.go b/modules/core/monitor/alert/alert-apis/provider.go
similarity index 97%
rename from modules/monitor/alert/alert-apis/provider.go
rename to modules/core/monitor/alert/alert-apis/provider.go
index a498bf3dfec..61e3890e180 100644
--- a/modules/monitor/alert/alert-apis/provider.go
+++ b/modules/core/monitor/alert/alert-apis/provider.go
@@ -26,10 +26,10 @@ import (
"github.com/erda-project/erda-infra/providers/mysql"
"github.com/erda-project/erda-proto-go/core/monitor/alert/pb"
"github.com/erda-project/erda/bundle"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/adapt"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/cql"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/db"
"github.com/erda-project/erda/modules/core/monitor/metric/query/metricq"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/adapt"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/cql"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/db"
block "github.com/erda-project/erda/modules/monitor/dashboard/chart-block"
"github.com/erda-project/erda/modules/pkg/bundle-ex/cmdb"
"github.com/erda-project/erda/pkg/common/apis"
diff --git a/modules/monitor/alert/alert-apis/test.http b/modules/core/monitor/alert/alert-apis/test.http
similarity index 100%
rename from modules/monitor/alert/alert-apis/test.http
rename to modules/core/monitor/alert/alert-apis/test.http
diff --git a/modules/core/monitor/alert/details-apis/alertdetail.service.go b/modules/core/monitor/alert/details-apis/alertdetail.service.go
new file mode 100644
index 00000000000..06833623d97
--- /dev/null
+++ b/modules/core/monitor/alert/details-apis/alertdetail.service.go
@@ -0,0 +1,50 @@
+// Copyright (c) 2021 Terminus, Inc.
+//
+// This program is free software: you can use, redistribute, and/or modify
+// it under the terms of the GNU Affero General Public License, version 3
+// or later ("AGPL"), as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+package details_apis
+
+import (
+ "context"
+ "encoding/json"
+
+ "github.com/erda-project/erda-proto-go/core/monitor/alertdetail/pb"
+ "github.com/erda-project/erda/pkg/common/errors"
+)
+
+type alertDetailService struct {
+ p *provider
+}
+
+func (a *alertDetailService) QuerySystemPodMetrics(ctx context.Context, request *pb.QuerySystemPodMetricsRequest) (*pb.QuerySystemPodMetricsResponse, error) {
+ start := request.Timestamp - 30*60*1000
+ end := request.Timestamp + 30*60*1000
+ pod, err := a.p.getPodInfo(request.ClusterName, request.Name, start, end)
+ if err != nil {
+ return nil, errors.NewInternalServerError(err)
+ }
+ data, err := json.Marshal(pod)
+ if err != nil {
+ return nil, errors.NewInternalServerError(err)
+ }
+ result := &pb.QuerySystemPodMetricsResponse{
+ Data: &pb.PodInfo{
+ Summary: nil,
+ Instances: make([]*pb.PodInfoInstanse, 0),
+ },
+ }
+ err = json.Unmarshal(data, result.Data)
+ if err != nil {
+ return nil, errors.NewInternalServerError(err)
+ }
+ return result, nil
+}
diff --git a/modules/monitor/alert/details-apis/kubernetes.go b/modules/core/monitor/alert/details-apis/kubernetes.go
similarity index 100%
rename from modules/monitor/alert/details-apis/kubernetes.go
rename to modules/core/monitor/alert/details-apis/kubernetes.go
diff --git a/modules/monitor/alert/details-apis/permission.go b/modules/core/monitor/alert/details-apis/permission.go
similarity index 58%
rename from modules/monitor/alert/details-apis/permission.go
rename to modules/core/monitor/alert/details-apis/permission.go
index f74574995cf..2e8ec761f80 100644
--- a/modules/monitor/alert/details-apis/permission.go
+++ b/modules/core/monitor/alert/details-apis/permission.go
@@ -14,11 +14,14 @@
package details_apis
import (
+ "context"
"fmt"
"strconv"
+ "github.com/erda-project/erda-infra/pkg/transport/http"
"github.com/erda-project/erda-infra/providers/httpserver"
api "github.com/erda-project/erda/pkg/common/httpapi"
+ "github.com/erda-project/erda/pkg/common/permission"
)
func (p *provider) getOrgIDByClusters(ctx httpserver.Context) (string, error) {
@@ -50,3 +53,39 @@ func (p *provider) getOrgIDByClusters(ctx httpserver.Context) (string, error) {
}
return idStr, nil
}
+
+func (p *provider) OrgIDByCluster(key string) permission.ValueGetter {
+ return func(ctx context.Context, req interface{}) (string, error) {
+ orgIdValue := permission.OrgIDValue()
+ orgIdStr, err := orgIdValue(ctx, req)
+ orgID, err := strconv.ParseUint(orgIdStr, 10, 64)
+ if err != nil {
+ return "", fmt.Errorf("Org-ID is not number")
+ }
+ request := http.ContextRequest(ctx)
+ cluster := request.URL.Query().Get(key)
+ if len(cluster) <= 0 {
+ return "", fmt.Errorf("cluster must not be empty")
+ }
+ err = p.checkOrgIDsByCluster(orgID, cluster)
+ if err != nil {
+ return "", err
+ }
+ return orgIdStr, nil
+ }
+}
+
+func (p *provider) checkOrgIDsByCluster(orgID uint64, clusterName string) error {
+ resp, err := p.cmdb.QueryAllOrgClusterRelation()
+ if err != nil {
+ return err
+ }
+ for _, item := range resp {
+ if item.ClusterName == clusterName {
+ if orgID == item.OrgID {
+ return nil
+ }
+ }
+ }
+ return fmt.Errorf("not found cluster '%s'", clusterName)
+}
diff --git a/modules/core/monitor/alert/details-apis/provider.go b/modules/core/monitor/alert/details-apis/provider.go
new file mode 100644
index 00000000000..063a40f9cdd
--- /dev/null
+++ b/modules/core/monitor/alert/details-apis/provider.go
@@ -0,0 +1,88 @@
+// Copyright (c) 2021 Terminus, Inc.
+//
+// This program is free software: you can use, redistribute, and/or modify
+// it under the terms of the GNU Affero General Public License, version 3
+// or later ("AGPL"), as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+package details_apis
+
+import (
+ "time"
+
+ "github.com/erda-project/erda-infra/base/logs"
+ "github.com/erda-project/erda-infra/base/servicehub"
+ "github.com/erda-project/erda-infra/pkg/transport"
+ "github.com/erda-project/erda-infra/providers/httpserver"
+ "github.com/erda-project/erda-infra/providers/httpserver/interceptors"
+ "github.com/erda-project/erda-proto-go/core/monitor/alertdetail/pb"
+ "github.com/erda-project/erda/modules/core/monitor/metric/query/metricq"
+ "github.com/erda-project/erda/modules/pkg/bundle-ex/cmdb"
+ "github.com/erda-project/erda/pkg/common/apis"
+ perm "github.com/erda-project/erda/pkg/common/permission"
+ "github.com/erda-project/erda/pkg/http/httpclient"
+)
+
+type config struct {
+}
+
+type provider struct {
+ L logs.Logger
+ metricq metricq.Queryer
+ //metricq metricpb.MetricServiceServer `autowired:"erda.core.monitor.metric.MetricService"`
+ cmdb *cmdb.Cmdb
+
+ Register transport.Register `autowired:"service-register"`
+ Perm perm.Interface `autowired:"permission"`
+ alertDetailService *alertDetailService
+}
+
+func (p *provider) Init(ctx servicehub.Context) error {
+ hc := httpclient.New(httpclient.WithTimeout(time.Second, time.Second*60))
+ p.cmdb = cmdb.New(cmdb.WithHTTPClient(hc))
+ p.metricq = ctx.Service("metrics-query").(metricq.Queryer)
+ p.alertDetailService = &alertDetailService{
+ p: p,
+ }
+
+ if p.Register != nil {
+ type AlertDetailService = pb.AlertDetailServiceServer
+ pb.RegisterAlertDetailServiceImp(p.Register, p.alertDetailService, apis.Options(), p.Perm.Check(
+ perm.Method(AlertDetailService.QuerySystemPodMetrics, perm.ScopeOrg, "monitor_org_center", perm.ActionGet, p.OrgIDByCluster("clusterName")),
+ ))
+ }
+ routes := ctx.Service("http-server",
+ //telemetry.HttpMetric(),
+ interceptors.Recover(p.L)).(httpserver.Router)
+ return p.intRoutes(routes)
+}
+
+func (p *provider) Provide(ctx servicehub.DependencyContext, args ...interface{}) interface{} {
+ switch {
+ case ctx.Service() == "erda.core.monitor.alertdetail" || ctx.Type() == pb.AlertDetailServiceServerType() || ctx.Type() == pb.AlertDetailServiceHandlerType():
+ return p.alertDetailService
+ }
+ return p
+}
+
+func init() {
+ servicehub.Register("erda.core.monitor.alertdetail", &servicehub.Spec{
+ Services: pb.ServiceNames(),
+ Types: pb.Types(),
+ Dependencies: []string{"metrics-query"},
+ OptionalDependencies: []string{"service-register"},
+ Description: "",
+ ConfigFunc: func() interface{} {
+ return &config{}
+ },
+ Creator: func() servicehub.Provider {
+ return &provider{}
+ },
+ })
+}
diff --git a/modules/monitor/alert/details-apis/routes.go b/modules/core/monitor/alert/details-apis/routes.go
similarity index 71%
rename from modules/monitor/alert/details-apis/routes.go
rename to modules/core/monitor/alert/details-apis/routes.go
index d3168fe5433..38267900edc 100644
--- a/modules/monitor/alert/details-apis/routes.go
+++ b/modules/core/monitor/alert/details-apis/routes.go
@@ -20,7 +20,6 @@ import (
"github.com/erda-project/erda/modules/core/monitor/metric/query/metricq"
"github.com/erda-project/erda/modules/monitor/common"
"github.com/erda-project/erda/modules/monitor/common/permission"
- api "github.com/erda-project/erda/pkg/common/httpapi"
)
func (p *provider) intRoutes(routes httpserver.Router) error {
@@ -35,10 +34,6 @@ func (p *provider) intRoutes(routes httpserver.Router) error {
))
// metrics for system
- routes.GET("/api/system/pod/status", p.getPodsInfo, permission.Intercepter(
- permission.ScopeOrg, permission.OrgIDByCluster("clusterName"),
- common.ResourceOrgCenter, permission.ActionGet,
- ))
routes.GET("/api/system/addon/metrics/:scope/:aggregate", p.systemAddonMetrics, permission.Intercepter(
permission.ScopeOrg, permission.OrgIDByCluster("filter_cluster_name"),
common.ResourceOrgCenter, permission.ActionGet,
@@ -46,20 +41,6 @@ func (p *provider) intRoutes(routes httpserver.Router) error {
return nil
}
-func (p *provider) getPodsInfo(params struct {
- Name string `query:"name" validate:"required"`
- ClusterName string `query:"clusterName" validate:"required"`
- Timestamp int64 `query:"timestamp" validate:"gt=1800000"`
-}) interface{} {
- start := params.Timestamp - 30*60*1000
- end := params.Timestamp + 30*60*1000
- pod, err := p.getPodInfo(params.ClusterName, params.Name, start, end)
- if err != nil {
- return api.Errors.Internal(err)
- }
- return api.Success(pod)
-}
-
func (p *provider) systemAddonMetrics(r *http.Request, params *struct {
metricq.QueryParams
AddonID string `query:"filter_addon_id" validate:"required"`
diff --git a/modules/monitor/alert/details-apis/test.http b/modules/core/monitor/alert/details-apis/test.http
similarity index 100%
rename from modules/monitor/alert/details-apis/test.http
rename to modules/core/monitor/alert/details-apis/test.http
diff --git a/modules/monitor/alert/storage/alert-record/consumer.go b/modules/core/monitor/alert/storage/alert-record/consumer.go
similarity index 91%
rename from modules/monitor/alert/storage/alert-record/consumer.go
rename to modules/core/monitor/alert/storage/alert-record/consumer.go
index a1b2e85b50a..a58aaced97c 100644
--- a/modules/monitor/alert/storage/alert-record/consumer.go
+++ b/modules/core/monitor/alert/storage/alert-record/consumer.go
@@ -17,8 +17,8 @@ import (
"encoding/json"
"time"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/adapt"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/db"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/adapt"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/db"
"github.com/jinzhu/gorm"
)
diff --git a/modules/monitor/alert/storage/alert-record/provider.go b/modules/core/monitor/alert/storage/alert-record/provider.go
similarity index 100%
rename from modules/monitor/alert/storage/alert-record/provider.go
rename to modules/core/monitor/alert/storage/alert-record/provider.go
diff --git a/modules/monitor/alert/details-apis/provider.go b/modules/monitor/alert/details-apis/provider.go
deleted file mode 100644
index c57b7f859b7..00000000000
--- a/modules/monitor/alert/details-apis/provider.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2021 Terminus, Inc.
-//
-// This program is free software: you can use, redistribute, and/or modify
-// it under the terms of the GNU Affero General Public License, version 3
-// or later ("AGPL"), as published by the Free Software Foundation.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-
-package details_apis
-
-import (
- "time"
-
- "github.com/erda-project/erda-infra/base/logs"
- "github.com/erda-project/erda-infra/base/servicehub"
- "github.com/erda-project/erda-infra/providers/httpserver"
- "github.com/erda-project/erda-infra/providers/httpserver/interceptors"
- "github.com/erda-project/erda/modules/core/monitor/metric/query/metricq"
- "github.com/erda-project/erda/modules/pkg/bundle-ex/cmdb"
- "github.com/erda-project/erda/pkg/http/httpclient"
-)
-
-type define struct{}
-
-type provider struct {
- L logs.Logger
- metricq metricq.Queryer
- cmdb *cmdb.Cmdb
-}
-
-func (d *define) Service() []string { return []string{"alert-details-apis"} }
-func (d *define) Dependencies() []string { return []string{"http-server", "metrics-query"} }
-func (d *define) Summary() string { return "details apis for alert" }
-func (d *define) Description() string { return d.Summary() }
-func (d *define) Creator() servicehub.Creator {
- return func() servicehub.Provider { return &provider{} }
-}
-
-func (p *provider) Init(ctx servicehub.Context) error {
- hc := httpclient.New(httpclient.WithTimeout(time.Second, time.Second*60))
- p.cmdb = cmdb.New(cmdb.WithHTTPClient(hc))
- p.metricq = ctx.Service("metrics-query").(metricq.Queryer)
- routes := ctx.Service("http-server",
- //telemetry.HttpMetric(),
- interceptors.Recover(p.L)).(httpserver.Router)
- return p.intRoutes(routes)
-}
-
-func init() {
- servicehub.RegisterProvider("alert-details-apis", &define{})
-}
diff --git a/modules/msp/apm/alert/alert.service.go b/modules/msp/apm/alert/alert.service.go
index 42a273d2dbb..8fd98fd430a 100644
--- a/modules/msp/apm/alert/alert.service.go
+++ b/modules/msp/apm/alert/alert.service.go
@@ -26,7 +26,7 @@ import (
monitor "github.com/erda-project/erda-proto-go/core/monitor/alert/pb"
alert "github.com/erda-project/erda-proto-go/msp/apm/alert/pb"
"github.com/erda-project/erda/apistructs"
- "github.com/erda-project/erda/modules/monitor/alert/alert-apis/adapt"
+ "github.com/erda-project/erda/modules/core/monitor/alert/alert-apis/adapt"
"github.com/erda-project/erda/modules/monitor/utils"
"github.com/erda-project/erda/pkg/common/apis"
"github.com/erda-project/erda/pkg/common/errors"