Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4071f17

Browse files
authored
feat: add logging to agent stats and JetBrains tracking (#11364)
Adds logging so we can hope to diagnose#11363
1 parent893a8ea commit4071f17

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

‎agent/agent.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,7 @@ func (a *agent) handleReconnectingPTY(ctx context.Context, logger slog.Logger, m
11881188
// startReportingConnectionStats runs the connection stats reporting goroutine.
11891189
func (a*agent)startReportingConnectionStats(ctx context.Context) {
11901190
reportStats:=func(networkStatsmap[netlogtype.Connection]netlogtype.Counts) {
1191+
a.logger.Debug(ctx,"computing stats report")
11911192
stats:=&agentsdk.Stats{
11921193
ConnectionCount:int64(len(networkStats)),
11931194
ConnectionsByProto:map[string]int64{},
@@ -1209,6 +1210,7 @@ func (a *agent) startReportingConnectionStats(ctx context.Context) {
12091210
stats.SessionCountReconnectingPTY=a.connCountReconnectingPTY.Load()
12101211

12111212
// Compute the median connection latency!
1213+
a.logger.Debug(ctx,"starting peer latency measurement for stats")
12121214
varwg sync.WaitGroup
12131215
varmu sync.Mutex
12141216
status:=a.network.Status()
@@ -1257,13 +1259,17 @@ func (a *agent) startReportingConnectionStats(ctx context.Context) {
12571259

12581260
metricsCtx,cancelFunc:=context.WithTimeout(ctx,5*time.Second)
12591261
defercancelFunc()
1262+
a.logger.Debug(ctx,"collecting agent metrics for stats")
12601263
stats.Metrics=a.collectMetrics(metricsCtx)
12611264

12621265
a.latestStat.Store(stats)
12631266

1267+
a.logger.Debug(ctx,"about to send stats")
12641268
select {
12651269
casea.connStatsChan<-stats:
1270+
a.logger.Debug(ctx,"successfully sent stats")
12661271
case<-a.closed:
1272+
a.logger.Debug(ctx,"didn't send stats because we are closed")
12671273
}
12681274
}
12691275

‎agent/agentssh/jetbrainstrack.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package agentssh
22

33
import (
4+
"context"
45
"strings"
56
"sync"
67

@@ -26,6 +27,7 @@ type localForwardChannelData struct {
2627
typeJetbrainsChannelWatcherstruct {
2728
gossh.NewChannel
2829
jetbrainsCounter*atomic.Int64
30+
logger slog.Logger
2931
}
3032

3133
funcNewJetbrainsChannelWatcher(ctx ssh.Context,logger slog.Logger,newChannel gossh.NewChannel,counter*atomic.Int64) gossh.NewChannel {
@@ -58,6 +60,7 @@ func NewJetbrainsChannelWatcher(ctx ssh.Context, logger slog.Logger, newChannel
5860
return&JetbrainsChannelWatcher{
5961
NewChannel:newChannel,
6062
jetbrainsCounter:counter,
63+
logger:logger.With(slog.F("destination_port",d.DestPort)),
6164
}
6265
}
6366

@@ -67,11 +70,15 @@ func (w *JetbrainsChannelWatcher) Accept() (gossh.Channel, <-chan *gossh.Request
6770
returnc,r,err
6871
}
6972
w.jetbrainsCounter.Add(1)
73+
// nolint: gocritic // JetBrains is a proper noun and should be capitalized
74+
w.logger.Debug(context.Background(),"JetBrains watcher accepted channel")
7075

7176
return&ChannelOnClose{
7277
Channel:c,
7378
done:func() {
7479
w.jetbrainsCounter.Add(-1)
80+
// nolint: gocritic // JetBrains is a proper noun and should be capitalized
81+
w.logger.Debug(context.Background(),"JetBrains watcher channel closed")
7582
},
7683
},r,err
7784
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp