@@ -1188,6 +1188,7 @@ func (a *agent) handleReconnectingPTY(ctx context.Context, logger slog.Logger, m
1188
1188
// startReportingConnectionStats runs the connection stats reporting goroutine.
1189
1189
func (a * agent ) startReportingConnectionStats (ctx context.Context ) {
1190
1190
reportStats := func (networkStats map [netlogtype.Connection ]netlogtype.Counts ) {
1191
+ a .logger .Debug (ctx , "computing stats report" )
1191
1192
stats := & agentsdk.Stats {
1192
1193
ConnectionCount : int64 (len (networkStats )),
1193
1194
ConnectionsByProto : map [string ]int64 {},
@@ -1209,6 +1210,7 @@ func (a *agent) startReportingConnectionStats(ctx context.Context) {
1209
1210
stats .SessionCountReconnectingPTY = a .connCountReconnectingPTY .Load ()
1210
1211
1211
1212
// Compute the median connection latency!
1213
+ a .logger .Debug (ctx , "starting peer latency measurement for stats" )
1212
1214
var wg sync.WaitGroup
1213
1215
var mu sync.Mutex
1214
1216
status := a .network .Status ()
@@ -1257,13 +1259,17 @@ func (a *agent) startReportingConnectionStats(ctx context.Context) {
1257
1259
1258
1260
metricsCtx , cancelFunc := context .WithTimeout (ctx , 5 * time .Second )
1259
1261
defer cancelFunc ()
1262
+ a .logger .Debug (ctx , "collecting agent metrics for stats" )
1260
1263
stats .Metrics = a .collectMetrics (metricsCtx )
1261
1264
1262
1265
a .latestStat .Store (stats )
1263
1266
1267
+ a .logger .Debug (ctx , "about to send stats" )
1264
1268
select {
1265
1269
case a .connStatsChan <- stats :
1270
+ a .logger .Debug (ctx , "successfully sent stats" )
1266
1271
case <- a .closed :
1272
+ a .logger .Debug (ctx , "didn't send stats because we are closed" )
1267
1273
}
1268
1274
}
1269
1275
0 commit comments