Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0e07177

Browse files
committed
feat: enable agent connection reports by default, remove flag (#16778)
This change enables agent connection reports by default and removes the experimental flag for enabling them. Updates #15139 (cherry picked from commit dfcd93b)
1 parent 6bc1f95 commit 0e07177

File tree

3 files changed

+5
-29
lines changed

3 files changed

+5
-29
lines changed

agent/agent.go

-5
Original file line numberDiff line numberDiff line change
@@ -783,11 +783,6 @@ const (
783783
)
784784

785785
func (a *agent) reportConnection(id uuid.UUID, connectionType proto.Connection_Type, ip string) (disconnected func(code int, reason string)) {
786-
// If the experiment hasn't been enabled, we don't report connections.
787-
if !a.experimentalConnectionReports {
788-
return func(int, string) {} // Noop.
789-
}
790-
791786
// Remove the port from the IP because ports are not supported in coderd.
792787
if host, _, err := net.SplitHostPort(ip); err != nil {
793788
a.logger.Error(a.hardCtx, "split host and port for connection report failed", slog.F("ip", ip), slog.Error(err))

agent/agent_test.go

+5-18
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,7 @@ func TestAgent_Stats_Magic(t *testing.T) {
169169
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
170170
defer cancel()
171171
//nolint:dogsled
172-
conn, agentClient, stats, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
173-
o.ExperimentalConnectionReports = true
174-
})
172+
conn, agentClient, stats, _, _ := setupAgent(t, agentsdk.Manifest{}, 0)
175173
sshClient, err := conn.SSHClient(ctx)
176174
require.NoError(t, err)
177175
defer sshClient.Close()
@@ -239,9 +237,7 @@ func TestAgent_Stats_Magic(t *testing.T) {
239237
remotePort := sc.Text()
240238

241239
//nolint:dogsled
242-
conn, agentClient, stats, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
243-
o.ExperimentalConnectionReports = true
244-
})
240+
conn, agentClient, stats, _, _ := setupAgent(t, agentsdk.Manifest{}, 0)
245241
sshClient, err := conn.SSHClient(ctx)
246242
require.NoError(t, err)
247243

@@ -956,9 +952,7 @@ func TestAgent_SFTP(t *testing.T) {
956952
home = "/" + strings.ReplaceAll(home, "\\", "/")
957953
}
958954
//nolint:dogsled
959-
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
960-
o.ExperimentalConnectionReports = true
961-
})
955+
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0)
962956
sshClient, err := conn.SSHClient(ctx)
963957
require.NoError(t, err)
964958
defer sshClient.Close()
@@ -994,9 +988,7 @@ func TestAgent_SCP(t *testing.T) {
994988
defer cancel()
995989

996990
//nolint:dogsled
997-
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
998-
o.ExperimentalConnectionReports = true
999-
})
991+
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0)
1000992
sshClient, err := conn.SSHClient(ctx)
1001993
require.NoError(t, err)
1002994
defer sshClient.Close()
@@ -1039,7 +1031,6 @@ func TestAgent_FileTransferBlocked(t *testing.T) {
10391031
//nolint:dogsled
10401032
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
10411033
o.BlockFileTransfer = true
1042-
o.ExperimentalConnectionReports = true
10431034
})
10441035
sshClient, err := conn.SSHClient(ctx)
10451036
require.NoError(t, err)
@@ -1060,7 +1051,6 @@ func TestAgent_FileTransferBlocked(t *testing.T) {
10601051
//nolint:dogsled
10611052
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
10621053
o.BlockFileTransfer = true
1063-
o.ExperimentalConnectionReports = true
10641054
})
10651055
sshClient, err := conn.SSHClient(ctx)
10661056
require.NoError(t, err)
@@ -1089,7 +1079,6 @@ func TestAgent_FileTransferBlocked(t *testing.T) {
10891079
//nolint:dogsled
10901080
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
10911081
o.BlockFileTransfer = true
1092-
o.ExperimentalConnectionReports = true
10931082
})
10941083
sshClient, err := conn.SSHClient(ctx)
10951084
require.NoError(t, err)
@@ -1720,9 +1709,7 @@ func TestAgent_ReconnectingPTY(t *testing.T) {
17201709
defer cancel()
17211710

17221711
//nolint:dogsled
1723-
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
1724-
o.ExperimentalConnectionReports = true
1725-
})
1712+
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0)
17261713
id := uuid.New()
17271714

17281715
// Test that the connection is reported. This must be tested in the

cli/agent.go

-6
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
5454
agentHeaderCommand string
5555
agentHeader []string
5656
devcontainersEnabled bool
57-
58-
experimentalConnectionReports bool
5957
)
6058
cmd := &serpent.Command{
6159
Use: "agent",
@@ -327,10 +325,6 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
327325
containerLister = agentcontainers.NewDocker(execer)
328326
}
329327

330-
if experimentalConnectionReports {
331-
logger.Info(ctx, "experimental connection reports enabled")
332-
}
333-
334328
agnt := agent.New(agent.Options{
335329
Client: client,
336330
Logger: logger,

0 commit comments

Comments
 (0)