Skip to content

Commit

Permalink
fix: get label value from filters, if meta dimension case != doc desc (
Browse files Browse the repository at this point in the history
…#19)

Co-authored-by: juexiaolin(林觉霄) <[email protected]>
  • Loading branch information
juexiaolin and juexiaolin(林觉霄) authored Nov 11, 2020
1 parent f9a5d8e commit 22fe15b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/metric/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import (
"crypto/md5"
"encoding/json"
"fmt"
"github.com/tencentyun/tencentcloud-exporter/pkg/instance"
"sort"
"strings"

"github.com/tencentyun/tencentcloud-exporter/pkg/instance"
)

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

// 根据标签名, 获取所有标签的值
func (l *TcmLabels) GetValues(filters map[string]string, ins instance.TcInstance) (values []string, err error) {
lowerKeyFilters := map[string]string{}
for k, v := range filters {
lowerKeyFilters[strings.ToLower(k)] = v
}

nameValues := map[string]string{}
for _, name := range l.queryLableNames {
v, ok := filters[name]
v, ok := lowerKeyFilters[strings.ToLower(name)]
if ok {
nameValues[name] = v
} else {
Expand Down

0 comments on commit 22fe15b

Please sign in to comment.