From c022f1bb1e28da6ffb5c6a7f035444a4acff972c Mon Sep 17 00:00:00 2001 From: Jordan Ribbink Date: Mon, 16 Dec 2024 13:05:09 -0800 Subject: [PATCH 1/2] Add network to mixpanel metrics --- internal/command/command.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/command/command.go b/internal/command/command.go index 38cc16a38..a9bbbec0f 100644 --- a/internal/command/command.go +++ b/internal/command/command.go @@ -378,10 +378,16 @@ func UsageMetrics(command *cobra.Command, wg *sync.WaitGroup) { hash := sha256.Sum256([]byte(fmt.Sprintf("%s%s", usr.Username, usr.Uid))) userID := base64.StdEncoding.EncodeToString(hash[:]) + network := Flags.Network + if network == "" { + network = config.EmulatorNetwork.Name + } + _ = client.Track(userID, "cli-command", &mixpanel.Event{ IP: "0", // do not track IPs Properties: map[string]any{ "command": command.CommandPath(), + "network": network, "version": build.Semver(), "os": runtime.GOOS, }, From e02d00f7c0213adbef1d38d2aaa0533c570a7c96 Mon Sep 17 00:00:00 2001 From: Jordan Ribbink Date: Mon, 16 Dec 2024 13:11:01 -0800 Subject: [PATCH 2/2] fix --- internal/command/command.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/internal/command/command.go b/internal/command/command.go index a9bbbec0f..035faabcd 100644 --- a/internal/command/command.go +++ b/internal/command/command.go @@ -378,16 +378,11 @@ func UsageMetrics(command *cobra.Command, wg *sync.WaitGroup) { hash := sha256.Sum256([]byte(fmt.Sprintf("%s%s", usr.Username, usr.Uid))) userID := base64.StdEncoding.EncodeToString(hash[:]) - network := Flags.Network - if network == "" { - network = config.EmulatorNetwork.Name - } - _ = client.Track(userID, "cli-command", &mixpanel.Event{ IP: "0", // do not track IPs Properties: map[string]any{ "command": command.CommandPath(), - "network": network, + "network": Flags.Network, "version": build.Semver(), "os": runtime.GOOS, },