Merge pull request #76 from kotopes/redis-port-tag

add tag "port" to every redis metric
This commit is contained in:
Cameron Sparr 2015-08-05 15:01:36 -06:00
commit df9e1669cf
1 changed files with 6 additions and 1 deletions

View File

@ -188,7 +188,12 @@ func (g *Redis) gatherServer(addr *url.URL, acc plugins.Accumulator) error {
continue
}
tags := map[string]string{"host": addr.String()}
_, rPort, err := net.SplitHostPort(addr.Host)
if err != nil {
rPort = defaultPort
}
tags := map[string]string{"host": addr.String(), "port": rPort}
val := strings.TrimSpace(parts[1])
ival, err := strconv.ParseUint(val, 10, 64)