diff --git a/pkg/application/controller/app/action/install.go b/pkg/application/controller/app/action/install.go index 0ab47283b..dfd3770be 100644 --- a/pkg/application/controller/app/action/install.go +++ b/pkg/application/controller/app/action/install.go @@ -58,7 +58,7 @@ func Install(ctx context.Context, if updateStatusFunc != nil { if app.Status.Phase == applicationv1.AppPhaseInstallFailed { log.Error(fmt.Sprintf("install app failed, helm pull err: %s", err.Error())) - metrics.GaugeApplicationUpgradeFailed.WithLabelValues(app.Spec.TargetCluster, app.Name).Set(1) + metrics.GaugeApplicationInstallFailed.WithLabelValues(app.Spec.TargetCluster, app.Name).Set(1) // delayed retry, queue.AddRateLimited does not meet the demand return app, nil } @@ -67,7 +67,7 @@ func Install(ctx context.Context, newStatus.Reason = err.Error() newStatus.LastTransitionTime = metav1.Now() _, updateStatusErr := updateStatusFunc(ctx, app, &app.Status, newStatus) - metrics.GaugeApplicationUpgradeFailed.WithLabelValues(app.Spec.TargetCluster, app.Name).Set(1) + metrics.GaugeApplicationInstallFailed.WithLabelValues(app.Spec.TargetCluster, app.Name).Set(1) if updateStatusErr != nil { return nil, updateStatusErr } @@ -104,7 +104,7 @@ func Install(ctx context.Context, if err != nil { if app.Status.Phase == applicationv1.AppPhaseInstallFailed { log.Error(fmt.Sprintf("install app failed, helm install err: %s", err.Error())) - metrics.GaugeApplicationUpgradeFailed.WithLabelValues(app.Spec.TargetCluster, app.Name).Set(1) + metrics.GaugeApplicationInstallFailed.WithLabelValues(app.Spec.TargetCluster, app.Name).Set(1) // delayed retry, queue.AddRateLimited does not meet the demand return app, nil } @@ -112,12 +112,13 @@ func Install(ctx context.Context, newStatus.Message = "install app failed" newStatus.Reason = err.Error() newStatus.LastTransitionTime = metav1.Now() - metrics.GaugeApplicationUpgradeFailed.WithLabelValues(app.Spec.TargetCluster, app.Name).Set(1) + metrics.GaugeApplicationInstallFailed.WithLabelValues(app.Spec.TargetCluster, app.Name).Set(1) } else { newStatus.Phase = applicationv1.AppPhaseSucceeded newStatus.Message = "" newStatus.Reason = "" newStatus.LastTransitionTime = metav1.Now() + metrics.GaugeApplicationInstallFailed.WithLabelValues(app.Spec.TargetCluster, app.Name).Set(0) } newApp, updateStatusErr = updateStatusFunc(ctx, newApp, &newApp.Status, newStatus) if updateStatusErr != nil { diff --git a/pkg/application/controller/app/action/rollback.go b/pkg/application/controller/app/action/rollback.go index 87c66c98f..defbf8d61 100644 --- a/pkg/application/controller/app/action/rollback.go +++ b/pkg/application/controller/app/action/rollback.go @@ -70,6 +70,7 @@ func Rollback(ctx context.Context, newStatus.Reason = "" newStatus.LastTransitionTime = metav1.Now() newStatus.RollbackRevision = 0 // clean revision + metrics.GaugeApplicationRollbackFailed.WithLabelValues(app.Spec.TargetCluster, app.Name).Set(0) } app, updateStatusErr = updateStatusFunc(ctx, app, &app.Status, newStatus) if updateStatusErr != nil { diff --git a/pkg/application/controller/app/action/upgrade.go b/pkg/application/controller/app/action/upgrade.go index bd139e204..aa32d0b68 100644 --- a/pkg/application/controller/app/action/upgrade.go +++ b/pkg/application/controller/app/action/upgrade.go @@ -119,6 +119,7 @@ func Upgrade(ctx context.Context, newStatus.Message = "" newStatus.Reason = "" newStatus.LastTransitionTime = metav1.Now() + metrics.GaugeApplicationUpgradeFailed.WithLabelValues(app.Spec.TargetCluster, app.Name).Set(0) } newApp, updateStatusErr = updateStatusFunc(ctx, newApp, &newApp.Status, newStatus) if updateStatusErr != nil { diff --git a/pkg/application/controller/app/app_controller.go b/pkg/application/controller/app/app_controller.go index 2124c2ea6..8e5a0591c 100644 --- a/pkg/application/controller/app/app_controller.go +++ b/pkg/application/controller/app/app_controller.go @@ -404,6 +404,7 @@ func (c *Controller) syncAppFromRelease(ctx context.Context, cachedApp *cachedAp newStatus.Message = "" newStatus.Reason = "" newStatus.LastTransitionTime = metav1.Now() + metrics.GaugeApplicationSyncFailed.WithLabelValues(app.Spec.TargetCluster, app.Name).Set(0) newStatus.ReleaseStatus = string(rel.Info.Status) newStatus.Revision = int64(rel.Version)