diff --git a/server/monitor.go b/server/monitor.go index 8878442b..3e6feb03 100644 --- a/server/monitor.go +++ b/server/monitor.go @@ -39,9 +39,13 @@ type ConnInfo struct { InBytes int64 `json:"in_bytes"` OutBytes int64 `json:"out_bytes"` NumSubs uint32 `json:"subscriptions"` + Lang string `json:"lang,omitempty"` + Version string `json:"version,omitempty"` Subs []string `json:"subscriptions_list,omitempty"` } +const DefaultConnListSize = 1024 + // HandleConnz process HTTP requests for connection information. func (s *Server) HandleConnz(w http.ResponseWriter, r *http.Request) { c := &Connz{Conns: []*ConnInfo{}} @@ -50,7 +54,7 @@ func (s *Server) HandleConnz(w http.ResponseWriter, r *http.Request) { c.Offset, _ = strconv.Atoi(r.URL.Query().Get("offset")) c.Limit, _ = strconv.Atoi(r.URL.Query().Get("limit")) if c.Limit == 0 { - c.Limit = 100 + c.Limit = DefaultConnListSize } // Walk the list @@ -75,6 +79,8 @@ func (s *Server) HandleConnz(w http.ResponseWriter, r *http.Request) { InBytes: client.inBytes, OutBytes: client.outBytes, NumSubs: client.subs.Count(), + Lang: client.opts.Lang, + Version: client.opts.Version, } if subs == 1 { diff --git a/test/monitor_test.go b/test/monitor_test.go index dc1ec84e..e33b5db4 100644 --- a/test/monitor_test.go +++ b/test/monitor_test.go @@ -1,4 +1,4 @@ -// Copyright 2012-2014 Apcera Inc. All rights reserved. +// Copyright 2012-2015 Apcera Inc. All rights reserved. package test @@ -169,8 +169,8 @@ func TestConnz(t *testing.T) { t.Fatalf("Expected 1 connections in array, got %p\n", c.Conns) } - if c.Limit != 100 { - t.Fatalf("Expected limit of 100, got %v\n", c.Limit) + if c.Limit != server.DefaultConnListSize { + t.Fatalf("Expected limit of %d, got %v\n", server.DefaultConnListSize, c.Limit) } if c.Offset != 0 {