mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
WIP: add best guess prominent socket stats logging
This commit is contained in:
@@ -4521,6 +4521,8 @@ func (c *client) diagnosticsLoop() {
|
||||
}
|
||||
return
|
||||
}
|
||||
// Log before populate, so that the previous metrics are available.
|
||||
(&c.diagTCPData).LogInteresting(c, routeID, &c.diagMetrics)
|
||||
(&c.diagMetrics).PopulateFromTCPDiagnostics(&c.diagTCPData, expvarMaps, routeID)
|
||||
c.mu.Unlock()
|
||||
}
|
||||
@@ -4555,3 +4557,8 @@ func (c *client) Warnf(format string, v ...interface{}) {
|
||||
format = fmt.Sprintf("%s - %s", c, format)
|
||||
c.srv.Warnf(format, v...)
|
||||
}
|
||||
|
||||
func (c *client) Fatalf(format string, v ...interface{}) {
|
||||
format = fmt.Sprintf("%s - %s", c, format)
|
||||
c.srv.Fatalf(format, v...)
|
||||
}
|
||||
|
||||
@@ -170,3 +170,20 @@ func populateExpvarMapsTCPDiagnostics(maps *TCPInfoExpMaps, fullLabel string, me
|
||||
vm.Field(i).Interface().(*expvar.Map).Set(fullLabel, vmetrics.FieldByName(tm.Field(i).Name))
|
||||
}
|
||||
}
|
||||
|
||||
func (d *TCPDiagnostics) LogInteresting(log Logger, fullLabel string, previous *TCPInfoExpMetrics) {
|
||||
if int64(d.Info.Pmtu) != previous.PathMTU.Value() {
|
||||
log.Noticef("[SOCKET-DIAGNOSTICS] %q: Path MTU change: was %v now %v",
|
||||
fullLabel, previous.PathMTU.Value(), d.Info.Pmtu)
|
||||
}
|
||||
if int64(d.Info.Lost) != previous.LostPackets.Value() {
|
||||
v := previous.LostPackets.Value()
|
||||
log.Warnf("[SOCKET-DIAGNOSTICS] %q: LOST PACKETS: was %v now %v INCREASE: %v",
|
||||
fullLabel, v, int64(d.Info.Lost), v-int64(d.Info.Lost))
|
||||
}
|
||||
if int64(d.Info.Total_retrans) != previous.TotalRetransPackets.Value() {
|
||||
v := previous.TotalRetransPackets.Value()
|
||||
log.Warnf("[SOCKET-DIAGNOSTICS] %q: total retransmission increase: was %v now %v INCREASE: %v",
|
||||
fullLabel, v, int64(d.Info.Total_retrans), v-int64(d.Info.Total_retrans))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,4 +45,6 @@ func NewTCPInfoExpMaps() *TCPInfoExpMaps {
|
||||
return &TCPInfoExpMaps{}
|
||||
}
|
||||
|
||||
func (d *TCPDiagnostics) LogInteresting(log Logger, fullLabel string, previous *TCPInfoExpMetrics) {}
|
||||
|
||||
// There will be other functions here, as we populate maps.
|
||||
|
||||
Reference in New Issue
Block a user