@@ -22,7 +22,6 @@ import (
2222 "golang.org/x/xerrors"
2323
2424 "cdr.dev/slog"
25-
2625 "github.com/coder/coder/buildinfo"
2726 "github.com/coder/coder/coderd/database"
2827)
@@ -460,6 +459,17 @@ func (r *remoteReporter) createSnapshot() (*Snapshot, error) {
460459 }
461460 return nil
462461 })
462+ eg .Go (func () error {
463+ proxies , err := r .options .Database .GetWorkspaceProxies (ctx )
464+ if err != nil {
465+ return xerrors .Errorf ("get workspace proxies: %w" , err )
466+ }
467+ snapshot .WorkspaceProxies = make ([]WorkspaceProxy , 0 , len (proxies ))
468+ for _ , proxy := range proxies {
469+ snapshot .WorkspaceProxies = append (snapshot .WorkspaceProxies , ConvertWorkspaceProxy (proxy ))
470+ }
471+ return nil
472+ })
463473
464474 err := eg .Wait ()
465475 if err != nil {
@@ -665,6 +675,19 @@ func ConvertLicense(license database.License) License {
665675 }
666676}
667677
678+ // ConvertWorkspaceProxy anonymizes a workspace proxy.
679+ func ConvertWorkspaceProxy (proxy database.WorkspaceProxy ) WorkspaceProxy {
680+ return WorkspaceProxy {
681+ ID : proxy .ID ,
682+ Name : proxy .Name ,
683+ DisplayName : proxy .DisplayName ,
684+ DerpEnabled : proxy .DerpEnabled ,
685+ DerpOnly : proxy .DerpOnly ,
686+ CreatedAt : proxy .CreatedAt ,
687+ UpdatedAt : proxy .UpdatedAt ,
688+ }
689+ }
690+
668691// Snapshot represents a point-in-time anonymized database dump.
669692// Data is aggregated by latest on the server-side, so partial data
670693// can be sent without issue.
@@ -684,6 +707,7 @@ type Snapshot struct {
684707 WorkspaceBuilds []WorkspaceBuild `json:"workspace_build"`
685708 WorkspaceResources []WorkspaceResource `json:"workspace_resources"`
686709 WorkspaceResourceMetadata []WorkspaceResourceMetadata `json:"workspace_resource_metadata"`
710+ WorkspaceProxies []WorkspaceProxy `json:"workspace_proxies"`
687711 CLIInvocations []CLIInvocation `json:"cli_invocations"`
688712}
689713
@@ -872,6 +896,18 @@ type CLIInvocation struct {
872896 InvokedAt time.Time `json:"invoked_at"`
873897}
874898
899+ type WorkspaceProxy struct {
900+ ID uuid.UUID `json:"id"`
901+ Name string `json:"name"`
902+ DisplayName string `json:"display_name"`
903+ // No URLs since we don't send deployment URL.
904+ DerpEnabled bool `json:"derp_enabled"`
905+ DerpOnly bool `json:"derp_only"`
906+ // No Status since it may contain sensitive information.
907+ CreatedAt time.Time `json:"created_at"`
908+ UpdatedAt time.Time `json:"updated_at"`
909+ }
910+
875911type noopReporter struct {}
876912
877913func (* noopReporter ) Report (_ * Snapshot ) {}
0 commit comments