Skip to content

Commit 55a5d7a

Browse files
adrientheboroboquat
authored andcommitted
[installation-telemetry] Expose user control over sending customer ID
1 parent 47bf5c5 commit 55a5d7a

File tree

5 files changed

+41
-10
lines changed

5 files changed

+41
-10
lines changed

components/dashboard/src/admin/Settings.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,27 @@ export default function Settings() {
5959
checked={adminSettings?.sendTelemetry ?? false}
6060
onChange={(evt) =>
6161
actuallySetTelemetryPrefs({
62+
...adminSettings,
6263
sendTelemetry: evt.target.checked,
63-
})
64+
} as InstallationAdminSettings)
65+
}
66+
/>
67+
<CheckBox
68+
title="Include customer ID in telemetry"
69+
desc={
70+
<span>
71+
An optional customer ID can be included with telemetry to provide better customer support.{" "}
72+
<a className="gp-link" href="https://www.gitpod.io/privacy">
73+
Read our Privacy Policy
74+
</a>
75+
</span>
76+
}
77+
checked={adminSettings?.sendCustomerID ?? false}
78+
onChange={(evt) =>
79+
actuallySetTelemetryPrefs({
80+
...adminSettings,
81+
sendCustomerID: evt.target.checked,
82+
} as InstallationAdminSettings)
6483
}
6584
/>
6685
<InfoBox>

components/gitpod-protocol/src/installation-admin-protocol.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { v4 as uuidv4 } from "uuid";
88

99
const InstallationAdminSettingsPrototype = {
1010
sendTelemetry: true,
11+
sendCustomerID: true,
1112
};
1213

1314
export type InstallationAdminSettings = typeof InstallationAdminSettingsPrototype;

components/installation-telemetry/cmd/send.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,20 @@ var sendCmd = &cobra.Command{
5050
err = client.Close()
5151
}()
5252

53+
properties := analytics.NewProperties().
54+
Set("version", versionId).
55+
Set("totalUsers", data.TotalUsers).
56+
Set("totalWorkspaces", data.TotalWorkspaces).
57+
Set("totalInstances", data.TotalInstances)
58+
59+
if data.InstallationAdmin.Settings.SendCustomerID {
60+
properties.Set("customerID", data.CustomerID)
61+
}
62+
5363
telemetry := analytics.Track{
54-
UserId: data.InstallationAdmin.ID,
55-
Event: "Installation telemetry",
56-
Properties: analytics.NewProperties().
57-
Set("version", versionId).
58-
Set("totalUsers", data.TotalUsers).
59-
Set("totalWorkspaces", data.TotalWorkspaces).
60-
Set("totalInstances", data.TotalInstances).
61-
Set("licenseType", data.LicenseType),
64+
UserId: data.InstallationAdmin.ID,
65+
Event: "Installation telemetry",
66+
Properties: properties,
6267
}
6368

6469
client.Enqueue(telemetry)

components/installation-telemetry/pkg/server/installationAdmin.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import (
1414
)
1515

1616
type InstallationAdminSettings struct {
17-
SendTelemetry bool `json:"sendTelemetry"`
17+
SendTelemetry bool `json:"sendTelemetry"`
18+
SendCustomerID bool `json:"sendCustomerID"`
1819
}
1920

2021
type Data struct {

components/server/src/installation-admin/telemetry-data-provider.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ export class InstallationAdminTelemetryDataProvider {
2929
licenseType: this.licenseEvaluator.getLicenseData().type,
3030
customerID: this.licenseEvaluator.getLicenseData().payload.customerID,
3131
} as TelemetryData;
32+
33+
if (data.installationAdmin.settings.sendCustomerID) {
34+
data.customerID = this.licenseEvaluator.getLicenseData().payload.customerID;
35+
}
36+
3237
return data;
3338
} finally {
3439
span.finish();

0 commit comments

Comments
 (0)