Skip to content

Commit 22fe15b

Browse files
juexiaolinjuexiaolin(林觉霄)
andauthored
fix: get label value from filters, if meta dimension case != doc desc (#19)
Co-authored-by: juexiaolin(林觉霄) <[email protected]>
1 parent f9a5d8e commit 22fe15b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pkg/metric/label.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import (
44
"crypto/md5"
55
"encoding/json"
66
"fmt"
7-
"github.com/tencentyun/tencentcloud-exporter/pkg/instance"
87
"sort"
8+
"strings"
9+
10+
"github.com/tencentyun/tencentcloud-exporter/pkg/instance"
911
)
1012

1113
type Labels map[string]string
@@ -29,9 +31,14 @@ type TcmLabels struct {
2931

3032
// 根据标签名, 获取所有标签的值
3133
func (l *TcmLabels) GetValues(filters map[string]string, ins instance.TcInstance) (values []string, err error) {
34+
lowerKeyFilters := map[string]string{}
35+
for k, v := range filters {
36+
lowerKeyFilters[strings.ToLower(k)] = v
37+
}
38+
3239
nameValues := map[string]string{}
3340
for _, name := range l.queryLableNames {
34-
v, ok := filters[name]
41+
v, ok := lowerKeyFilters[strings.ToLower(name)]
3542
if ok {
3643
nameValues[name] = v
3744
} else {

0 commit comments

Comments
 (0)