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

feat: enable agent connection reports by default, remove flag#16778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletionsagent/agent.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -91,7 +91,6 @@ type Options struct {
Execer agentexec.Execer
ContainerLister agentcontainers.Lister

ExperimentalConnectionReports bool
ExperimentalDevcontainersEnabled bool
}

Expand DownExpand Up@@ -196,7 +195,6 @@ func New(options Options) Agent {
lister: options.ContainerLister,

experimentalDevcontainersEnabled: options.ExperimentalDevcontainersEnabled,
experimentalConnectionReports: options.ExperimentalConnectionReports,
}
// Initially, we have a closed channel, reflecting the fact that we are not initially connected.
// Each time we connect we replace the channel (while holding the closeMutex) with a new one
Expand DownExpand Up@@ -273,7 +271,6 @@ type agent struct {
lister agentcontainers.Lister

experimentalDevcontainersEnabled bool
experimentalConnectionReports bool
}

func (a *agent) TailnetConn() *tailnet.Conn {
Expand DownExpand Up@@ -797,11 +794,6 @@ const (
)

func (a *agent) reportConnection(id uuid.UUID, connectionType proto.Connection_Type, ip string) (disconnected func(code int, reason string)) {
// If the experiment hasn't been enabled, we don't report connections.
if !a.experimentalConnectionReports {
return func(int, string) {} // Noop.
}

// Remove the port from the IP because ports are not supported in coderd.
if host, _, err := net.SplitHostPort(ip); err != nil {
a.logger.Error(a.hardCtx, "split host and port for connection report failed", slog.F("ip", ip), slog.Error(err))
Expand Down
23 changes: 5 additions & 18 deletionsagent/agent_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -173,9 +173,7 @@ func TestAgent_Stats_Magic(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancel()
//nolint:dogsled
conn, agentClient, stats, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
o.ExperimentalConnectionReports = true
})
conn, agentClient, stats, _, _ := setupAgent(t, agentsdk.Manifest{}, 0)
sshClient, err := conn.SSHClient(ctx)
require.NoError(t, err)
defer sshClient.Close()
Expand DownExpand Up@@ -243,9 +241,7 @@ func TestAgent_Stats_Magic(t *testing.T) {
remotePort := sc.Text()

//nolint:dogsled
conn, agentClient, stats, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
o.ExperimentalConnectionReports = true
})
conn, agentClient, stats, _, _ := setupAgent(t, agentsdk.Manifest{}, 0)
sshClient, err := conn.SSHClient(ctx)
require.NoError(t, err)

Expand DownExpand Up@@ -960,9 +956,7 @@ func TestAgent_SFTP(t *testing.T) {
home = "/" + strings.ReplaceAll(home, "\\", "/")
}
//nolint:dogsled
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
o.ExperimentalConnectionReports = true
})
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0)
sshClient, err := conn.SSHClient(ctx)
require.NoError(t, err)
defer sshClient.Close()
Expand DownExpand Up@@ -998,9 +992,7 @@ func TestAgent_SCP(t *testing.T) {
defer cancel()

//nolint:dogsled
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
o.ExperimentalConnectionReports = true
})
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0)
sshClient, err := conn.SSHClient(ctx)
require.NoError(t, err)
defer sshClient.Close()
Expand DownExpand Up@@ -1043,7 +1035,6 @@ func TestAgent_FileTransferBlocked(t *testing.T) {
//nolint:dogsled
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
o.BlockFileTransfer = true
o.ExperimentalConnectionReports = true
})
sshClient, err := conn.SSHClient(ctx)
require.NoError(t, err)
Expand All@@ -1064,7 +1055,6 @@ func TestAgent_FileTransferBlocked(t *testing.T) {
//nolint:dogsled
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
o.BlockFileTransfer = true
o.ExperimentalConnectionReports = true
})
sshClient, err := conn.SSHClient(ctx)
require.NoError(t, err)
Expand DownExpand Up@@ -1093,7 +1083,6 @@ func TestAgent_FileTransferBlocked(t *testing.T) {
//nolint:dogsled
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
o.BlockFileTransfer = true
o.ExperimentalConnectionReports = true
})
sshClient, err := conn.SSHClient(ctx)
require.NoError(t, err)
Expand DownExpand Up@@ -1724,9 +1713,7 @@ func TestAgent_ReconnectingPTY(t *testing.T) {
defer cancel()

//nolint:dogsled
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
o.ExperimentalConnectionReports = true
})
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0)
id := uuid.New()

// Test that the connection is reported. This must be tested in the
Expand Down
14 changes: 0 additions & 14 deletionscli/agent.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -54,7 +54,6 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
agentHeaderCommand string
agentHeader []string

experimentalConnectionReports bool
experimentalDevcontainersEnabled bool
)
cmd := &serpent.Command{
Expand DownExpand Up@@ -327,10 +326,6 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
containerLister = agentcontainers.NewDocker(execer)
}

if experimentalConnectionReports {
logger.Info(ctx, "experimental connection reports enabled")
}

agnt := agent.New(agent.Options{
Client: client,
Logger: logger,
Expand DownExpand Up@@ -359,7 +354,6 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
ContainerLister: containerLister,

ExperimentalDevcontainersEnabled: experimentalDevcontainersEnabled,
ExperimentalConnectionReports: experimentalConnectionReports,
})

promHandler := agent.PrometheusMetricsHandler(prometheusRegistry, logger)
Expand DownExpand Up@@ -489,14 +483,6 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
Description: "Allow the agent to automatically detect running devcontainers.",
Value: serpent.BoolOf(&experimentalDevcontainersEnabled),
},
{
Flag: "experimental-connection-reports-enable",
Hidden: true,
Default: "false",
Env: "CODER_AGENT_EXPERIMENTAL_CONNECTION_REPORTS_ENABLE",
Description: "Enable experimental connection reports.",
Value: serpent.BoolOf(&experimentalConnectionReports),
},
}

return cmd
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp