Bug 2224828

Summary: [HPP] Metric names fail in metrics name linter
Product: Container Native Virtualization (CNV) Reporter: Assaf Admi <aadmi>
Component: MetricsAssignee: Assaf Admi <aadmi>
Status: CLOSED ERRATA QA Contact: Ahmad <ahafe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.13.0CC: kmajcher, stirabos
Target Milestone: ---   
Target Release: 4.14.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-08 14:06:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Assaf Admi 2023-07-23 10:30:33 UTC
Description of problem:
We applied a metrics names linter in kubevirt/hostpath-provisioner-operator based on promlint. kubevirt_hpp_operator_up_total has failed.

Version-Release number of selected component (if applicable):


How reproducible:
100%

Steps to Reproduce:
1. run `make lint-metrics` in kubevirt/hostpath-provisioner-operator.

Actual results:
kubevirt_hpp_operator_up_total is not aligned with the naming conventions. 

Expected results:
All metrics to aligned with the naming conventions.

Comment 2 Ahmad 2023-08-23 14:39:49 UTC
QA: Verified on cnv 4.14

make lint-metrics passed with no fails + kubevirt_hpp_operator_up_total was changed to > kubevirt_hpp_operator_up
---------------------------------

[cloud-user@ocp-psi-executor hostpath-provisioner-operator]$ make lint-metrics
./hack/prom_metric_linter.sh --operator-name="kubevirt" --sub-operator-name="hpp"
+ linter_image_tag=v0.0.1
+++ dirname ./hack/prom_metric_linter.sh
++ readlink -e ./hack/../
+ PROJECT_ROOT=/home/cloud-user/ahmad/hostpath-provisioner-operator
+ export METRICS_COLLECTOR_PATH=/home/cloud-user/ahmad/hostpath-provisioner-operator/tools/prom-metrics-collector
+ METRICS_COLLECTOR_PATH=/home/cloud-user/ahmad/hostpath-provisioner-operator/tools/prom-metrics-collector
+ [[ ! -d /home/cloud-user/ahmad/hostpath-provisioner-operator/tools/prom-metrics-collector ]]
+ [[ 2 -gt 0 ]]
+ case "$1" in
+ operator_name=kubevirt
+ shift
+ [[ 1 -gt 0 ]]
+ case "$1" in
+ sub_operator_name=hpp
+ shift
+ [[ 0 -gt 0 ]]
+ go build -o _out/prom-metrics-collector /home/cloud-user/ahmad/hostpath-provisioner-operator/tools/prom-metrics-collector/...
++ _out/prom-metrics-collector
+ json_output='[{"name":"kubevirt_hpp_operator_up","help":"The number of running hostpath-provisioner-operator pods","type":1}]'
++ podman run -i quay.io/kubevirt/prom-metrics-linter:v0.0.1 '--metric-families=[{"name":"kubevirt_hpp_operator_up","help":"The number of running hostpath-provisioner-operator pods","type":1}]' --operator-name=kubevirt --sub-operator-name=hpp




[cloud-user@ocp-psi-executor hostpath-provisioner-operator]$ oc exec -n openshift-monitoring prometheus-k8s-0 -c prometheus -- curl -s http://127.0.0.1:9090/api/v1/query?query=kubevirt_hpp_operator_up | jq .
{
  "status": "success",
  "data": {
    "resultType": "vector",
    "result": [
      {
        "metric": {
          "__name__": "kubevirt_hpp_operator_up"
        },
        "value": [
          1692801467.971,
          "1"
        ]
      }
    ]
  }

+ errors=
+ [[ '' != '' ]]

Comment 4 errata-xmlrpc 2023-11-08 14:06:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Virtualization 4.14.0 Images security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:6817