diff --git a/server/events.go b/server/events.go index b708c55c..097a91e3 100644 --- a/server/events.go +++ b/server/events.go @@ -154,6 +154,7 @@ type AccountStat struct { Conns int `json:"conns"` LeafNodes int `json:"leafnodes"` TotalConns int `json:"total_conns"` + NumSubs uint32 `json:"num_subscriptions"` Sent DataStats `json:"sent"` Received DataStats `json:"received"` SlowConsumers int64 `json:"slow_consumers"` @@ -1907,6 +1908,7 @@ func (a *Account) statz() *AccountStat { Conns: localConns, LeafNodes: leafConns, TotalConns: localConns + leafConns, + NumSubs: a.sl.Count(), Received: DataStats{ Msgs: atomic.LoadInt64(&a.inMsgs), Bytes: atomic.LoadInt64(&a.inBytes)}, diff --git a/server/events_test.go b/server/events_test.go index 7bce1fee..904fc7ab 100644 --- a/server/events_test.go +++ b/server/events_test.go @@ -1288,14 +1288,14 @@ func TestAccountReqMonitoring(t *testing.T) { resp, err = ncSys.Request(statz(acc.Name), nil, time.Second) require_NoError(t, err) respContentAcc := []string{`"conns":1,`, `"total_conns":1`, `"slow_consumers":0`, `"sent":{"msgs":0,"bytes":0}`, - `"received":{"msgs":0,"bytes":0}`, fmt.Sprintf(`"acc":"%s"`, acc.Name)} + `"received":{"msgs":0,"bytes":0}`, `"num_subscriptions":`, fmt.Sprintf(`"acc":"%s"`, acc.Name)} require_Contains(t, string(resp.Data), respContentAcc...) rIb := ncSys.NewRespInbox() rSub, err := ncSys.SubscribeSync(rIb) require_NoError(t, err) require_NoError(t, ncSys.PublishRequest(pStatz, rIb, nil)) - minRespContentForBothAcc := []string{`"conns":1,`, `"total_conns":1`, `"slow_consumers":0`, `"acc":"`} + minRespContentForBothAcc := []string{`"conns":1,`, `"total_conns":1`, `"slow_consumers":0`, `"acc":"`, `"num_subscriptions":`} resp, err = rSub.NextMsg(time.Second) require_NoError(t, err) require_Contains(t, string(resp.Data), minRespContentForBothAcc...)