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

Commitd83f4eb

Browse files
authored
fix: stop activity bump if no tracked sessions (#15237)
Part of#15176I originally kept this the same because I wanted to be conservativeabout when we start dropping activity, but this is proving to be aproblem when using `coder ssh` with `--usage-app=disabled`. Because theworkspace agent still counts this as a connection (I think it stillshould so it's counted somewhere) but not as a SSH / IDE session. Thisleads to background ssh tasks that want to be untracked still continuingto bump activity when it shouldn't. This makes it so we have to have anexplicit session to bump activity.
1 parentceb168b commitd83f4eb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎coderd/workspacestats/reporter.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ func (r *Reporter) ReportAppStats(ctx context.Context, stats []workspaceapps.Sta
117117
returnnil
118118
}
119119

120+
// nolint:revive // usage is a control flag while we have the experiment
120121
func (r*Reporter)ReportAgentStats(ctx context.Context,now time.Time,workspace database.Workspace,workspaceAgent database.WorkspaceAgent,templateNamestring,stats*agentproto.Stats,usagebool)error {
121122
// update agent stats
122123
r.opts.StatsBatcher.Add(now,workspaceAgent.ID,workspace.TemplateID,workspace.OwnerID,workspace.ID,stats,usage)
@@ -136,8 +137,13 @@ func (r *Reporter) ReportAgentStats(ctx context.Context, now time.Time, workspac
136137
},stats.Metrics)
137138
}
138139

139-
// if no active connections we do not bump activity
140-
ifstats.ConnectionCount==0 {
140+
// workspace activity: if no sessions we do not bump activity
141+
ifusage&&stats.SessionCountVscode==0&&stats.SessionCountJetbrains==0&&stats.SessionCountReconnectingPty==0&&stats.SessionCountSsh==0 {
142+
returnnil
143+
}
144+
145+
// legacy stats: if no active connections we do not bump activity
146+
if!usage&&stats.ConnectionCount==0 {
141147
returnnil
142148
}
143149

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp