feat(agent): add connection reporting for SSH and reconnecting PTY (#16652)

Updates #15139
This commit is contained in:
Mathias Fredriksson
2025-02-27 10:45:45 +00:00
committed by GitHub
parent 6dd51f92fb
commit 4ba5a8a2ba
7 changed files with 382 additions and 32 deletions
+15
View File
@@ -54,6 +54,8 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
agentHeaderCommand string
agentHeader []string
devcontainersEnabled bool
experimentalConnectionReports bool
)
cmd := &serpent.Command{
Use: "agent",
@@ -325,6 +327,10 @@ 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,
@@ -353,6 +359,7 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
ContainerLister: containerLister,
ExperimentalContainersEnabled: devcontainersEnabled,
ExperimentalConnectionReports: experimentalConnectionReports,
})
promHandler := agent.PrometheusMetricsHandler(prometheusRegistry, logger)
@@ -482,6 +489,14 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
Description: "Allow the agent to automatically detect running devcontainers.",
Value: serpent.BoolOf(&devcontainersEnabled),
},
{
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