Skip to content

Commit df92a85

Browse files
committed
chore: remove unused code with MetricBase
1 parent b443823 commit df92a85

File tree

5 files changed

+0
-195
lines changed

5 files changed

+0
-195
lines changed

main.go

-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ func main() {
159159
orm.RegisterSchemaWithIndexName(api3.RemoteConfig{}, "configs")
160160
orm.RegisterSchemaWithIndexName(model.AuditLog{}, "audit-logs")
161161
orm.RegisterSchemaWithIndexName(host.HostInfo{}, "host")
162-
orm.RegisterSchemaWithIndexName(insight.MetricBase{}, "metric")
163162

164163
module.Start()
165164

model/insight/metric_data.go

-20
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
"fmt"
3232
"regexp"
3333

34-
"infini.sh/framework/core/orm"
3534
"infini.sh/framework/core/util"
3635
)
3736

@@ -80,25 +79,6 @@ type Metric struct {
8079
Unit string `json:"unit,omitempty"`
8180
}
8281

83-
type MetricBase struct {
84-
orm.ORMObjectBase
85-
//display name of the metric
86-
Name string `json:"name"`
87-
//metric identifier
88-
Key string `json:"key"`
89-
//optional values : "node", "indices", "shard"
90-
Level string `json:"level"`
91-
//metric calculation formula
92-
Formula string `json:"formula,omitempty"`
93-
Items []MetricItem `json:"items"`
94-
FormatType string `json:"format,omitempty"`
95-
Unit string `json:"unit,omitempty"`
96-
//determine if this metric is built-in
97-
Builtin bool `json:"builtin"`
98-
//array of supported calculation statistic, eg: "avg", "sum", "min", "max"
99-
Statistics []string `json:"statistics,omitempty"`
100-
}
101-
10282
type GroupSort struct {
10383
Key string `json:"key"`
10484
Direction string `json:"direction"`

plugin/api/insight/api.go

-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,4 @@ func InitAPI() {
5656
api.HandleAPIMethod(api.POST, "/elasticsearch/:id/map_label/_render", insight.renderMapLabelTemplate)
5757
api.HandleAPIMethod(api.GET, "/insight/widget/:widget_id", insight.getWidget)
5858
api.HandleAPIMethod(api.POST, "/insight/widget", insight.RequireLogin(insight.createWidget))
59-
api.HandleAPIMethod(api.POST, "/insight/metric", insight.createMetric)
60-
api.HandleAPIMethod(api.PUT, "/insight/metric/:metric_id", insight.updateMetric)
61-
api.HandleAPIMethod(api.DELETE, "/insight/metric/:metric_id", insight.deleteMetric)
6259
}

plugin/api/insight/metric.go

-166
This file was deleted.

plugin/api/platform/domain.go

-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
"infini.sh/console/core/security/enum"
3232
consoleModel "infini.sh/console/model"
3333
"infini.sh/console/model/alerting"
34-
"infini.sh/console/model/insight"
3534
"infini.sh/framework/core/elastic"
3635
"infini.sh/framework/core/event"
3736
"infini.sh/framework/core/model"
@@ -212,10 +211,6 @@ func GetCollectionMetas() map[string]CollectionMeta {
212211
},
213212
MatchObject: &alerting.Rule{},
214213
},
215-
"metric": {
216-
Name: "metric",
217-
MatchObject: &insight.MetricBase{},
218-
},
219214
}
220215
})
221216
return collectionMetas

0 commit comments

Comments
 (0)