Skip to content

Commit

Permalink
feat(NET-1034): add trial data to telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
Aceix committed Mar 4, 2024
1 parent 6f61f8a commit 86fed25
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions logic/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ func sendTelemetry() error {
Set("k8s", d.Count.K8S).
Set("version", d.Version).
Set("is_ee", d.IsPro). // TODO change is_ee to is_pro for consistency, but probably needs changes in posthog
Set("is_free_tier", isFreeTier),
Set("is_free_tier", isFreeTier).
Set("is_pro_trial", d.IsProTrial).
Set("pro_trial_end_date", d.ProTrialEndDate),
})
}

Expand All @@ -87,6 +89,14 @@ func FetchTelemetryData() (telemetryData, error) {
data.Nodes = len(nodes)
data.Count = getClientCount(nodes)
}
endDate, err := GetTrialEndDate()
if err != nil {
logger.Log(0, "error getting trial end date", err.Error())
}
if endDate.After(time.Now()) {
data.IsProTrial = true
data.ProTrialEndDate = endDate
}
return data, err
}

Expand Down Expand Up @@ -162,16 +172,18 @@ func getDBLength(dbname string) int {

// telemetryData - What data to send to posthog
type telemetryData struct {
Nodes int
Hosts int
ExtClients int
Users int
Count clientCount
Networks int
Servers int
Version string
IsPro bool
IsFreeTier bool
Nodes int
Hosts int
ExtClients int
Users int
Count clientCount
Networks int
Servers int
Version string
IsPro bool
IsFreeTier bool
IsProTrial bool
ProTrialEndDate time.Time
}

// clientCount - What types of netclients we're tallying
Expand Down

0 comments on commit 86fed25

Please sign in to comment.