Bug 2219144 - [CNAO] Metrics names failed promlint linter
Summary: [CNAO] Metrics names failed promlint linter
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: Metrics
Version: 4.13.0
Hardware: All
OS: All
unspecified
medium
Target Milestone: ---
: 4.14.0
Assignee: Aviv Litman
QA Contact: Ahmad
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-02 12:38 UTC by Aviv Litman
Modified: 2023-11-08 14:06 UTC (History)
3 users (show)

Fixed In Version: hco-bundle-registry-container-v4.14.0.rhel9-1427
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-08 14:05:53 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github kubevirt cluster-network-addons-operator pull 1588 0 None Merged Update metric names to fit metrics naming conventions 2023-08-01 08:30:42 UTC
Red Hat Issue Tracker CNV-30515 0 None None None 2023-07-02 12:40:00 UTC
Red Hat Product Errata RHSA-2023:6817 0 None None None 2023-11-08 14:06:02 UTC

Description Aviv Litman 2023-07-02 12:38:39 UTC
Description of problem:
We created a metric name linter in kubevirt/cluster-network-addons-operator based on promlint: https://github.com/kubevirt/cluster-network-addons-operator/pull/1580

This metrics names failed:
kubevirt_cnao_cr_kubemacpool_deployed_total: non-counter metrics should not have "_total" suffix
kubevirt_cnao_kubemacpool_manager_num_up_pods_total: non-counter metrics should not have "_total" suffix
kubevirt_kubemacpool_duplicate_macs_total: non-counter metrics should not have "_total" suffix
kubevirt_kubemacpool_duplicate_macs_total: name need to start with "kubevirt_cnao_"

In order to pass the linter the names can be:
`kubevirt_cnao_cr_kubemacpool_deployed_total` to `kubevirt_cnao_cr_kubemacpool_aggregated`

`kubevirt_cnao_kubemacpool_manager_num_up_pods_total` to `kubevirt_cnao_kubemacpool_manager_up`

`kubevirt_kubemacpool_duplicate_macs_total` to `kubevirt_cnao_kubemacpool_duplicate_macs`


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

How reproducible:
100%

Steps to Reproduce:
1. cd cluster-network-addons-operator
2. checkout the pr https://github.com/kubevirt/cluster-network-addons-operator/pull/1580
3. remove the ignored metrics from excludedMetrics list in  
tools/prom-metrics-collector/metrics_collector.go (in order to see the erros)
4.make lint-metrics


Actual results:
some metric names are not aligned with promlint linter.

Expected results:
Metrics named will be aligned with promlint linter and Prometheus best practices.

Additional info:
as for now the list of metrics are ignored in the linter.

Comment 1 Ahmad 2023-08-03 09:18:54 UTC
QA: verfied CNV-v4.14.0.rhel9-1442



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












old names give shows no results:


[cloud-user@ocp-psi-executor ~]$ oc exec -n openshift-monitoring prometheus-k8s-0 -c prometheus -- curl -s http://127.0.0.1:9090/api/v1/query?query=kubevirt_cnao_cr_kubemacpool_deployed_total | jq .
{
  "status": "success",
  "data": {
    "resultType": "vector",
    "result": []
  }
}
[cloud-user@ocp-psi-executor ~]$ oc exec -n openshift-monitoring prometheus-k8s-0 -c prometheus -- curl -s http://127.0.0.1:9090/api/v1/query?query=kubevirt_cnao_kubemacpool_manager_num_up_pods_total | jq .
{
  "status": "success",
  "data": {
    "resultType": "vector",
    "result": []
  }
}
[cloud-user@ocp-psi-executor ~]$ oc exec -n openshift-monitoring prometheus-k8s-0 -c prometheus -- curl -s http://127.0.0.1:9090/api/v1/query?query=kubevirt_kubemacpool_duplicate_macs_total | jq .
{
  "status": "success",
  "data": {
    "resultType": "vector",
    "result": []
  }
}

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

Comment 3 errata-xmlrpc 2023-11-08 14:05:53 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


Note You need to log in before you can comment on or make changes to this bug.