MCPcopy Index your code
hub / github.com/coder/coder / ConvertWorkspaceAgent

Function ConvertWorkspaceAgent

coderd/telemetry/telemetry.go:1204–1232  ·  view source on GitHub ↗

ConvertWorkspaceAgent anonymizes a workspace agent.

(agent database.WorkspaceAgent)

Source from the content-addressed store, hash-verified

1202
1203// ConvertWorkspaceAgent anonymizes a workspace agent.
1204func ConvertWorkspaceAgent(agent database.WorkspaceAgent) WorkspaceAgent {
1205 subsystems := []string{}
1206 for _, subsystem := range agent.Subsystems {
1207 subsystems = append(subsystems, string(subsystem))
1208 }
1209
1210 snapAgent := WorkspaceAgent{
1211 ID: agent.ID,
1212 CreatedAt: agent.CreatedAt,
1213 ResourceID: agent.ResourceID,
1214 InstanceAuth: agent.AuthInstanceID.Valid,
1215 Architecture: agent.Architecture,
1216 OperatingSystem: agent.OperatingSystem,
1217 EnvironmentVariables: agent.EnvironmentVariables.Valid,
1218 Directory: agent.Directory != "",
1219 ConnectionTimeoutSeconds: agent.ConnectionTimeoutSeconds,
1220 Subsystems: subsystems,
1221 }
1222 if agent.FirstConnectedAt.Valid {
1223 snapAgent.FirstConnectedAt = &agent.FirstConnectedAt.Time
1224 }
1225 if agent.LastConnectedAt.Valid {
1226 snapAgent.LastConnectedAt = &agent.LastConnectedAt.Time
1227 }
1228 if agent.DisconnectedAt.Valid {
1229 snapAgent.DisconnectedAt = &agent.DisconnectedAt.Time
1230 }
1231 return snapAgent
1232}
1233
1234func ConvertWorkspaceAgentMemoryResourceMonitor(monitor database.WorkspaceAgentMemoryResourceMonitor) WorkspaceAgentMemoryResourceMonitor {
1235 return WorkspaceAgentMemoryResourceMonitor{

Callers 2

InsertWorkspaceResourceFunction · 0.92
createSnapshotMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected