Add processes created to misc stats
This commit is contained in:
parent
10a398abdd
commit
28b2246b5b
|
@ -21,6 +21,7 @@ func (l AvgStat) String() string {
|
|||
|
||||
type MiscStat struct {
|
||||
ProcsTotal int `json:"procsTotal"`
|
||||
ProcsCreated int `json:"procsCreated"`
|
||||
ProcsRunning int `json:"procsRunning"`
|
||||
ProcsBlocked int `json:"procsBlocked"`
|
||||
Ctxt int `json:"ctxt"`
|
||||
|
|
|
@ -92,6 +92,8 @@ func MiscWithContext(ctx context.Context) (*MiscStat, error) {
|
|||
continue
|
||||
}
|
||||
switch fields[0] {
|
||||
case "processes":
|
||||
ret.ProcsCreated = int(v)
|
||||
case "procs_running":
|
||||
ret.ProcsRunning = int(v)
|
||||
case "procs_blocked":
|
||||
|
|
|
@ -47,11 +47,12 @@ func TestMisc(t *testing.T) {
|
|||
func TestMiscStatString(t *testing.T) {
|
||||
v := MiscStat{
|
||||
ProcsTotal: 4,
|
||||
ProcsCreated: 5,
|
||||
ProcsRunning: 1,
|
||||
ProcsBlocked: 2,
|
||||
Ctxt: 3,
|
||||
}
|
||||
e := `{"procsTotal":4,"procsRunning":1,"procsBlocked":2,"ctxt":3}`
|
||||
e := `{"procsTotal":4,"procsCreated":5,"procsRunning":1,"procsBlocked":2,"ctxt":3}`
|
||||
if e != fmt.Sprintf("%v", v) {
|
||||
t.Errorf("TestMiscString string is invalid: %v", v)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue