mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 11:48:43 -07:00
Added slow consumers to varz, fixed reporting bug
This commit is contained in:
@@ -655,7 +655,8 @@ writeErr:
|
||||
client.mu.Unlock()
|
||||
|
||||
if ne, ok := err.(net.Error); ok && ne.Timeout() {
|
||||
c.Noticef("Slow Consumer Detected")
|
||||
atomic.AddInt64(&client.srv.slowConsumers, 1)
|
||||
client.Noticef("Slow Consumer Detected")
|
||||
client.closeConnection()
|
||||
} else {
|
||||
c.Debugf("Error writing msg: %v", err)
|
||||
|
||||
@@ -198,21 +198,22 @@ func (s *Server) HandleSubsz(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// Varz will output server information on the monitoring port at /varz.
|
||||
type Varz struct {
|
||||
Information *Info `json:"info"`
|
||||
Options *Options `json:"options"`
|
||||
Start time.Time `json:"start"`
|
||||
Now time.Time `json:"now"`
|
||||
Uptime string `json:"uptime"`
|
||||
Mem int64 `json:"mem"`
|
||||
Cores int `json:"cores"`
|
||||
CPU float64 `json:"cpu"`
|
||||
Connections int `json:"connections"`
|
||||
Routes int `json:"routes"`
|
||||
Remotes int `json:"remotes"`
|
||||
InMsgs int64 `json:"in_msgs"`
|
||||
OutMsgs int64 `json:"out_msgs"`
|
||||
InBytes int64 `json:"in_bytes"`
|
||||
OutBytes int64 `json:"out_bytes"`
|
||||
Information *Info `json:"info"`
|
||||
Options *Options `json:"options"`
|
||||
Start time.Time `json:"start"`
|
||||
Now time.Time `json:"now"`
|
||||
Uptime string `json:"uptime"`
|
||||
Mem int64 `json:"mem"`
|
||||
Cores int `json:"cores"`
|
||||
CPU float64 `json:"cpu"`
|
||||
Connections int `json:"connections"`
|
||||
Routes int `json:"routes"`
|
||||
Remotes int `json:"remotes"`
|
||||
InMsgs int64 `json:"in_msgs"`
|
||||
OutMsgs int64 `json:"out_msgs"`
|
||||
InBytes int64 `json:"in_bytes"`
|
||||
OutBytes int64 `json:"out_bytes"`
|
||||
SlowConsumers int64 `json:"slow_consumers"`
|
||||
}
|
||||
|
||||
type usage struct {
|
||||
@@ -260,6 +261,7 @@ func (s *Server) HandleVarz(w http.ResponseWriter, r *http.Request) {
|
||||
v.InBytes = s.inBytes
|
||||
v.OutMsgs = s.outMsgs
|
||||
v.OutBytes = s.outBytes
|
||||
v.SlowConsumers = s.slowConsumers
|
||||
s.mu.Unlock()
|
||||
|
||||
b, err := json.MarshalIndent(v, "", " ")
|
||||
|
||||
@@ -63,10 +63,11 @@ type Server struct {
|
||||
}
|
||||
|
||||
type stats struct {
|
||||
inMsgs int64
|
||||
outMsgs int64
|
||||
inBytes int64
|
||||
outBytes int64
|
||||
inMsgs int64
|
||||
outMsgs int64
|
||||
inBytes int64
|
||||
outBytes int64
|
||||
slowConsumers int64
|
||||
}
|
||||
|
||||
// New will setup a new server struct after parsing the options.
|
||||
|
||||
Reference in New Issue
Block a user