1. tag-pair support fuzzy matching search (#747)
This commit is contained in:
parent
0f63feed22
commit
20e34bfe15
|
@ -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"`
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue