mirror of https://github.com/divan/expvarmon.git
Added String var kind
This commit is contained in:
parent
57d82c5544
commit
191559f45e
2
ui.go
2
ui.go
|
@ -160,6 +160,8 @@ func colorByKind(kind VarKind) termui.Attribute {
|
||||||
return termui.ColorRed | termui.AttrBold
|
return termui.ColorRed | termui.AttrBold
|
||||||
case KindDuration:
|
case KindDuration:
|
||||||
return termui.ColorYellow | termui.AttrBold
|
return termui.ColorYellow | termui.AttrBold
|
||||||
|
case KindString:
|
||||||
|
return termui.ColorGreen | termui.AttrBold
|
||||||
default:
|
default:
|
||||||
return termui.ColorBlue | termui.AttrBold
|
return termui.ColorBlue | termui.AttrBold
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,9 @@ func (t *TermUISingle) Update(data UIData) {
|
||||||
|
|
||||||
// Sparklines
|
// Sparklines
|
||||||
for i, name := range data.Vars {
|
for i, name := range data.Vars {
|
||||||
|
if name.Kind() == KindString {
|
||||||
|
continue
|
||||||
|
}
|
||||||
spl := &t.Sparkline.Lines[i]
|
spl := &t.Sparkline.Lines[i]
|
||||||
spl.Title = fmt.Sprintf("%s: %v", name.Long(), service.Value(name))
|
spl.Title = fmt.Sprintf("%s: %v", name.Long(), service.Value(name))
|
||||||
spl.TitleColor = colorByKind(name.Kind())
|
spl.TitleColor = colorByKind(name.Kind())
|
||||||
|
|
3
var.go
3
var.go
|
@ -16,6 +16,7 @@ const (
|
||||||
KindDefault VarKind = iota
|
KindDefault VarKind = iota
|
||||||
KindMemory
|
KindMemory
|
||||||
KindDuration
|
KindDuration
|
||||||
|
KindString
|
||||||
)
|
)
|
||||||
|
|
||||||
// ToSlice converts "dot-separated" notation into the "slice of strings".
|
// ToSlice converts "dot-separated" notation into the "slice of strings".
|
||||||
|
@ -62,6 +63,8 @@ func (v VarName) Kind() VarKind {
|
||||||
return KindMemory
|
return KindMemory
|
||||||
case "duration":
|
case "duration":
|
||||||
return KindDuration
|
return KindDuration
|
||||||
|
case "str":
|
||||||
|
return KindString
|
||||||
}
|
}
|
||||||
return KindDefault
|
return KindDefault
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue