File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -20,10 +20,12 @@ MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)
20
20
USER ?= $(shell id -u -n)
21
21
HOST ?= $(shell hostname)
22
22
MARKDOWNLINT_CLI2_VERSION = 0.18.1
23
+ CLIENT_GO_VERSION = $(shell go list -m -f '{{.Version}}' k8s.io/client-go)
24
+ KSM_MODULE = $(shell go list -m)
23
25
24
26
DOCKER_CLI ?= docker
25
27
PROMTOOL_CLI ?= promtool
26
- GOMPLATE_CLI ?= go tool github.com/hairyhenderson/gomplate/v4/cmd/gomplate
28
+ GOMPLATE_CLI ?= go tool github.com/hairyhenderson/gomplate/v4/cmd/gomplate
27
29
GOJSONTOYAML_CLI ?= go tool github.com/brancz/gojsontoyaml
28
30
EMBEDMD_CLI ?= go tool github.com/campoy/embedmd
29
31
JSONNET_CLI ?= go tool github.com/google/go-jsonnet/cmd/jsonnet
@@ -69,7 +71,7 @@ doccheck: generate validate-template
69
71
@echo OK
70
72
71
73
build-local :
72
- GOOS=$(OS ) GOARCH=$(ARCH ) CGO_ENABLED=0 go build -ldflags " -s -w -X ${PKG} /version.Version=${TAG} -X ${PKG} /version.Revision=${GIT_COMMIT} -X ${PKG} /version.Branch=${BRANCH} -X ${PKG} /version.BuildUser=${USER} @${HOST} -X ${PKG} /version.BuildDate=${BUILD_DATE} " -o kube-state-metrics
74
+ GOOS=$(OS ) GOARCH=$(ARCH ) CGO_ENABLED=0 go build -ldflags " -s -w -X ${PKG} /version.Version=${TAG} -X ${PKG} /version.Revision=${GIT_COMMIT} -X ${PKG} /version.Branch=${BRANCH} -X ${PKG} /version.BuildUser=${USER} @${HOST} -X ${PKG} /version.BuildDate=${BUILD_DATE} -X ${PKG} /version.BuildDate= ${BUILD_DATE} -X ${KSM_MODULE} /pkg/app.ClientGoVersion= ${CLIENT_GO_VERSION} " -o kube-state-metrics
73
75
74
76
build : kube-state-metrics
75
77
Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ import (
63
63
"k8s.io/kube-state-metrics/v2/pkg/util/proc"
64
64
)
65
65
66
+ var ClientGoVersion = "unknown"
67
+
66
68
const (
67
69
metricsPath = "/metrics"
68
70
healthzPath = "/healthz"
@@ -86,6 +88,16 @@ func RunKubeStateMetricsWrapper(ctx context.Context, opts *options.Options) erro
86
88
func RunKubeStateMetrics (ctx context.Context , opts * options.Options ) error {
87
89
ksmMetricsRegistry := prometheus .NewRegistry ()
88
90
ksmMetricsRegistry .MustRegister (versionCollector .NewCollector ("kube_state_metrics" ))
91
+
92
+ clientGoVersion := promauto .With (ksmMetricsRegistry ).NewGaugeVec (
93
+ prometheus.GaugeOpts {
94
+ Name : "kube_state_metrics_client_go_info" ,
95
+ Help : "An info metric for the client-go version used by kube-state-metrics" ,
96
+ },
97
+ []string {"version" },
98
+ )
99
+ clientGoVersion .WithLabelValues (ClientGoVersion ).Set (1 )
100
+
89
101
durationVec := promauto .With (ksmMetricsRegistry ).NewHistogramVec (
90
102
prometheus.HistogramOpts {
91
103
Name : "http_request_duration_seconds" ,
You can’t perform that action at this time.
0 commit comments