From 1f64b36221fb44d1338e2be8fc569ee3a0da6ce1 Mon Sep 17 00:00:00 2001 From: John Dietz Date: Sat, 18 Nov 2023 15:19:12 -0500 Subject: [PATCH 1/3] k3d client telemetry fix --- internal/segment/segment.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/segment/segment.go b/internal/segment/segment.go index d4b1808e3..26e52bd34 100644 --- a/internal/segment/segment.go +++ b/internal/segment/segment.go @@ -12,7 +12,7 @@ import ( ) const ( - kubefirstClient string = "api" + kubefirstClient string = "cli" ) func InitClient(clusterId, clusterType, gitProvider string) *telemetry.SegmentClient { @@ -28,7 +28,7 @@ func InitClient(clusterId, clusterType, gitProvider string) *telemetry.SegmentCl ClusterType: clusterType, DomainName: k3d.DomainName, GitProvider: gitProvider, - InstallMethod: "kubefirst-launch", + InstallMethod: "k3d", KubefirstClient: kubefirstClient, KubefirstTeam: os.Getenv("KUBEFIRST_TEAM"), KubefirstTeamInfo: os.Getenv("KUBEFIRST_TEAM_INFO"), From a74310ef8e5ec3c4d2eb49fae3e37cf6f17e0276 Mon Sep 17 00:00:00 2001 From: John Dietz Date: Mon, 27 Nov 2023 15:39:35 -0500 Subject: [PATCH 2/3] adjustments for telemetry --- cmd/k3d/create.go | 4 +--- internal/segment/segment.go | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/k3d/create.go b/cmd/k3d/create.go index e659a6252..c82c9e3d2 100644 --- a/cmd/k3d/create.go +++ b/cmd/k3d/create.go @@ -329,7 +329,7 @@ func runK3d(cmd *cobra.Command, args []string) error { segClient := segment.InitClient(clusterId, clusterTypeFlag, gitProviderFlag) defer segClient.Client.Close() - telemetry.SendEvent(segClient, telemetry.ClusterInstallStarted, "") + //telemetry.SendEvent(segClient, telemetry.ClusterInstallStarted, "") // Progress output progressPrinter.AddTracker("preflight-checks", "Running preflight checks", 5) @@ -462,7 +462,6 @@ func runK3d(cmd *cobra.Command, args []string) error { log.Info().Msg("validation and kubefirst cli environment check is complete") - telemetry.SendEvent(segClient, telemetry.InitCompleted, "") telemetry.SendEvent(segClient, telemetry.InitCompleted, "") // Swap tokens for git protocol @@ -1412,7 +1411,6 @@ func runK3d(cmd *cobra.Command, args []string) error { } // Mark cluster install as complete - telemetry.SendEvent(segClient, telemetry.ClusterInstallCompleted, "") viper.Set("kubefirst-checks.cluster-install-complete", true) viper.WriteConfig() diff --git a/internal/segment/segment.go b/internal/segment/segment.go index 26e52bd34..9644d3dac 100644 --- a/internal/segment/segment.go +++ b/internal/segment/segment.go @@ -33,9 +33,10 @@ func InitClient(clusterId, clusterType, gitProvider string) *telemetry.SegmentCl KubefirstTeam: os.Getenv("KUBEFIRST_TEAM"), KubefirstTeamInfo: os.Getenv("KUBEFIRST_TEAM_INFO"), MachineID: machineID, + ParentClusterId: clusterId, ErrorMessage: "", UserId: machineID, - MetricName: telemetry.ClusterInstallStarted, + MetricName: telemetry.ClusterInstallCompleted, }, Client: sc, } From 93e85630236d58ed677a342cf5b62694f0c19dd3 Mon Sep 17 00:00:00 2001 From: John Dietz Date: Mon, 27 Nov 2023 15:42:55 -0500 Subject: [PATCH 3/3] remove unused event --- cmd/k3d/create.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/k3d/create.go b/cmd/k3d/create.go index c82c9e3d2..1ce042826 100644 --- a/cmd/k3d/create.go +++ b/cmd/k3d/create.go @@ -329,7 +329,6 @@ func runK3d(cmd *cobra.Command, args []string) error { segClient := segment.InitClient(clusterId, clusterTypeFlag, gitProviderFlag) defer segClient.Client.Close() - //telemetry.SendEvent(segClient, telemetry.ClusterInstallStarted, "") // Progress output progressPrinter.AddTracker("preflight-checks", "Running preflight checks", 5)