()
| 30 | } |
| 31 | |
| 32 | func (c *Client) logStats() { |
| 33 | c.mu.Lock() |
| 34 | active := len(c.sessions) |
| 35 | c.mu.Unlock() |
| 36 | |
| 37 | healthy, total := c.endpointHealthCounts() |
| 38 | endpointDetail := c.endpointStatsLine() |
| 39 | accountSummary := c.accountStatsLine() |
| 40 | |
| 41 | log.Printf("[stats] active=%d sessions=%d/%d frames=%d/%d bytes=%s/%s polls=%d/%d rst=%d endpoints=%d/%d", |
| 42 | active, |
| 43 | c.stats.sessionsOpen.Load(), c.stats.sessionsClose.Load(), |
| 44 | c.stats.framesOut.Load(), c.stats.framesIn.Load(), |
| 45 | humanBytes(c.stats.bytesOut.Load()), humanBytes(c.stats.bytesIn.Load()), |
| 46 | c.stats.pollsOK.Load(), c.stats.pollsFail.Load(), |
| 47 | c.stats.rstFromServer.Load(), |
| 48 | healthy, total, |
| 49 | ) |
| 50 | log.Printf("[stats] endpoints: %s", endpointDetail) |
| 51 | if accountSummary != "" { |
| 52 | log.Printf("[stats] %s", strings.TrimSpace(accountSummary)) |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | func (c *Client) endpointHealthCounts() (healthy, total int) { |
| 57 | c.endpointMu.Lock() |
no test coverage detected