fix: lint eror (#82)

This commit is contained in:
silenceqi 2025-01-16 11:11:53 +08:00 committed by GitHub
parent 20a1d963c3
commit 7db9344bad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 2 additions and 10 deletions

View File

@ -43,7 +43,6 @@ import (
type EsRequest struct {
Doc string `json:"doc"`
Privilege string `json:"privilege"`
ClusterRequest
IndexRequest
}

View File

@ -85,7 +85,7 @@ func TestCreateRule(t *testing.T) {
Metrics: Metric{
Metric: insight.Metric{
Groups: []insight.MetricGroupItem{{"metadata.labels.cluster_id", 10}, {"metadata.labels.node_id", 10}},
Groups: []insight.MetricGroupItem{{Field: "metadata.labels.cluster_id", Limit: 10}, {Field: "metadata.labels.node_id", Limit: 10}},
Items: []insight.MetricItem{
{Name: "a", Field: "payload.elasticsearch.node_stats.fs.total.free_in_bytes", Statistic: "min"},
{Name: "b", Field: "payload.elasticsearch.node_stats.fs.total.total_in_bytes", Statistic: "max"},

View File

@ -424,7 +424,6 @@ func (h *APIHandler) autoEnrollESNode(w http.ResponseWriter, req *http.Request,
if autoEnrollRunning.Load() {
panic(errors.New("auto_enroll is already running in background"))
return
}
autoEnrollRunning.Swap(true)

View File

@ -468,7 +468,6 @@ func (h *APIHandler) FetchHostInfo(w http.ResponseWriter, req *http.Request, ps
bucketSize, min, max, err := h.GetMetricRangeAndBucketSize(req, "", "", 15)
if err != nil {
panic(err)
return
}
networkInMetricItem := newMetricItem("network_in_rate", 1, SystemGroupKey)
networkInMetricItem.AddAxi("network_rate", "group1", common.PositionLeft, "bytes", "0.[0]", "0.[0]", 5, true)

View File

@ -554,7 +554,6 @@ func (h *APIHandler) HandleClusterMetricsAction(w http.ResponseWriter, req *http
bucketSize, min, max, err := h.GetMetricRangeAndBucketSize(req, id, metricType, 90)
if err != nil {
panic(err)
return
}
var metrics map[string]*common.MetricItem
if bucketSize <= 60 {

View File

@ -113,7 +113,6 @@ func (h *APIHandler) FetchClusterInfo(w http.ResponseWriter, req *http.Request,
bucketSize, min, max, err := h.GetMetricRangeAndBucketSize(req, clusterIDs[0], MetricTypeIndexStats, 15)
if err != nil {
panic(err)
return
}
query := util.MapStr{}

View File

@ -522,7 +522,6 @@ func (h *APIHandler) HandleClusterMetricsAction(w http.ResponseWriter, req *http
bucketSize, min, max, err := h.GetMetricRangeAndBucketSize(req, id, metricType, 90)
if err != nil {
panic(err)
return
}
timeout := h.GetParameterOrDefault(req, "timeout", "60s")

View File

@ -308,7 +308,6 @@ func (h *APIHandler) FetchNodeInfo(w http.ResponseWriter, req *http.Request, ps
bucketSize, min, max, err := h.GetMetricRangeAndBucketSize(req, clusterID, MetricTypeNodeStats, 15)
if err != nil {
panic(err)
return
}
// 索引速率
indexMetric := newMetricItem("indexing", 1, OperationGroupKey)

View File

@ -466,7 +466,7 @@ func getMetadataByIndexPattern(clusterID, indexPattern, timeField string, filter
}}
if seriesType == "column" || seriesType == "pie" {
seriesItem.Metric.Groups = []insight.MetricGroupItem{
{aggField.Name, 10},
{Field: aggField.Name, Limit: 10},
}
}
fieldVis := insight.Visualization{

View File

@ -163,7 +163,6 @@ func (h *APIHandler) createInstance(w http.ResponseWriter, req *http.Request, ps
obj.Name = res.Name
}
obj.Application = res.Application
res.Network = res.Network
exists, err := orm.Get(obj)
if err != nil && err != elastic.ErrNotFound {