From b507f367a3165847ae494ef0e7423080508d0262 Mon Sep 17 00:00:00 2001 From: Ian Edwards Date: Fri, 22 Sep 2023 15:50:03 -0400 Subject: [PATCH] track events with validate apply v2 ff --- api/server/handlers/porter_app/analytics.go | 6 +++ internal/analytics/tracks.go | 58 ++++++++++++--------- 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/api/server/handlers/porter_app/analytics.go b/api/server/handlers/porter_app/analytics.go index e198b5de0f..be9e4e57ce 100644 --- a/api/server/handlers/porter_app/analytics.go +++ b/api/server/handlers/porter_app/analytics.go @@ -35,6 +35,7 @@ func (v *PorterAppAnalyticsHandler) ServeHTTP(w http.ResponseWriter, r *http.Req return } + validateApplyV2 := project.GetFeatureFlag(models.ValidateApplyV2, v.Config().LaunchDarklyClient) if request.Step == "stack-launch-start" { v.Config().AnalyticsClient.Track(analytics.StackLaunchStartTrack(&analytics.StackLaunchStartOpts{ ProjectScopedTrackOpts: analytics.GetProjectScopedTrackOpts(user.ID, project.ID), @@ -42,6 +43,7 @@ func (v *PorterAppAnalyticsHandler) ServeHTTP(w http.ResponseWriter, r *http.Req FirstName: user.FirstName, LastName: user.LastName, CompanyName: user.CompanyName, + ValidateApplyV2: validateApplyV2, })) } @@ -53,6 +55,7 @@ func (v *PorterAppAnalyticsHandler) ServeHTTP(w http.ResponseWriter, r *http.Req FirstName: user.FirstName, LastName: user.LastName, CompanyName: user.CompanyName, + ValidateApplyV2: validateApplyV2, })) } @@ -64,6 +67,7 @@ func (v *PorterAppAnalyticsHandler) ServeHTTP(w http.ResponseWriter, r *http.Req FirstName: user.FirstName, LastName: user.LastName, CompanyName: user.CompanyName, + ValidateApplyV2: validateApplyV2, })) } @@ -76,6 +80,7 @@ func (v *PorterAppAnalyticsHandler) ServeHTTP(w http.ResponseWriter, r *http.Req LastName: user.LastName, CompanyName: user.CompanyName, ErrorMessage: request.ErrorMessage, + ValidateApplyV2: validateApplyV2, })) } @@ -88,6 +93,7 @@ func (v *PorterAppAnalyticsHandler) ServeHTTP(w http.ResponseWriter, r *http.Req LastName: user.LastName, CompanyName: user.CompanyName, DeleteWorkflowFile: request.DeleteWorkflowFile, + ValidateApplyV2: validateApplyV2, })) } diff --git a/internal/analytics/tracks.go b/internal/analytics/tracks.go index edb338dbcb..68683d64ec 100644 --- a/internal/analytics/tracks.go +++ b/internal/analytics/tracks.go @@ -783,10 +783,11 @@ func ClusterDestroyingSuccessTrack(opts *ClusterDestroyingSuccessTrackOpts) segm type StackLaunchStartOpts struct { *ProjectScopedTrackOpts - Email string - FirstName string - LastName string - CompanyName string + Email string + FirstName string + LastName string + CompanyName string + ValidateApplyV2 bool } // StackLaunchStartTrack returns a track for when a user starts creating a stack @@ -806,11 +807,12 @@ func StackLaunchStartTrack(opts *StackLaunchStartOpts) segmentTrack { type StackLaunchCompleteOpts struct { *ProjectScopedTrackOpts - StackName string - Email string - FirstName string - LastName string - CompanyName string + StackName string + Email string + FirstName string + LastName string + CompanyName string + ValidateApplyV2 bool } // StackLaunchCompleteTrack returns a track for when a user completes creating a stack @@ -831,11 +833,12 @@ func StackLaunchCompleteTrack(opts *StackLaunchCompleteOpts) segmentTrack { type StackLaunchSuccessOpts struct { *ProjectScopedTrackOpts - StackName string - Email string - FirstName string - LastName string - CompanyName string + StackName string + Email string + FirstName string + LastName string + CompanyName string + ValidateApplyV2 bool } // StackLaunchCompleteTrack returns a track for when a user completes creating a stack @@ -856,12 +859,13 @@ func StackLaunchSuccessTrack(opts *StackLaunchSuccessOpts) segmentTrack { type StackLaunchFailureOpts struct { *ProjectScopedTrackOpts - StackName string - Email string - FirstName string - LastName string - CompanyName string - ErrorMessage string + StackName string + Email string + FirstName string + LastName string + CompanyName string + ErrorMessage string + ValidateApplyV2 bool } // StackLaunchFailureTrack returns a track for when a user fails creating a stack @@ -889,6 +893,7 @@ type StackDeletionOpts struct { LastName string CompanyName string DeleteWorkflowFile bool + ValidateApplyV2 bool } // StackDeletionTrack returns a track for when a user deletes a stack @@ -910,12 +915,13 @@ func StackDeletionTrack(opts *StackDeletionOpts) segmentTrack { type StackBuildOpts struct { *ProjectScopedTrackOpts - StackName string - ErrorMessage string - Email string - FirstName string - LastName string - CompanyName string + StackName string + ErrorMessage string + Email string + FirstName string + LastName string + CompanyName string + ValidateApplyV2 bool } // StackBuildFailureTrack returns a track for when a stack fails to build