Skip to content

Commit

Permalink
fix: 修复redis_sentinel标签异常 (#1109)
Browse files Browse the repository at this point in the history
* fix: 修复redis_sentinel标签异常

* chore: 清理无用代码

---------

Co-authored-by: husheng <[email protected]>
  • Loading branch information
ttbug and husheng authored Dec 16, 2024
1 parent 7b0de22 commit 7bb3d94
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions inputs/redis_sentinel/redis_sentinel.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ func convertSentinelInfoOutput(
scanner := bufio.NewScanner(rdr)
rawFields := make(map[string]string)

tags := globalTags
tags := make(map[string]string, len(globalTags))
for k, v := range globalTags {
tags[k] = v
}

for scanner.Scan() {
line := scanner.Text()
Expand Down Expand Up @@ -268,7 +271,10 @@ func convertSentinelSentinelsOutput(
masterName string,
sentinelMaster map[string]string,
) (map[string]string, map[string]interface{}, error) {
tags := globalTags
tags := make(map[string]string, len(globalTags))
for k, v := range globalTags {
tags[k] = v
}

tags["sentinel_ip"] = sentinelMaster["ip"]
tags["sentinel_port"] = sentinelMaster["port"]
Expand Down Expand Up @@ -320,7 +326,10 @@ func convertSentinelReplicaOutput(
masterName string,
replica map[string]string,
) (map[string]string, map[string]interface{}, error) {
tags := globalTags
tags := make(map[string]string, len(globalTags))
for k, v := range globalTags {
tags[k] = v
}

tags["replica_ip"] = replica["ip"]
tags["replica_port"] = replica["port"]
Expand Down Expand Up @@ -383,7 +392,10 @@ func convertSentinelMastersOutput(
master map[string]string,
quorumErr error,
) (map[string]string, map[string]interface{}, error) {
tags := globalTags
tags := make(map[string]string, len(globalTags))
for k, v := range globalTags {
tags[k] = v
}

tags["master"] = master["name"]

Expand Down

0 comments on commit 7bb3d94

Please sign in to comment.