Skip to content

Commit c39d975

Browse files
Fix the wrong documentation of two metrics (#4021) (#4031)
The documentation of the `kubevirt_hco_dataimportcrontemplate_with_architecture_annotation` and the `kubevirt_hco_dataimportcrontemplate_with_supported_architectures`, were with the reverse logic (0 <=> 1). This PR fixes the documentation and the HELP parameter of these metric, to match the actual logic. Signed-off-by: Nahshon Unna Tsameret <nunnatsa@redhat.com> Co-authored-by: Nahshon Unna Tsameret <60659093+nunnatsa@users.noreply.github.com>
1 parent 9885ae0 commit c39d975

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

controllers/handlers/golden-images/golden_images.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ func validateMultiArchDict(dict *hcov1beta1.DataImportCronTemplateStatus) bool {
8484
if dict.Status.OriginalSupportedArchitectures == "" {
8585
metrics.SetDICTWithNoArchitectureAnnotation(dict.Name, dict.Spec.ManagedDataSource)
8686
return false
87-
} else {
88-
metrics.SetDICTWithArchitectureAnnotation(dict.Name, dict.Spec.ManagedDataSource)
8987
}
88+
metrics.SetDICTWithArchitectureAnnotation(dict.Name, dict.Spec.ManagedDataSource)
9089

9190
if meta.IsStatusConditionFalse(dict.Status.Conditions, DictConditionDeployedType) {
9291
metrics.SetDICTWithNoSupportedArchitectures(dict.Name, dict.Spec.ManagedDataSource)

docs/metrics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Sum of CPU core requests for all running virt-launcher VMIs across the entire Ku
77
Monitors resources for potential problems. Type: Gauge.
88

99
### kubevirt_hco_dataimportcrontemplate_with_architecture_annotation
10-
Indicates whether the DataImportCronTemplate has the ssp.kubevirt.io/dict.architectures annotation (0) or not (1). Type: Gauge.
10+
Indicates whether the DataImportCronTemplate has the ssp.kubevirt.io/dict.architectures annotation (1) or not (0). Type: Gauge.
1111

1212
### kubevirt_hco_dataimportcrontemplate_with_supported_architectures
13-
Indicates whether the DataImportCronTemplate has supported architectures (0) or not (1). Type: Gauge.
13+
Indicates whether the DataImportCronTemplate has supported architectures (1) or not (0). Type: Gauge.
1414

1515
### kubevirt_hco_hyperconverged_cr_exists
1616
Indicates whether the HyperConverged custom resource exists (1) or not (0). Type: Gauge.

hack/prom-rule-ci/hyperconverged-prom-rules-tests.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ tests:
843843
alertname: HCOGoldenImageWithNoSupportedArchitecture
844844
exp_alerts: [ ]
845845

846-
# dict1 metric value of 1 must trigger an alert
846+
# dict1 metric value of 0 must trigger an alert
847847
- eval_time: 2m
848848
alertname: HCOGoldenImageWithNoSupportedArchitecture
849849
exp_alerts:
@@ -859,7 +859,7 @@ tests:
859859
data_import_cron_name: "dict1"
860860
managed_data_source_name: "ds1"
861861

862-
# dict1 and dict2 metric values of 1 must trigger alerts
862+
# dict1 and dict2 metric values of 0 must trigger alerts
863863
- eval_time: 3m
864864
alertname: HCOGoldenImageWithNoSupportedArchitecture
865865
exp_alerts:
@@ -886,7 +886,7 @@ tests:
886886
data_import_cron_name: "dict2"
887887
managed_data_source_name: "ds2"
888888

889-
# dict1 and dict2 metric values of 1 must trigger alerts
889+
# dict1 and dict2 metric values of 0 must trigger alerts
890890
- eval_time: 4m
891891
alertname: HCOGoldenImageWithNoSupportedArchitecture
892892
exp_alerts:
@@ -913,7 +913,7 @@ tests:
913913
data_import_cron_name: "dict2"
914914
managed_data_source_name: "ds2"
915915

916-
# dict2 metric value of 1 must trigger an alert
916+
# dict2 metric value of 0 must trigger an alert
917917
- eval_time: 6m
918918
alertname: HCOGoldenImageWithNoSupportedArchitecture
919919
exp_alerts:
@@ -934,7 +934,7 @@ tests:
934934
alertname: HCOGoldenImageWithNoSupportedArchitecture
935935
exp_alerts: [ ]
936936

937-
# dict1 metric value of 1 must trigger an alert
937+
# dict1 metric value of 0 must trigger an alert
938938
- eval_time: 8m
939939
alertname: HCOGoldenImageWithNoSupportedArchitecture
940940
exp_alerts:
@@ -966,7 +966,7 @@ tests:
966966
alertname: HCOGoldenImageWithNoArchitectureAnnotation
967967
exp_alerts: [ ]
968968

969-
# dict1 metric value of 1 must trigger an alert
969+
# dict1 metric value of 0 must trigger an alert
970970
- eval_time: 2m
971971
alertname: HCOGoldenImageWithNoArchitectureAnnotation
972972
exp_alerts:
@@ -982,7 +982,7 @@ tests:
982982
data_import_cron_name: "dict1"
983983
managed_data_source_name: "ds1"
984984

985-
# dict1 and dict2 metric values of 1 must trigger alerts
985+
# dict1 and dict2 metric values of 0 must trigger alerts
986986
- eval_time: 3m
987987
alertname: HCOGoldenImageWithNoArchitectureAnnotation
988988
exp_alerts:
@@ -1009,7 +1009,7 @@ tests:
10091009
data_import_cron_name: "dict2"
10101010
managed_data_source_name: "ds2"
10111011

1012-
# dict1 and dict2 metric values of 1 must trigger alerts
1012+
# dict1 and dict2 metric values of 0 must trigger alerts
10131013
- eval_time: 4m
10141014
alertname: HCOGoldenImageWithNoArchitectureAnnotation
10151015
exp_alerts:
@@ -1036,7 +1036,7 @@ tests:
10361036
data_import_cron_name: "dict2"
10371037
managed_data_source_name: "ds2"
10381038

1039-
# dict2 metric value of 1 must trigger an alert
1039+
# dict2 metric value of 0 must trigger an alert
10401040
- eval_time: 6m
10411041
alertname: HCOGoldenImageWithNoArchitectureAnnotation
10421042
exp_alerts:
@@ -1057,7 +1057,7 @@ tests:
10571057
alertname: HCOGoldenImageWithNoArchitectureAnnotation
10581058
exp_alerts: [ ]
10591059

1060-
# dict1 metric value of 1 must trigger an alert
1060+
# dict1 metric value of 0 must trigger an alert
10611061
- eval_time: 8m
10621062
alertname: HCOGoldenImageWithNoArchitectureAnnotation
10631063
exp_alerts:

pkg/monitoring/hyperconverged/metrics/operator_metrics.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ var (
7676
dictWithSupportedArchitectures = operatormetrics.NewGaugeVec(
7777
operatormetrics.MetricOpts{
7878
Name: "kubevirt_hco_dataimportcrontemplate_with_supported_architectures",
79-
Help: "Indicates whether the DataImportCronTemplate has supported architectures (0) or not (1)",
79+
Help: "Indicates whether the DataImportCronTemplate has supported architectures (1) or not (0)",
8080
},
8181
[]string{counterLabelDICTName, counterLabelDSName},
8282
)
8383

8484
dictWithArchitectureAnnotation = operatormetrics.NewGaugeVec(
8585
operatormetrics.MetricOpts{
8686
Name: "kubevirt_hco_dataimportcrontemplate_with_architecture_annotation",
87-
Help: "Indicates whether the DataImportCronTemplate has the ssp.kubevirt.io/dict.architectures annotation (0) or not (1)",
87+
Help: "Indicates whether the DataImportCronTemplate has the ssp.kubevirt.io/dict.architectures annotation (1) or not (0)",
8888
},
8989
[]string{counterLabelDICTName, counterLabelDSName},
9090
)

0 commit comments

Comments
 (0)