add test coverage. add back wretr. remove check_status from recently added column

This commit is contained in:
chrispeterson 2015-12-15 17:10:48 -08:00
parent 3fe1a9f543
commit 10b8a3e1a5
2 changed files with 31 additions and 21 deletions

View File

@ -230,6 +230,11 @@ func importCsvResult(r io.Reader, acc plugins.Accumulator, host string) ([][]str
if err == nil { if err == nil {
acc.Add("eresp", ival, tags) acc.Add("eresp", ival, tags)
} }
case HF_WRETR:
ival, err := strconv.ParseUint(v, 10, 64)
if err == nil {
acc.Add("wretr", ival, tags)
}
case HF_WREDIS: case HF_WREDIS:
ival, err := strconv.ParseUint(v, 10, 64) ival, err := strconv.ParseUint(v, 10, 64)
if err == nil { if err == nil {
@ -270,11 +275,6 @@ func importCsvResult(r io.Reader, acc plugins.Accumulator, host string) ([][]str
if err == nil { if err == nil {
acc.Add("rate_max", ival, tags) acc.Add("rate_max", ival, tags)
} }
case HF_CHECK_STATUS:
ival, err := strconv.ParseUint(v, 10, 64)
if err == nil {
acc.Add("check_status", ival, tags)
}
case HF_CHECK_DURATION: case HF_CHECK_DURATION:
ival, err := strconv.ParseUint(v, 10, 64) ival, err := strconv.ParseUint(v, 10, 64)
if err == nil { if err == nil {

View File

@ -53,31 +53,41 @@ func TestHaproxyGeneratesMetricsWithAuthentication(t *testing.T) {
name string name string
value uint64 value uint64
}{ }{
{"bin", 5557055817},
{"scur", 288},
{"qmax", 81}, {"qmax", 81},
{"scur", 288},
{"smax", 713},
{"bin", 5557055817},
{"bout", 24096715169},
{"dreq", 1102},
{"dresp", 80},
{"ereq", 95740},
{"econ", 0},
{"eresp", 0},
{"wretr", 17},
{"wredis", 19},
{"active_servers", 1},
{"backup_servers", 0},
{"downtime", 0},
{"throttle", 13},
{"lbtot", 114},
{"rate", 18},
{"rate_max", 102},
{"check_duration", 1},
{"http_response.1xx", 0}, {"http_response.1xx", 0},
{"http_response.2xx", 1314093}, {"http_response.2xx", 1314093},
{"http_response.3xx", 537036}, {"http_response.3xx", 537036},
{"http_response.4xx", 123452}, {"http_response.4xx", 123452},
{"http_response.5xx", 11966}, {"http_response.5xx", 11966},
{"dreq", 1102},
{"dresp", 80},
{"wretr", 17},
{"wredis", 19},
{"ereq", 95740},
{"econ", 0},
{"eresp", 0},
{"req_rate", 35}, {"req_rate", 35},
{"req_rate_max", 140}, {"req_rate_max", 140},
{"req_tot", 1987928}, {"req_tot", 1987928},
{"bin", 5557055817}, {"cli_abort", 0},
{"bout", 24096715169}, {"srv_abort", 0},
{"rate", 18}, {"qtime", 0},
{"rate_max", 102}, {"ctime", 2},
{"rtime", 23},
{"throttle", 13}, {"ttime", 545},
{"lbtot", 114},
} }
for _, c := range checkInt { for _, c := range checkInt {