summaryrefslogtreecommitdiff
path: root/internal/server
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2021-09-07 10:01:32 +0300
committerPaul Buetow <paul@buetow.org>2021-09-07 10:01:32 +0300
commitf74a9e4b35feb8c07d8a70b5a581088a0a59889d (patch)
tree62ebcc6314ec70270416a4416579878b82135fce /internal/server
parent6ae75e8f106d3eee18ea61e6c4d6925c6f514460 (diff)
Produce MAPREDUCE lines, can aggregate these via default log format
Diffstat (limited to 'internal/server')
-rw-r--r--internal/server/stats.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/internal/server/stats.go b/internal/server/stats.go
index ac579ad..3e8c71d 100644
--- a/internal/server/stats.go
+++ b/internal/server/stats.go
@@ -50,10 +50,14 @@ func (s *stats) logServerStats() {
s.mutex.Lock()
defer s.mutex.Unlock()
- currentConnections := fmt.Sprintf("currentConnections=%d", s.currentConnections)
- lifetimeConnections := fmt.Sprintf("lifetimeConnections=%d", s.lifetimeConnections)
- goroutines := fmt.Sprintf("goroutines=%d", runtime.NumGoroutine())
- logger.Info("stats", currentConnections, lifetimeConnections, goroutines)
+ data := make(map[string]interface{})
+ data["currentConnections"] = s.currentConnections
+ data["lifetimeConnections"] = s.lifetimeConnections
+ data["goroutines"] = runtime.NumGoroutine()
+ data["cgocalls"] = runtime.NumCgoCall()
+ data["cpu"] = runtime.NumCPU()
+
+ logger.Mapreduce("STATS", data)
}
func (s *stats) serverLimitExceeded() error {