未验证 提交 20e34bfe 编写于 作者: ning1875's avatar ning1875 提交者: GitHub

1. tag-pair support fuzzy matching search (#747)

上级 0f63feed
......@@ -597,7 +597,14 @@ func (pd *PromeDataSource) QueryTagPairs(recv vos.CommonTagQueryParam) *vos.TagP
if i.Name == LABEL_IDENT {
labelIdents = append(labelIdents, i.Value)
}
tps[fmt.Sprintf("%s=%s", i.Name, i.Value)] = struct{}{}
if recv.Search != "" {
// 如果配置了搜索字符串,则key value中任意匹配到即可
if strings.Contains(i.Name, recv.Search) || strings.Contains(i.Value, recv.Search) {
tps[fmt.Sprintf("%s=%s", i.Name, i.Value)] = struct{}{}
}
} else {
tps[fmt.Sprintf("%s=%s", i.Name, i.Value)] = struct{}{}
}
}
}
......
......@@ -146,6 +146,7 @@ type CommonTagQueryParam struct {
End int64 `json:"end" description:"exclusive"`
StartInclusive time.Time `json:"-"`
EndExclusive time.Time `json:"-"`
Search string `json:"search"` // 查询标签组的时候的搜索 str,可以是key 也可以是value
Limit int `json:"limit"`
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册