From 9f27ed89336b0c49f587848f73faf086bc7ae8f5 Mon Sep 17 00:00:00 2001 From: Caleb Lloyd Date: Thu, 5 Oct 2023 15:45:30 -0400 Subject: [PATCH] remove models_vnext Signed-off-by: Caleb Lloyd --- surveyor/collector_statz.go | 10 +++++----- surveyor/models_vnext.go | 27 --------------------------- 2 files changed, 5 insertions(+), 32 deletions(-) delete mode 100644 surveyor/models_vnext.go diff --git a/surveyor/collector_statz.go b/surveyor/collector_statz.go index 4f58157..762ed3d 100644 --- a/surveyor/collector_statz.go +++ b/surveyor/collector_statz.go @@ -637,7 +637,7 @@ func (sc *StatzCollector) getJSInfos(nc *nats.Conn) map[string]*server.AccountDe return jsAccInfos } -func (sc *StatzCollector) getAccStatz(nc *nats.Conn) (map[string]*VNextAccountStat, error) { +func (sc *StatzCollector) getAccStatz(nc *nats.Conn) (map[string]*server.AccountStat, error) { req := &server.AccountStatzOptions{ IncludeUnused: true, } @@ -645,7 +645,7 @@ func (sc *StatzCollector) getAccStatz(nc *nats.Conn) (map[string]*VNextAccountSt if err != nil { return nil, err } - res := make([]*VNextAccountStatz, 0) + res := make([]*server.AccountStatz, 0) const subj = "$SYS.REQ.ACCOUNT.PING.STATZ" msgs, err := requestMany(nc, sc, subj, reqJSON) @@ -655,7 +655,7 @@ func (sc *StatzCollector) getAccStatz(nc *nats.Conn) (map[string]*VNextAccountSt for _, msg := range msgs { var r server.ServerAPIResponse - var d VNextAccountStatz + var d server.AccountStatz r.Data = &d if err := json.Unmarshal(msg.Data, &r); err != nil { return nil, err @@ -678,7 +678,7 @@ func (sc *StatzCollector) getAccStatz(nc *nats.Conn) (map[string]*VNextAccountSt } } - accStatz := make(map[string]*VNextAccountStat) + accStatz := make(map[string]*server.AccountStat) for _, statz := range res { for _, acc := range statz.Accounts { accInfo, ok := accStatz[acc.Account] @@ -720,7 +720,7 @@ Outer: } } -func mergeAccountStats(from, to *VNextAccountStat) { +func mergeAccountStats(from, to *server.AccountStat) { to.Conns += from.Conns to.LeafNodes += from.LeafNodes to.TotalConns += from.TotalConns diff --git a/surveyor/models_vnext.go b/surveyor/models_vnext.go deleted file mode 100644 index 9621d04..0000000 --- a/surveyor/models_vnext.go +++ /dev/null @@ -1,27 +0,0 @@ -package surveyor - -import ( - "github.com/nats-io/nats-server/v2/server" - "time" -) - -// todo: once 2.10.0 is released, upgrade nats-server dependency to 2.10.0 and remove these - -// VNextAccountStatz is the AccountStatz model from 2.10 -type VNextAccountStatz struct { - ID string `json:"server_id"` - Now time.Time `json:"now"` - Accounts []*VNextAccountStat `json:"account_statz"` -} - -// VNextAccountStat is the AccountStat model from 2.10 -type VNextAccountStat struct { - Account string `json:"acc"` - Conns int `json:"conns"` - LeafNodes int `json:"leafnodes"` - TotalConns int `json:"total_conns"` - NumSubs uint32 `json:"num_subscriptions"` - Sent server.DataStats `json:"sent"` - Received server.DataStats `json:"received"` - SlowConsumers int64 `json:"slow_consumers"` -}