Commit a71b26db authored by Geoff Simmons's avatar Geoff Simmons

Stats.Read() returns human-readable strings.

parent 73c9c3c6
...@@ -51,10 +51,10 @@ var ( ...@@ -51,10 +51,10 @@ var (
expStats = [...]string{"MGT.uptime", "MAIN.uptime", "MAIN.n_vcl"} expStats = [...]string{"MGT.uptime", "MAIN.uptime", "MAIN.n_vcl"}
errStats = [...]string{"foo", "bar", "baz", "quux"} errStats = [...]string{"foo", "bar", "baz", "quux"}
s7sn = map[Semantics]expRuneStr{ s7sn = map[Semantics]expRuneStr{
Counter: {'c', "c"}, Counter: {'c', "counter"},
Gauge: {'g', "g"}, Gauge: {'g', "gauge"},
S7sBitmap: {'b', "b"}, S7sBitmap: {'b', "bitmap"},
S7sUnknown: {'?', "?"}, S7sUnknown: {'?', "unknown"},
} }
formats = map[Format]expRuneStr{ formats = map[Format]expRuneStr{
Integer: {'i', "i"}, Integer: {'i', "i"},
......
...@@ -72,9 +72,20 @@ const ( ...@@ -72,9 +72,20 @@ const (
S7sUnknown = Semantics('?') S7sUnknown = Semantics('?')
) )
// String returns "c", "g", "b" or "?". // String returns "counter", "gauge", "bitmap" or "unknown".
func (s Semantics) String() string { func (s Semantics) String() string {
return string(s) switch (s) {
case Counter:
return "counter"
case Gauge:
return "gauge"
case S7sBitmap:
return "bitmap"
case S7sUnknown:
return "unknown"
default:
return "invalid status"
}
} }
// Format indicates the display format suitable for the kind of data // Format indicates the display format suitable for the kind of data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment