@@ -377,7 +377,7 @@ func generateApprovalStageTaskMetric(
377377// the current updateRun state if the updateRun has transitioned since then.
378378func generateMetricsLabels (
379379 updateRun * placementv1beta1.ClusterStagedUpdateRun ,
380- state , condition , status , reason string ,
380+ state , condition , status , reason , failureType string ,
381381) []* prometheusclientmodel.LabelPair {
382382 return []* prometheusclientmodel.LabelPair {
383383 {Name : ptr .To ("namespace" ), Value : & updateRun .Namespace },
@@ -386,23 +386,24 @@ func generateMetricsLabels(
386386 {Name : ptr .To ("condition" ), Value : ptr .To (condition )},
387387 {Name : ptr .To ("status" ), Value : ptr .To (status )},
388388 {Name : ptr .To ("reason" ), Value : ptr .To (reason )},
389+ {Name : ptr .To ("failureType" ), Value : ptr .To (failureType )},
389390 }
390391}
391392
392393func generateInitializationSucceededMetric (state placementv1beta1.State , updateRun * placementv1beta1.ClusterStagedUpdateRun ) * prometheusclientmodel.Metric {
393394 return & prometheusclientmodel.Metric {
394395 Label : generateMetricsLabels (updateRun , string (state ), string (placementv1beta1 .StagedUpdateRunConditionInitialized ),
395- string (metav1 .ConditionTrue ), condition .UpdateRunInitializeSucceededReason ),
396+ string (metav1 .ConditionTrue ), condition .UpdateRunInitializeSucceededReason , string ( hubmetrics . UpdateRunFailureTypeNone ) ),
396397 Gauge : & prometheusclientmodel.Gauge {
397398 Value : ptr .To (float64 (time .Now ().UnixNano ()) / 1e9 ),
398399 },
399400 }
400401}
401402
402- func generateInitializationFailedMetric (state placementv1beta1.State , updateRun * placementv1beta1.ClusterStagedUpdateRun ) * prometheusclientmodel.Metric {
403+ func generateInitializationFailedMetric (state placementv1beta1.State , updateRun * placementv1beta1.ClusterStagedUpdateRun , failureType string ) * prometheusclientmodel.Metric {
403404 return & prometheusclientmodel.Metric {
404405 Label : generateMetricsLabels (updateRun , string (state ), string (placementv1beta1 .StagedUpdateRunConditionInitialized ),
405- string (metav1 .ConditionFalse ), condition .UpdateRunInitializeFailedReason ),
406+ string (metav1 .ConditionFalse ), condition .UpdateRunInitializeFailedReason , failureType ),
406407 Gauge : & prometheusclientmodel.Gauge {
407408 Value : ptr .To (float64 (time .Now ().UnixNano ()) / 1e9 ),
408409 },
@@ -412,7 +413,7 @@ func generateInitializationFailedMetric(state placementv1beta1.State, updateRun
412413func generateProgressingMetric (state placementv1beta1.State , updateRun * placementv1beta1.ClusterStagedUpdateRun ) * prometheusclientmodel.Metric {
413414 return & prometheusclientmodel.Metric {
414415 Label : generateMetricsLabels (updateRun , string (state ), string (placementv1beta1 .StagedUpdateRunConditionProgressing ),
415- string (metav1 .ConditionTrue ), condition .UpdateRunProgressingReason ),
416+ string (metav1 .ConditionTrue ), condition .UpdateRunProgressingReason , string ( hubmetrics . UpdateRunFailureTypeNone ) ),
416417 Gauge : & prometheusclientmodel.Gauge {
417418 Value : ptr .To (float64 (time .Now ().UnixNano ()) / 1e9 ),
418419 },
@@ -422,7 +423,7 @@ func generateProgressingMetric(state placementv1beta1.State, updateRun *placemen
422423func generateWaitingMetric (state placementv1beta1.State , updateRun * placementv1beta1.ClusterStagedUpdateRun ) * prometheusclientmodel.Metric {
423424 return & prometheusclientmodel.Metric {
424425 Label : generateMetricsLabels (updateRun , string (state ), string (placementv1beta1 .StagedUpdateRunConditionProgressing ),
425- string (metav1 .ConditionFalse ), condition .UpdateRunWaitingReason ),
426+ string (metav1 .ConditionFalse ), condition .UpdateRunWaitingReason , string ( hubmetrics . UpdateRunFailureTypeNone ) ),
426427 Gauge : & prometheusclientmodel.Gauge {
427428 Value : ptr .To (float64 (time .Now ().UnixNano ()) / 1e9 ),
428429 },
@@ -432,17 +433,17 @@ func generateWaitingMetric(state placementv1beta1.State, updateRun *placementv1b
432433func generateStuckMetric (state placementv1beta1.State , updateRun * placementv1beta1.ClusterStagedUpdateRun ) * prometheusclientmodel.Metric {
433434 return & prometheusclientmodel.Metric {
434435 Label : generateMetricsLabels (updateRun , string (state ), string (placementv1beta1 .StagedUpdateRunConditionProgressing ),
435- string (metav1 .ConditionFalse ), condition .UpdateRunStuckReason ),
436+ string (metav1 .ConditionFalse ), condition .UpdateRunStuckReason , string ( hubmetrics . UpdateRunFailureTypeInternalError ) ),
436437 Gauge : & prometheusclientmodel.Gauge {
437438 Value : ptr .To (float64 (time .Now ().UnixNano ()) / 1e9 ),
438439 },
439440 }
440441}
441442
442- func generateFailedMetric (state placementv1beta1.State , updateRun * placementv1beta1.ClusterStagedUpdateRun ) * prometheusclientmodel.Metric {
443+ func generateFailedMetric (state placementv1beta1.State , updateRun * placementv1beta1.ClusterStagedUpdateRun , failureType string ) * prometheusclientmodel.Metric {
443444 return & prometheusclientmodel.Metric {
444445 Label : generateMetricsLabels (updateRun , string (state ), string (placementv1beta1 .StagedUpdateRunConditionSucceeded ),
445- string (metav1 .ConditionFalse ), condition .UpdateRunFailedReason ),
446+ string (metav1 .ConditionFalse ), condition .UpdateRunFailedReason , failureType ),
446447 Gauge : & prometheusclientmodel.Gauge {
447448 Value : ptr .To (float64 (time .Now ().UnixNano ()) / 1e9 ),
448449 },
@@ -452,7 +453,7 @@ func generateFailedMetric(state placementv1beta1.State, updateRun *placementv1be
452453func generateStoppingMetric (state placementv1beta1.State , updateRun * placementv1beta1.ClusterStagedUpdateRun ) * prometheusclientmodel.Metric {
453454 return & prometheusclientmodel.Metric {
454455 Label : generateMetricsLabels (updateRun , string (state ), string (placementv1beta1 .StagedUpdateRunConditionProgressing ),
455- string (metav1 .ConditionUnknown ), condition .UpdateRunStoppingReason ),
456+ string (metav1 .ConditionUnknown ), condition .UpdateRunStoppingReason , string ( hubmetrics . UpdateRunFailureTypeNone ) ),
456457 Gauge : & prometheusclientmodel.Gauge {
457458 Value : ptr .To (float64 (time .Now ().UnixNano ()) / 1e9 ),
458459 },
@@ -462,7 +463,7 @@ func generateStoppingMetric(state placementv1beta1.State, updateRun *placementv1
462463func generateStoppedMetric (state placementv1beta1.State , updateRun * placementv1beta1.ClusterStagedUpdateRun ) * prometheusclientmodel.Metric {
463464 return & prometheusclientmodel.Metric {
464465 Label : generateMetricsLabels (updateRun , string (state ), string (placementv1beta1 .StagedUpdateRunConditionProgressing ),
465- string (metav1 .ConditionFalse ), condition .UpdateRunStoppedReason ),
466+ string (metav1 .ConditionFalse ), condition .UpdateRunStoppedReason , string ( hubmetrics . UpdateRunFailureTypeNone ) ),
466467 Gauge : & prometheusclientmodel.Gauge {
467468 Value : ptr .To (float64 (time .Now ().UnixNano ()) / 1e9 ),
468469 },
@@ -472,7 +473,7 @@ func generateStoppedMetric(state placementv1beta1.State, updateRun *placementv1b
472473func generateSucceededMetric (state placementv1beta1.State , updateRun * placementv1beta1.ClusterStagedUpdateRun ) * prometheusclientmodel.Metric {
473474 return & prometheusclientmodel.Metric {
474475 Label : generateMetricsLabels (updateRun , string (state ), string (placementv1beta1 .StagedUpdateRunConditionSucceeded ),
475- string (metav1 .ConditionTrue ), condition .UpdateRunSucceededReason ),
476+ string (metav1 .ConditionTrue ), condition .UpdateRunSucceededReason , string ( hubmetrics . UpdateRunFailureTypeNone ) ),
476477 Gauge : & prometheusclientmodel.Gauge {
477478 Value : ptr .To (float64 (time .Now ().UnixNano ()) / 1e9 ),
478479 },
@@ -963,16 +964,16 @@ func generateFalseCondition(obj client.Object, condType any) metav1.Condition {
963964 }
964965}
965966
966- func generateFalseProgressingCondition (obj client.Object , condType any , reason string ) metav1.Condition {
967+ func generateFalseConditionWithReason (obj client.Object , condType any , reason string ) metav1.Condition {
967968 falseCond := generateFalseCondition (obj , condType )
968969 falseCond .Reason = reason
969970 return falseCond
970971}
971972
972- func generateFalseConditionWithReason (obj client.Object , condType any , reason string ) metav1.Condition {
973- falseCond := generateFalseCondition (obj , condType )
974- falseCond .Reason = reason
975- return falseCond
973+ func generateTrueConditionWithReason (obj client.Object , condType any , reason string ) metav1.Condition {
974+ trueCond := generateTrueCondition (obj , condType )
975+ trueCond .Reason = reason
976+ return trueCond
976977}
977978
978979func generateProgressingUnknownConditionWithReason (obj client.Object , reason string ) metav1.Condition {
0 commit comments