From a9762be8c43307fc0c170cfdfa5844bb14b80ad2 Mon Sep 17 00:00:00 2001 From: Derrick Hawkins Date: Mon, 11 Dec 2023 13:11:21 -0800 Subject: [PATCH] return telemetry event --- internal/segment/segment.go | 40 ++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/internal/segment/segment.go b/internal/segment/segment.go index d4b1808e3..e13bab385 100644 --- a/internal/segment/segment.go +++ b/internal/segment/segment.go @@ -7,38 +7,32 @@ import ( "github.com/kubefirst/kubefirst/configs" "github.com/kubefirst/metrics-client/pkg/telemetry" "github.com/kubefirst/runtime/pkg/k3d" - - "github.com/segmentio/analytics-go" ) const ( kubefirstClient string = "api" ) -func InitClient(clusterId, clusterType, gitProvider string) *telemetry.SegmentClient { +func InitClient(clusterId, clusterType, gitProvider string) telemetry.TelemetryEvent { machineID, _ := machineid.ID() - sc := analytics.New(telemetry.SegmentIOWriteKey) - c := telemetry.SegmentClient{ - TelemetryEvent: telemetry.TelemetryEvent{ - CliVersion: configs.K1Version, - CloudProvider: k3d.CloudProvider, - ClusterID: clusterId, - ClusterType: clusterType, - DomainName: k3d.DomainName, - GitProvider: gitProvider, - InstallMethod: "kubefirst-launch", - KubefirstClient: kubefirstClient, - KubefirstTeam: os.Getenv("KUBEFIRST_TEAM"), - KubefirstTeamInfo: os.Getenv("KUBEFIRST_TEAM_INFO"), - MachineID: machineID, - ErrorMessage: "", - UserId: machineID, - MetricName: telemetry.ClusterInstallStarted, - }, - Client: sc, + c := telemetry.TelemetryEvent{ + CliVersion: configs.K1Version, + CloudProvider: k3d.CloudProvider, + ClusterID: clusterId, + ClusterType: clusterType, + DomainName: k3d.DomainName, + GitProvider: gitProvider, + InstallMethod: "kubefirst-launch", + KubefirstClient: kubefirstClient, + KubefirstTeam: os.Getenv("KUBEFIRST_TEAM"), + KubefirstTeamInfo: os.Getenv("KUBEFIRST_TEAM_INFO"), + MachineID: machineID, + ErrorMessage: "", + MetricName: telemetry.ClusterInstallStarted, + UserId: machineID, } - return &c + return c }