Redis plugin internal names consistency fix, g -> r

This commit is contained in:
Cameron Sparr 2015-08-31 15:57:52 -06:00
parent 9969c4e810
commit 9c57c30e57
1 changed files with 10 additions and 10 deletions

View File

@ -74,12 +74,12 @@ var ErrProtocolError = errors.New("redis protocol error")
// Reads stats from all configured servers accumulates stats. // Reads stats from all configured servers accumulates stats.
// Returns one of the errors encountered while gather stats (if any). // Returns one of the errors encountered while gather stats (if any).
func (g *Redis) Gather(acc plugins.Accumulator) error { func (r *Redis) Gather(acc plugins.Accumulator) error {
if len(g.Servers) == 0 { if len(r.Servers) == 0 {
url := &url.URL{ url := &url.URL{
Host: ":6379", Host: ":6379",
} }
g.gatherServer(url, acc) r.gatherServer(url, acc)
return nil return nil
} }
@ -87,7 +87,7 @@ func (g *Redis) Gather(acc plugins.Accumulator) error {
var outerr error var outerr error
for _, serv := range g.Servers { for _, serv := range r.Servers {
u, err := url.Parse(serv) u, err := url.Parse(serv)
if err != nil { if err != nil {
return fmt.Errorf("Unable to parse to address '%s': %s", serv, err) return fmt.Errorf("Unable to parse to address '%s': %s", serv, err)
@ -100,7 +100,7 @@ func (g *Redis) Gather(acc plugins.Accumulator) error {
wg.Add(1) wg.Add(1)
go func(serv string) { go func(serv string) {
defer wg.Done() defer wg.Done()
outerr = g.gatherServer(u, acc) outerr = r.gatherServer(u, acc)
}(serv) }(serv)
} }
@ -111,8 +111,8 @@ func (g *Redis) Gather(acc plugins.Accumulator) error {
const defaultPort = "6379" const defaultPort = "6379"
func (g *Redis) gatherServer(addr *url.URL, acc plugins.Accumulator) error { func (r *Redis) gatherServer(addr *url.URL, acc plugins.Accumulator) error {
if g.c == nil { if r.c == nil {
_, _, err := net.SplitHostPort(addr.Host) _, _, err := net.SplitHostPort(addr.Host)
if err != nil { if err != nil {
@ -141,12 +141,12 @@ func (g *Redis) gatherServer(addr *url.URL, acc plugins.Accumulator) error {
} }
} }
g.c = c r.c = c
} }
g.c.Write([]byte("info\r\n")) r.c.Write([]byte("info\r\n"))
r := bufio.NewReader(g.c) r := bufio.NewReader(r.c)
line, err := r.ReadString('\n') line, err := r.ReadString('\n')
if err != nil { if err != nil {