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:
@@ -220,6 +220,7 @@ func (api *API) postWorkspaceAgentStartup(rw http.ResponseWriter, r *http.Reques
|
||||
ID: apiAgent.ID,
|
||||
Version: req.Version,
|
||||
ExpandedDirectory: req.ExpandedDirectory,
|
||||
Subsystem: convertWorkspaceAgentSubsystem(req.Subsystem),
|
||||
}); err != nil {
|
||||
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
|
||||
Message: "Error setting agent version",
|
||||
@@ -1129,6 +1130,7 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator tailnet.Coordin
|
||||
StartupScriptTimeoutSeconds: dbAgent.StartupScriptTimeoutSeconds,
|
||||
ShutdownScript: dbAgent.ShutdownScript.String,
|
||||
ShutdownScriptTimeoutSeconds: dbAgent.ShutdownScriptTimeoutSeconds,
|
||||
Subsystem: codersdk.AgentSubsystem(dbAgent.Subsystem),
|
||||
}
|
||||
node := coordinator.Node(dbAgent.ID)
|
||||
if node != nil {
|
||||
@@ -1983,3 +1985,12 @@ func convertWorkspaceAgentStartupLog(logEntry database.WorkspaceAgentStartupLog)
|
||||
Level: codersdk.LogLevel(logEntry.Level),
|
||||
}
|
||||
}
|
||||
|
||||
func convertWorkspaceAgentSubsystem(ss codersdk.AgentSubsystem) database.WorkspaceAgentSubsystem {
|
||||
switch ss {
|
||||
case codersdk.AgentSubsystemEnvbox:
|
||||
return database.WorkspaceAgentSubsystemEnvbox
|
||||
default:
|
||||
return database.WorkspaceAgentSubsystemNone
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user