diff --git a/cli/agent.go b/cli/agent.go index 56a8720a4116f..f46dbc52a0cb1 100644 --- a/cli/agent.go +++ b/cli/agent.go @@ -59,6 +59,7 @@ func workspaceAgent() *serpent.Command { devcontainerDiscoveryAutostart bool socketServerEnabled bool socketPath string + reportMetadataInterval time.Duration ) agentAuth := &AgentAuth{} cmd := &serpent.Command{ @@ -319,8 +320,9 @@ func workspaceAgent() *serpent.Command { agentcontainers.WithProjectDiscovery(devcontainerProjectDiscovery), agentcontainers.WithDiscoveryAutostart(devcontainerDiscoveryAutostart), }, - SocketPath: socketPath, - SocketServerEnabled: socketServerEnabled, + SocketPath: socketPath, + SocketServerEnabled: socketServerEnabled, + ReportMetadataInterval: reportMetadataInterval, }) if debugAddress != "" { @@ -494,6 +496,13 @@ func workspaceAgent() *serpent.Command { Description: "Specify the path for the agent socket.", Value: serpent.StringOf(&socketPath), }, + { + Flag: "report-metadata-interval", + Default: "1s", + Env: "CODER_AGENT_REPORT_METADATA_INTERVAL", + Description: "The interval at which the agent reports metadata to the Coder server. Lower values result in more frequent updates but higher database load.", + Value: serpent.DurationOf(&reportMetadataInterval), + }, } agentAuth.AttachOptions(cmd, false) return cmd diff --git a/cli/testdata/coder_agent_--help.golden b/cli/testdata/coder_agent_--help.golden index d262c0d0c7618..5a0e05c276d2b 100644 --- a/cli/testdata/coder_agent_--help.golden +++ b/cli/testdata/coder_agent_--help.golden @@ -64,6 +64,10 @@ OPTIONS: --prometheus-address string, $CODER_AGENT_PROMETHEUS_ADDRESS (default: 127.0.0.1:2112) The bind address to serve Prometheus metrics. + --report-metadata-interval duration, $CODER_AGENT_REPORT_METADATA_INTERVAL (default: 1s) + The interval at which the agent reports metadata to the Coder server. + Lower values result in more frequent updates but higher database load. + --script-data-dir string, $CODER_AGENT_SCRIPT_DATA_DIR (default: /tmp) Specify the location for storing script data.