@@ -22,7 +22,6 @@ import (
22
22
"golang.org/x/xerrors"
23
23
24
24
"cdr.dev/slog"
25
-
26
25
"github.com/coder/coder/buildinfo"
27
26
"github.com/coder/coder/coderd/database"
28
27
)
@@ -460,6 +459,17 @@ func (r *remoteReporter) createSnapshot() (*Snapshot, error) {
460
459
}
461
460
return nil
462
461
})
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
+ })
463
473
464
474
err := eg .Wait ()
465
475
if err != nil {
@@ -665,6 +675,19 @@ func ConvertLicense(license database.License) License {
665
675
}
666
676
}
667
677
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
+
668
691
// Snapshot represents a point-in-time anonymized database dump.
669
692
// Data is aggregated by latest on the server-side, so partial data
670
693
// can be sent without issue.
@@ -684,6 +707,7 @@ type Snapshot struct {
684
707
WorkspaceBuilds []WorkspaceBuild `json:"workspace_build"`
685
708
WorkspaceResources []WorkspaceResource `json:"workspace_resources"`
686
709
WorkspaceResourceMetadata []WorkspaceResourceMetadata `json:"workspace_resource_metadata"`
710
+ WorkspaceProxies []WorkspaceProxy `json:"workspace_proxies"`
687
711
CLIInvocations []CLIInvocation `json:"cli_invocations"`
688
712
}
689
713
@@ -872,6 +896,18 @@ type CLIInvocation struct {
872
896
InvokedAt time.Time `json:"invoked_at"`
873
897
}
874
898
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
+
875
911
type noopReporter struct {}
876
912
877
913
func (* noopReporter ) Report (_ * Snapshot ) {}
0 commit comments