removed the extra stats table
This commit is contained in:
parent
369a41eeb2
commit
9118acb268
@ -34,8 +34,6 @@ type json_out_server_stats struct {
|
|||||||
ServerPeers int64 `json:"server-peers"`
|
ServerPeers int64 `json:"server-peers"`
|
||||||
|
|
||||||
SshProxySessions int64 `json:"ssh-proxy-session"`
|
SshProxySessions int64 `json:"ssh-proxy-session"`
|
||||||
|
|
||||||
Extra map[string]int64 `json:"extra"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
@ -359,8 +357,7 @@ func (ctl *server_ctl_stats) ServeHTTP(w http.ResponseWriter, req *http.Request)
|
|||||||
case http.MethodGet:
|
case http.MethodGet:
|
||||||
var stats json_out_server_stats
|
var stats json_out_server_stats
|
||||||
var mstat runtime.MemStats
|
var mstat runtime.MemStats
|
||||||
var k string
|
|
||||||
var v int64
|
|
||||||
runtime.ReadMemStats(&mstat)
|
runtime.ReadMemStats(&mstat)
|
||||||
stats.CPUs = runtime.NumCPU()
|
stats.CPUs = runtime.NumCPU()
|
||||||
stats.Goroutines = runtime.NumGoroutine()
|
stats.Goroutines = runtime.NumGoroutine()
|
||||||
@ -372,10 +369,6 @@ func (ctl *server_ctl_stats) ServeHTTP(w http.ResponseWriter, req *http.Request)
|
|||||||
stats.ServerRoutes = s.stats.routes.Load()
|
stats.ServerRoutes = s.stats.routes.Load()
|
||||||
stats.ServerPeers = s.stats.peers.Load()
|
stats.ServerPeers = s.stats.peers.Load()
|
||||||
stats.SshProxySessions = s.stats.ssh_proxy_sessions.Load()
|
stats.SshProxySessions = s.stats.ssh_proxy_sessions.Load()
|
||||||
s.stats.extra_mtx.Lock()
|
|
||||||
stats.Extra = make(map[string]int64, len(s.stats.extra))
|
|
||||||
for k, v = range s.stats.extra { stats.Extra[k] = v }
|
|
||||||
s.stats.extra_mtx.Unlock()
|
|
||||||
status_code = WriteJsonRespHeader(w, http.StatusOK)
|
status_code = WriteJsonRespHeader(w, http.StatusOK)
|
||||||
if err = je.Encode(stats); err != nil { goto oops }
|
if err = je.Encode(stats); err != nil { goto oops }
|
||||||
|
|
||||||
|
10
server.go
10
server.go
@ -93,9 +93,6 @@ type Server struct {
|
|||||||
routes atomic.Int64
|
routes atomic.Int64
|
||||||
peers atomic.Int64
|
peers atomic.Int64
|
||||||
ssh_proxy_sessions atomic.Int64
|
ssh_proxy_sessions atomic.Int64
|
||||||
|
|
||||||
extra_mtx sync.Mutex
|
|
||||||
extra map[string]int64
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wpx_resp_tf ServerWpxResponseTransformer
|
wpx_resp_tf ServerWpxResponseTransformer
|
||||||
@ -1145,7 +1142,6 @@ func NewServer(ctx context.Context, logger Logger, ctl_addrs []string, rpc_addrs
|
|||||||
s.stats.routes.Store(0)
|
s.stats.routes.Store(0)
|
||||||
s.stats.peers.Store(0)
|
s.stats.peers.Store(0)
|
||||||
s.stats.ssh_proxy_sessions.Store(0)
|
s.stats.ssh_proxy_sessions.Store(0)
|
||||||
s.stats.extra = make(map[string]int64, 64)
|
|
||||||
|
|
||||||
return &s, nil
|
return &s, nil
|
||||||
|
|
||||||
@ -1661,12 +1657,6 @@ func (s *Server) WriteLog(id string, level LogLevel, fmtstr string, args ...inte
|
|||||||
s.log.Write(id, level, fmtstr, args...)
|
s.log.Write(id, level, fmtstr, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) SetExtraStat(key string, val int64) {
|
|
||||||
s.stats.extra_mtx.Lock()
|
|
||||||
s.stats.extra[key] = val
|
|
||||||
s.stats.extra_mtx.Unlock()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Server) AddCtlHandler(path string, handler ServerHttpHandler) {
|
func (s *Server) AddCtlHandler(path string, handler ServerHttpHandler) {
|
||||||
s.ctl_mux.Handle(s.ctl_prefix + "/_ctl" + path, s.wrap_http_handler(handler))
|
s.ctl_mux.Handle(s.ctl_prefix + "/_ctl" + path, s.wrap_http_handler(handler))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user