-
Notifications
You must be signed in to change notification settings - Fork 249
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
bcs-monitor规范修改golangci-lint #2623
Conversation
# Conflicts: # bcs-services/bcs-monitor/cmd/bcs-monitor/api.go
*/ | ||
|
||
// Package logrule ... |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的写法也会有问题么~,具体规范是哪个
There was a problem hiding this comment.
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", ` + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 命名可以改为ContainerMatcher
- 公共的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, ` + |
There was a problem hiding this comment.
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{` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是解什么问题? 重复率么? 不多就nolint下, 这样非常不好看原生语法, 上面的如果不多,都可以nolint下
@@ -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 + `}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这种不用处理
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
其他类似的也是
bcs-monitor规范修改golangci-lint