1
0
Fork 0

Add queue stats

master
Philip O'Toole 2 years ago
parent 247f749fb1
commit 00874ebb44

@ -722,10 +722,20 @@ func (s *Service) handleStatus(w http.ResponseWriter, r *http.Request) {
oss["hostname"] = hostname
}
qs, err := s.stmtQueue.Stats()
if err != nil {
http.Error(w, fmt.Sprintf("cluster stats: %s", err.Error()),
http.StatusInternalServerError)
return
}
queueStats := map[string]interface{}{
"_default": qs,
}
httpStatus := map[string]interface{}{
"bind_addr": s.Addr().String(),
"auth": prettyEnabled(s.credentialStore != nil),
"cluster": clusterStatus,
"queue": queueStats,
}
nodeStatus := map[string]interface{}{

@ -73,6 +73,15 @@ func (q *Queue) Depth() int {
return len(q.batchCh)
}
// Stats returns stats on this queue.
func (q *Queue) Stats() (map[string]interface{}, error) {
return map[string]interface{}{
"max_size": q.maxSize,
"batch_size": q.batchSize,
"timeout": q.timeout,
}, nil
}
func (q *Queue) run() {
defer close(q.closed)
var stmts []*command.Statement

Loading…
Cancel
Save