Skip to content

Commit

Permalink
sync command: Send Chrome version to metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrunwald committed Sep 15, 2024
1 parent a79b598 commit 71bc43b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,7 @@ func runSyncCommandLogic(p *tea.Program, logger *slog.Logger, config *syncComman
})

p.Send(buchhalterMetricsRecord{
CliVersion: cliVersion,
// TODO Send ChromeVersion (not available in this scope)
// ChromeVersion: ChromeVersion,
CliVersion: cliVersion,
VaultVersion: vaultProvider.Version,
OicdbVersion: recipeParser.OicdbVersion,
})
Expand Down Expand Up @@ -419,6 +417,11 @@ func runSyncCommandLogic(p *tea.Program, logger *slog.Logger, config *syncComman
// In case of an external abort signal (e.g. CTRL+C), bubbletea will call `chromedp.Cancel()`.
}

// Send ChromeVersion into metrics
if len(ChromeVersion) > 0 {
p.Send(buchhalterMetricsRecord{ChromeVersion: ChromeVersion})
}

// TODO recipeResult can be empty! (not nil, but without values)

rdx := repository.RunDataSupplier{
Expand Down Expand Up @@ -605,8 +608,8 @@ func prepareRecipes(logger *slog.Logger, supplier string, vaultProvider *vault.P
return r, nil
}

func sendMetrics(buchhalterAPIClient *repository.BuchhalterAPIClient, a bool, cliVersion, ChromeVersion, vaultVersion, oicdbVersion string) error {
err := buchhalterAPIClient.SendMetrics(RunData, cliVersion, ChromeVersion, vaultVersion, oicdbVersion)
func sendMetrics(buchhalterAPIClient *repository.BuchhalterAPIClient, a bool, cliVersion, chromeVersion, vaultVersion, oicdbVersion string) error {
err := buchhalterAPIClient.SendMetrics(RunData, cliVersion, chromeVersion, vaultVersion, oicdbVersion)
if err != nil {
return fmt.Errorf("error sending usage metrics to Buchhalter API: %w", err)
}
Expand Down

0 comments on commit 71bc43b

Please sign in to comment.