Skip to content

Commit e1cd4b7

Browse files
committed
installation-telemetry: switch to custom customerID license field
1 parent b7e4622 commit e1cd4b7

File tree

8 files changed

+19
-9
lines changed

8 files changed

+19
-9
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface TelemetryData {
2828
totalUsers: number;
2929
totalWorkspaces: number;
3030
totalInstances: number;
31-
licenseId?: string;
31+
customerID?: string;
3232
}
3333

3434
export namespace InstallationAdmin {

components/installation-telemetry/cmd/send.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var sendCmd = &cobra.Command{
5858
Set("totalUsers", data.TotalUsers).
5959
Set("totalWorkspaces", data.TotalWorkspaces).
6060
Set("totalInstances", data.TotalInstances).
61-
Set("licenseId", data.LicenseID),
61+
Set("customerID", data.CustomerID),
6262
}
6363

6464
client.Enqueue(telemetry)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type Data struct {
2222
TotalUsers int64 `json:"totalUsers"`
2323
TotalWorkspaces int64 `json:"totalWorkspaces"`
2424
TotalInstances int64 `json:"totalInstances"`
25-
LicenseID string `json:"licenseId,omitempty`
25+
CustomerID string `json:"customerID,omitempty"`
2626
}
2727

2828
type InstallationAdmin struct {

components/licensor/ee/cmd/sign.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ var signCmd = &cobra.Command{
4141
}
4242

4343
var (
44-
domain, _ = cmd.Flags().GetString("domain")
45-
id, _ = cmd.Flags().GetString("id")
46-
level, _ = cmd.Flags().GetString("level")
47-
seats, _ = cmd.Flags().GetInt("seats")
48-
validFor, _ = cmd.Flags().GetDuration("valid-for")
44+
domain, _ = cmd.Flags().GetString("domain")
45+
id, _ = cmd.Flags().GetString("id")
46+
level, _ = cmd.Flags().GetString("level")
47+
seats, _ = cmd.Flags().GetInt("seats")
48+
validFor, _ = cmd.Flags().GetDuration("valid-for")
49+
customerID, _ = cmd.Flags().GetString("customer-id")
4950
)
5051
if domain == "" {
5152
return xerrors.Errorf("--domain is mandatory")
@@ -74,6 +75,7 @@ var signCmd = &cobra.Command{
7475
Seats: seats,
7576
Level: lvl,
7677
ValidUntil: time.Now().Add(validFor),
78+
CustomerID: customerID,
7779
}
7880

7981
res, err := licensor.Sign(l, priv)
@@ -90,6 +92,7 @@ func init() {
9092
rootCmd.AddCommand(signCmd)
9193

9294
signCmd.Flags().String("domain", "", "domain for which the license is valid")
95+
signCmd.Flags().String("customer-id", "", "analytics customer ID")
9396
signCmd.Flags().String("id", "", "ID of the license")
9497
signCmd.Flags().String("level", "enterprise", "license level, must be one of team, enterprise")
9598
signCmd.Flags().Int("seats", 5, "number of seats the license is valid for")

components/licensor/ee/pkg/licensor/licensor.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ type LicensePayload struct {
5353

5454
// Seats == 0 means there's no seat limit
5555
Seats int `json:"seats"`
56+
57+
// CustomerID is used to identify installations in installation analytics
58+
CustomerID string `json:"customerID"`
5659
}
5760

5861
type licensePayload struct {

components/licensor/ee/pkg/licensor/replicated.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ func newReplicatedEvaluator(client *http.Client) (res *Evaluator) {
118118

119119
case "seats":
120120
lic.Seats = int(i.Value.(float64))
121+
122+
case "customerID":
123+
lic.CustomerID = i.Value.(string)
121124
}
122125
}
123126

components/licensor/typescript/ee/src/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export interface LicensePayload {
2929
level: LicenseLevel
3030
validUntil: string
3131
seats: number
32+
customerID: string
3233
}
3334

3435
export enum LicenseSubscriptionLevel {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class InstallationAdminTelemetryDataProvider {
2626
totalUsers: await this.userDb.getUserCount(true),
2727
totalWorkspaces: await this.workspaceDb.getWorkspaceCount(),
2828
totalInstances: await this.workspaceDb.getInstanceCount(),
29-
licenseId: this.licenseEvaluator.getLicenseData().payload.id,
29+
customerID: this.licenseEvaluator.getLicenseData().payload.customerID,
3030
} as TelemetryData;
3131
return data;
3232
} finally {

0 commit comments

Comments
 (0)