diff --git a/http/service.go b/http/service.go index 361b05ec..4ad6eb06 100644 --- a/http/service.go +++ b/http/service.go @@ -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{}{ diff --git a/queue/queue.go b/queue/queue.go index 05be97a1..d57a18a8 100644 --- a/queue/queue.go +++ b/queue/queue.go @@ -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