Bug 1791001 - Metric labels set incorrectly during build
Summary: Metric labels set incorrectly during build
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Service Catalog
Version: 4.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 4.4.0
Assignee: Jesus M. Rodriguez
QA Contact: Fan Jia
URL:
Whiteboard:
: 1798305 (view as bug list)
Depends On: 1804988
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-01-14 16:37 UTC by Pawel Krupa
Modified: 2020-02-26 23:43 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-02-26 23:43:12 UTC
Target Upstream Version:


Attachments (Terms of Use)
svcat build_info shows up correctly (37.01 KB, image/png)
2020-02-21 20:47 UTC, Jesus M. Rodriguez
no flags Details
but kubernetes_build_info isn't being populated correctly (45.04 KB, image/png)
2020-02-21 20:47 UTC, Jesus M. Rodriguez
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github openshift cluster-svcat-apiserver-operator pull 76 0 None closed Bug 1791001: use make build so ldflags are passed 2020-02-26 14:18:32 UTC
Github openshift cluster-svcat-controller-manager-operator pull 69 0 None closed Bug 1791001: use make build so ldflags are passed 2020-02-26 14:18:31 UTC

Description Pawel Krupa 2020-01-14 16:37:56 UTC
Description of problem:
Following metric labels are not set: `gitCommit` and `gitVersion`. They are returned as `gitCommit="$Format:%H$",gitVersion="v0.0.0-master+$Format:%h$"`

This is the case for openshift-service-catalog-apiserver-operator and for openshift-service-catalog-controller-manager-operator

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

How reproducible:
Always

Steps to Reproduce:
1. Start a cluster
2. Go to metrics console
3. search for `kubernetes_build_info{job!~"kube-dns|coredns",gitVersion!="v1.17.0"}`

Actual results:
Prometheus returns metrics with invalid label values:
`gitCommit="$Format:%H$" and gitVersion="v0.0.0-master+$Format:%h$"`

Expected results:
Nothing is returned

Additional info:
Frequently happens in CI builds.

Comment 1 Jesus M. Rodriguez 2020-02-05 15:57:46 UTC
*** Bug 1798305 has been marked as a duplicate of this bug. ***

Comment 4 Fan Jia 2020-02-21 11:22:42 UTC
test env:
cv: 4.4.0-0.nightly-2020-02-21-011943
release log include this bug fix.

test result:
1. Start a cluster
2. Go to metrics console
3. search for `kubernetes_build_info{job!~"kube-dns|coredns",gitVersion!="v1.17.0"}`

Prometheus still returns metrics with invalid label values for svcat-apiserver & svcat-controller-manager:
`gitCommit="$Format:%H$" and gitVersion="v0.0.0-master+$Format:%h$"`

Comment 5 Jesus M. Rodriguez 2020-02-21 20:47:05 UTC
Created attachment 1664840 [details]
svcat build_info shows up correctly

Comment 6 Jesus M. Rodriguez 2020-02-21 20:47:41 UTC
Created attachment 1664841 [details]
but kubernetes_build_info isn't being populated correctly

Comment 7 Junqi Zhao 2020-02-25 03:19:11 UTC
it is true that we can find "openshift_cluster_svcat_controller_manager_operator_build_info" and "openshift_cluster_svcat_controller_manager_operator_build_info" from Prometheus, it is also true that the "kubernetes_build_info" also exposed by openshift-service-catalog-apiserver-operator and openshift-service-catalog-controller-manager-operator
****************************************************************************************
openshift_cluster_svcat_apiserver_operator_build_info
Element 	Value
openshift_cluster_svcat_apiserver_operator_build_info{endpoint="https",gitCommit="62f9868a7884211668c87587cf4fbeeea6f06bcb",gitVersion="62f9868a",instance="10.130.0.24:8443",job="metrics",namespace="openshift-service-catalog-apiserver-operator",pod="openshift-service-catalog-apiserver-operator-5565dbb697-55cds",service="metrics"}	1

openshift_cluster_svcat_controller_manager_operator_build_info
Element 	Value
openshift_cluster_svcat_controller_manager_operator_build_info{endpoint="https",gitCommit="217034e0985c602780d95c4abb5c807dfb587e1c",gitVersion="217034e0",instance="10.130.0.23:8443",job="metrics",namespace="openshift-service-catalog-controller-manager-operator",pod="openshift-service-catalog-controller-manager-operator-8496m22hs",service="metrics"}	1
****************************************************************************************
count(kubernetes_build_info{job!~"kube-dns|coredns",gitVersion="v0.0.0-master+$Format:%h$"}) by (gitCommit, gitVersion,namespace)
Element 	Value
{gitCommit="$Format:%H$",gitVersion="v0.0.0-master+$Format:%h$",namespace="openshift-service-catalog-apiserver-operator"}	1
{gitCommit="$Format:%H$",gitVersion="v0.0.0-master+$Format:%h$",namespace="openshift-service-catalog-controller-manager-operator"}	1
****************************************************************************************
# oc -n openshift-service-catalog-apiserver-operator get pod
NAME                                                            READY   STATUS    RESTARTS   AGE
openshift-service-catalog-apiserver-operator-5565dbb697-55cds   1/1     Running   7          19h

# oc -n openshift-service-catalog-apiserver-operator get ep
NAME      ENDPOINTS          AGE
metrics   10.130.0.24:8443   19h

# token=`oc sa get-token prometheus-k8s -n openshift-monitoring`
# oc -n openshift-service-catalog-apiserver-operator exec openshift-service-catalog-apiserver-operator-5565dbb697-55cds -- curl -k -H "Authorization: Bearer $token" https://10.130.0.24:8443/metrics | grep "kubernetes_build_info"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12959    0 12959    0     0  95805      0 --:--:-- --:--:-- --:--:-- 95992
# HELP kubernetes_build_info [ALPHA] A metric with a constant '1' value labeled by major, minor, git version, git commit, git tree state, build date, Go version, and compiler from which Kubernetes was built, and platform on which it is running.
# TYPE kubernetes_build_info gauge
kubernetes_build_info{buildDate="1970-01-01T00:00:00Z",compiler="gc",gitCommit="$Format:%H$",gitTreeState="",gitVersion="v0.0.0-master+$Format:%h$",goVersion="go1.13.4",major="",minor="",platform="linux/amd64"} 1
****************************************************************************************
# oc -n openshift-service-catalog-controller-manager-operator get pod
NAME                                                              READY   STATUS    RESTARTS   AGE
openshift-service-catalog-controller-manager-operator-8496m22hs   1/1     Running   5          19h

# oc -n openshift-service-catalog-controller-manager-operator get ep
NAME      ENDPOINTS          AGE
metrics   10.130.0.23:8443   19h

# token=`oc sa get-token prometheus-k8s -n openshift-monitoring`
# oc -n openshift-service-catalog-controller-manager-operator exec openshift-service-catalog-controller-manager-operator-8496m22hs -- curl -k -H "Authorization: Bearer $token" https://10.130.0.23:8443/metrics | grep "kubernetes_build_info"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12990    0 12990    0     0  38770      0 --:--:-- --:--:-- --:--:-- 38892
# HELP kubernetes_build_info [ALPHA] A metric with a constant '1' value labeled by major, minor, git version, git commit, git tree state, build date, Go version, and compiler from which Kubernetes was built, and platform on which it is running.
# TYPE kubernetes_build_info gauge
kubernetes_build_info{buildDate="1970-01-01T00:00:00Z",compiler="gc",gitCommit="$Format:%H$",gitTreeState="",gitVersion="v0.0.0-master+$Format:%h$",goVersion="go1.13.4",major="",minor="",platform="linux/amd64"} 1

Comment 8 Jesus M. Rodriguez 2020-02-26 23:43:12 UTC
Since we expose openshift_cluster_svcat_apiserver_operator_build_info and openshift_cluster_svcat_controller_manager_operator_build_info correctly, that is sufficient to allow customers and support to get what version is being used in a cluster. We are not going to fix the the kubernetes_build_info for the service catalog.


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