mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add telemetry support for workspace agent subsystem (#7579)
This commit is contained in:
@@ -62,6 +62,7 @@ type Options struct {
|
||||
IgnorePorts map[int]string
|
||||
SSHMaxTimeout time.Duration
|
||||
TailnetListenPort uint16
|
||||
Subsystem codersdk.AgentSubsystem
|
||||
}
|
||||
|
||||
type Client interface {
|
||||
@@ -119,6 +120,7 @@ func New(options Options) Agent {
|
||||
ignorePorts: options.IgnorePorts,
|
||||
connStatsChan: make(chan *agentsdk.Stats, 1),
|
||||
sshMaxTimeout: options.SSHMaxTimeout,
|
||||
subsystem: options.Subsystem,
|
||||
}
|
||||
a.init(ctx)
|
||||
return a
|
||||
@@ -136,6 +138,7 @@ type agent struct {
|
||||
// listing all listening ports. This is helpful to hide ports that
|
||||
// are used by the agent, that the user does not care about.
|
||||
ignorePorts map[int]string
|
||||
subsystem codersdk.AgentSubsystem
|
||||
|
||||
reconnectingPTYs sync.Map
|
||||
reconnectingPTYTimeout time.Duration
|
||||
@@ -488,6 +491,7 @@ func (a *agent) run(ctx context.Context) error {
|
||||
err = a.client.PostStartup(ctx, agentsdk.PostStartupRequest{
|
||||
Version: buildinfo.Version(),
|
||||
ExpandedDirectory: manifest.Directory,
|
||||
Subsystem: a.subsystem,
|
||||
})
|
||||
if err != nil {
|
||||
return xerrors.Errorf("update workspace agent version: %w", err)
|
||||
@@ -1455,3 +1459,8 @@ func expandDirectory(dir string) (string, error) {
|
||||
}
|
||||
return dir, nil
|
||||
}
|
||||
|
||||
// EnvAgentSubsystem is the environment variable used to denote the
|
||||
// specialized environment in which the agent is running
|
||||
// (e.g. envbox, envbuilder).
|
||||
const EnvAgentSubsystem = "CODER_AGENT_SUBSYSTEM"
|
||||
|
||||
Reference in New Issue
Block a user