Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bcs-monitor规范修改golangci-lint #2623

Merged

Conversation

LidolLxf
Copy link
Contributor

bcs-monitor规范修改golangci-lint

*/

// Package logrule ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package 一个就可以了

storeList []string,
httpSDURLs []string,
g *run.Group,
func NewQueryAPI(ctx context.Context, reg *prometheus.Registry, tracer opentracing.Tracer, kitLogger gokit.Logger,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的写法也会有问题么~,具体规范是哪个

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

函数体过长了,超过90行

@@ -26,6 +27,9 @@ import (
const (
// PROVIDER xxx
PROVIDER = `provider="PROMETHEUS"`
// CLUSTERID xxx
CLUSTERID = `cluster_id="%<clusterID>s", namespace="%<namespace>s", ` +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 命名可以改为ContainerMatcher
  2. 公共的matcher可以base目录

@@ -41,6 +42,18 @@ const (
// 默认查询分片,每10个节点一组并发查询,限制并发为 20,防止对数据源造成压力
scale = 10
defaultQueryConcurrent = 20

// SUMMAX ...
SUMMAX = `sum(max by(bk_instance) (rate(node_disk_io_time_seconds_total{%<cluster>s, ` +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

特定的,用小写非导出就好

SUMNODE = `%<cluster>s, bk_instance=~"%<instance>s", fstype=~"%<fstype>s", ` +
`mountpoint=~"%<mountpoint>s", %<provider>s`
// SUMNODEFILE ...
SUMNODEFILE = `sum(node_filesystem_size_bytes{`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是解什么问题? 重复率么? 不多就nolint下, 这样非常不好看原生语法, 上面的如果不多,都可以nolint下

@LidolLxf LidolLxf closed this Sep 25, 2023
@LidolLxf LidolLxf reopened this Sep 25, 2023
@@ -61,7 +67,7 @@ func handleContainerMetric(c *rest.Context, promql string) (interface{}, error)
// @Router /namespaces/namespace/pods/:pod/containers/:container/cpu_usage [GET]
func ContainerCPUUsage(c *rest.Context) (interface{}, error) {
promql :=
`bcs:container:cpu_usage{cluster_id="%<clusterId>s", namespace="%<namespace>s", pod_name=~"%<podName>s", container_name=~"%<containerName>s", %<provider>s}`
`bcs:container:cpu_usage{` + CLUSTERID + `}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种不用处理

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其他类似的也是

@wenxinlee2015 wenxinlee2015 merged commit 901ed28 into TencentBlueKing:master Oct 7, 2023
5 checks passed
@LidolLxf LidolLxf deleted the feat_monitor_golangci branch April 23, 2024 03:36
@LidolLxf LidolLxf restored the feat_monitor_golangci branch May 20, 2024 08:21
@LidolLxf LidolLxf deleted the feat_monitor_golangci branch May 20, 2024 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants