Commit a71b26db authored by Geoff Simmons's avatar Geoff Simmons

Stats.Read() returns human-readable strings.

parent 73c9c3c6
......@@ -51,10 +51,10 @@ var (
expStats = [...]string{"MGT.uptime", "MAIN.uptime", "MAIN.n_vcl"}
errStats = [...]string{"foo", "bar", "baz", "quux"}
s7sn = map[Semantics]expRuneStr{
Counter: {'c', "c"},
Gauge: {'g', "g"},
S7sBitmap: {'b', "b"},
S7sUnknown: {'?', "?"},
Counter: {'c', "counter"},
Gauge: {'g', "gauge"},
S7sBitmap: {'b', "bitmap"},
S7sUnknown: {'?', "unknown"},
}
formats = map[Format]expRuneStr{
Integer: {'i', "i"},
......
......@@ -72,9 +72,20 @@ const (
S7sUnknown = Semantics('?')
)
// String returns "c", "g", "b" or "?".
// String returns "counter", "gauge", "bitmap" or "unknown".
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
......
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