Skip to content

Commit

Permalink
chore: small fixed after reviewing the pr
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardomaraschini committed Oct 4, 2023
1 parent df06c97 commit 448da69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cmd/helmvm/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ var upgradeCommand = &cli.Command{
}
logrus.Infof("Starting service")
if err := startK0sService(); err != nil {
err := fmt.Errorf("unable to start k0s service: %w", err)
err := fmt.Errorf("unable to start service: %w", err)
metrics.ReportNodeUpgradeFailed(c.Context, err)
return err
}
Expand All @@ -144,7 +144,7 @@ var upgradeCommand = &cli.Command{
metrics.ReportNodeUpgradeSucceeded(c.Context)
return nil
}
err := fmt.Errorf("unable to read kubeconfig: %w", err)
err := fmt.Errorf("unable to stat kubeconfig: %w", err)
metrics.ReportNodeUpgradeFailed(c.Context, err)
return err
}
Expand Down
14 changes: 5 additions & 9 deletions pkg/metrics/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func ReportInstallationStarted(ctx context.Context) {
}

// ReportInstallationSucceeded reports that the installation has succeeded.
func ReportInstallationSuceeded(ctx context.Context) {
func ReportInstallationSucceeded(ctx context.Context) {
Send(ctx, InstallationSucceeded{ClusterID: ClusterID()})
}

Expand All @@ -84,22 +84,18 @@ func ReportInstallationFailed(ctx context.Context, err error) {

// ReportUpgradeStarted reports that the upgrade has started.
func ReportUpgradeStarted(ctx context.Context) {
itype := "centralized"
if defaults.DecentralizedInstall() {
itype = "decentralized"
}
Send(ctx, UpgradeStarted{
ClusterID: ClusterID(),
Version: defaults.Version,
Flags: strings.Join(os.Args[1:], " "),
BinaryName: defaults.BinaryName(),
Type: itype,
Type: "centralized",
LicenseID: LicenseID(),
})
}

// ReportUpgradeSucceeded reports that the upgrade has succeeded.
func ReportUpgradeSuceeded(ctx context.Context) {
func ReportUpgradeSucceeded(ctx context.Context) {
Send(ctx, UpgradeSucceeded{ClusterID: ClusterID()})
}

Expand Down Expand Up @@ -173,10 +169,10 @@ func ReportApplyFinished(c *cli.Context, err error) {
return
}
if isUpgrade {
ReportUpgradeSuceeded(ctx)
ReportUpgradeSucceeded(ctx)
return
}
ReportInstallationSuceeded(ctx)
ReportInstallationSucceeded(ctx)
}

// ReportNodeUpgradeStarted reports that a node upgrade has started.
Expand Down

0 comments on commit 448da69

Please sign in to comment.