@@ -39,15 +39,18 @@ type Options struct {
39
39
// URL is an endpoint to direct telemetry towards!
40
40
URL * url.URL
41
41
42
- BuiltinPostgres bool
43
- DeploymentID string
44
- GitHubOAuth bool
45
- OIDCAuth bool
46
- OIDCIssuerURL string
47
- Prometheus bool
48
- STUN bool
49
- SnapshotFrequency time.Duration
50
- Tunnel bool
42
+ BuiltinPostgres bool
43
+ DeploymentID string
44
+ GitHubOAuth bool
45
+ OIDCAuth bool
46
+ OIDCIssuerURL string
47
+ Wildcard bool
48
+ DERPServerRelayURL string
49
+ GitAuth []GitAuth
50
+ Prometheus bool
51
+ STUN bool
52
+ SnapshotFrequency time.Duration
53
+ Tunnel bool
51
54
}
52
55
53
56
// New constructs a reporter for telemetry data.
@@ -228,27 +231,30 @@ func (r *remoteReporter) deployment() error {
228
231
containerized = * sysInfo .Containerized
229
232
}
230
233
data , err := json .Marshal (& Deployment {
231
- ID : r .options .DeploymentID ,
232
- Architecture : sysInfo .Architecture ,
233
- BuiltinPostgres : r .options .BuiltinPostgres ,
234
- Containerized : containerized ,
235
- Kubernetes : os .Getenv ("KUBERNETES_SERVICE_HOST" ) != "" ,
236
- GitHubOAuth : r .options .GitHubOAuth ,
237
- OIDCAuth : r .options .OIDCAuth ,
238
- OIDCIssuerURL : r .options .OIDCIssuerURL ,
239
- Prometheus : r .options .Prometheus ,
240
- STUN : r .options .STUN ,
241
- Tunnel : r .options .Tunnel ,
242
- OSType : sysInfo .OS .Type ,
243
- OSFamily : sysInfo .OS .Family ,
244
- OSPlatform : sysInfo .OS .Platform ,
245
- OSName : sysInfo .OS .Name ,
246
- OSVersion : sysInfo .OS .Version ,
247
- CPUCores : runtime .NumCPU (),
248
- MemoryTotal : mem .Total ,
249
- MachineID : sysInfo .UniqueID ,
250
- StartedAt : r .startedAt ,
251
- ShutdownAt : r .shutdownAt ,
234
+ ID : r .options .DeploymentID ,
235
+ Architecture : sysInfo .Architecture ,
236
+ BuiltinPostgres : r .options .BuiltinPostgres ,
237
+ Containerized : containerized ,
238
+ Wildcard : r .options .Wildcard ,
239
+ DERPServerRelayURL : r .options .DERPServerRelayURL ,
240
+ GitAuth : r .options .GitAuth ,
241
+ Kubernetes : os .Getenv ("KUBERNETES_SERVICE_HOST" ) != "" ,
242
+ GitHubOAuth : r .options .GitHubOAuth ,
243
+ OIDCAuth : r .options .OIDCAuth ,
244
+ OIDCIssuerURL : r .options .OIDCIssuerURL ,
245
+ Prometheus : r .options .Prometheus ,
246
+ STUN : r .options .STUN ,
247
+ Tunnel : r .options .Tunnel ,
248
+ OSType : sysInfo .OS .Type ,
249
+ OSFamily : sysInfo .OS .Family ,
250
+ OSPlatform : sysInfo .OS .Platform ,
251
+ OSName : sysInfo .OS .Name ,
252
+ OSVersion : sysInfo .OS .Version ,
253
+ CPUCores : runtime .NumCPU (),
254
+ MemoryTotal : mem .Total ,
255
+ MachineID : sysInfo .UniqueID ,
256
+ StartedAt : r .startedAt ,
257
+ ShutdownAt : r .shutdownAt ,
252
258
})
253
259
if err != nil {
254
260
return xerrors .Errorf ("marshal deployment: %w" , err )
@@ -512,17 +518,28 @@ func ConvertProvisionerJob(job database.ProvisionerJob) ProvisionerJob {
512
518
513
519
// ConvertWorkspaceAgent anonymizes a workspace agent.
514
520
func ConvertWorkspaceAgent (agent database.WorkspaceAgent ) WorkspaceAgent {
515
- return WorkspaceAgent {
516
- ID : agent .ID ,
517
- CreatedAt : agent .CreatedAt ,
518
- ResourceID : agent .ResourceID ,
519
- InstanceAuth : agent .AuthInstanceID .Valid ,
520
- Architecture : agent .Architecture ,
521
- OperatingSystem : agent .OperatingSystem ,
522
- EnvironmentVariables : agent .EnvironmentVariables .Valid ,
523
- StartupScript : agent .StartupScript .Valid ,
524
- Directory : agent .Directory != "" ,
521
+ snapAgent := WorkspaceAgent {
522
+ ID : agent .ID ,
523
+ CreatedAt : agent .CreatedAt ,
524
+ ResourceID : agent .ResourceID ,
525
+ InstanceAuth : agent .AuthInstanceID .Valid ,
526
+ Architecture : agent .Architecture ,
527
+ OperatingSystem : agent .OperatingSystem ,
528
+ EnvironmentVariables : agent .EnvironmentVariables .Valid ,
529
+ StartupScript : agent .StartupScript .Valid ,
530
+ Directory : agent .Directory != "" ,
531
+ ConnectionTimeoutSeconds : agent .ConnectionTimeoutSeconds ,
525
532
}
533
+ if agent .FirstConnectedAt .Valid {
534
+ snapAgent .FirstConnectedAt = & agent .FirstConnectedAt .Time
535
+ }
536
+ if agent .LastConnectedAt .Valid {
537
+ snapAgent .LastConnectedAt = & agent .LastConnectedAt .Time
538
+ }
539
+ if agent .DisconnectedAt .Valid {
540
+ snapAgent .DisconnectedAt = & agent .DisconnectedAt .Time
541
+ }
542
+ return snapAgent
526
543
}
527
544
528
545
// ConvertWorkspaceApp anonymizes a workspace app.
@@ -625,27 +642,34 @@ type Snapshot struct {
625
642
626
643
// Deployment contains information about the host running Coder.
627
644
type Deployment struct {
628
- ID string `json:"id"`
629
- Architecture string `json:"architecture"`
630
- BuiltinPostgres bool `json:"builtin_postgres"`
631
- Containerized bool `json:"containerized"`
632
- Kubernetes bool `json:"kubernetes"`
633
- Tunnel bool `json:"tunnel"`
634
- GitHubOAuth bool `json:"github_oauth"`
635
- OIDCAuth bool `json:"oidc_auth"`
636
- OIDCIssuerURL string `json:"oidc_issuer_url"`
637
- Prometheus bool `json:"prometheus"`
638
- STUN bool `json:"stun"`
639
- OSType string `json:"os_type"`
640
- OSFamily string `json:"os_family"`
641
- OSPlatform string `json:"os_platform"`
642
- OSName string `json:"os_name"`
643
- OSVersion string `json:"os_version"`
644
- CPUCores int `json:"cpu_cores"`
645
- MemoryTotal uint64 `json:"memory_total"`
646
- MachineID string `json:"machine_id"`
647
- StartedAt time.Time `json:"started_at"`
648
- ShutdownAt * time.Time `json:"shutdown_at"`
645
+ ID string `json:"id"`
646
+ Architecture string `json:"architecture"`
647
+ BuiltinPostgres bool `json:"builtin_postgres"`
648
+ Containerized bool `json:"containerized"`
649
+ Kubernetes bool `json:"kubernetes"`
650
+ Tunnel bool `json:"tunnel"`
651
+ Wildcard bool `json:"wildcard"`
652
+ DERPServerRelayURL string `json:"derp_server_relay_url"`
653
+ GitAuth []GitAuth `json:"git_auth"`
654
+ GitHubOAuth bool `json:"github_oauth"`
655
+ OIDCAuth bool `json:"oidc_auth"`
656
+ OIDCIssuerURL string `json:"oidc_issuer_url"`
657
+ Prometheus bool `json:"prometheus"`
658
+ STUN bool `json:"stun"`
659
+ OSType string `json:"os_type"`
660
+ OSFamily string `json:"os_family"`
661
+ OSPlatform string `json:"os_platform"`
662
+ OSName string `json:"os_name"`
663
+ OSVersion string `json:"os_version"`
664
+ CPUCores int `json:"cpu_cores"`
665
+ MemoryTotal uint64 `json:"memory_total"`
666
+ MachineID string `json:"machine_id"`
667
+ StartedAt time.Time `json:"started_at"`
668
+ ShutdownAt * time.Time `json:"shutdown_at"`
669
+ }
670
+
671
+ type GitAuth struct {
672
+ Type string `json:"type"`
649
673
}
650
674
651
675
type APIKey struct {
@@ -682,15 +706,19 @@ type WorkspaceResourceMetadata struct {
682
706
}
683
707
684
708
type WorkspaceAgent struct {
685
- ID uuid.UUID `json:"id"`
686
- CreatedAt time.Time `json:"created_at"`
687
- ResourceID uuid.UUID `json:"resource_id"`
688
- InstanceAuth bool `json:"instance_auth"`
689
- Architecture string `json:"architecture"`
690
- OperatingSystem string `json:"operating_system"`
691
- EnvironmentVariables bool `json:"environment_variables"`
692
- StartupScript bool `json:"startup_script"`
693
- Directory bool `json:"directory"`
709
+ ID uuid.UUID `json:"id"`
710
+ CreatedAt time.Time `json:"created_at"`
711
+ ResourceID uuid.UUID `json:"resource_id"`
712
+ InstanceAuth bool `json:"instance_auth"`
713
+ Architecture string `json:"architecture"`
714
+ OperatingSystem string `json:"operating_system"`
715
+ EnvironmentVariables bool `json:"environment_variables"`
716
+ StartupScript bool `json:"startup_script"`
717
+ Directory bool `json:"directory"`
718
+ FirstConnectedAt * time.Time `json:"first_connected_at"`
719
+ LastConnectedAt * time.Time `json:"last_connected_at"`
720
+ DisconnectedAt * time.Time `json:"disconnected_at"`
721
+ ConnectionTimeoutSeconds int32 `json:"connection_timeout_seconds"`
694
722
}
695
723
696
724
type WorkspaceApp struct {
0 commit comments