From 28129e4d6d79aecac64985c8f1368e13fbb3078c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Wed, 16 Oct 2024 09:33:30 +0200 Subject: [PATCH] chore: Remove deprecated endpoint address metric This was deprecated in 2022 in https://github.com/kubernetes/kube-state-metrics/pull/1761 --- docs/metrics/service/endpoint-metrics.md | 2 -- internal/store/endpoint.go | 41 ------------------------ internal/store/endpoint_test.go | 16 --------- 3 files changed, 59 deletions(-) diff --git a/docs/metrics/service/endpoint-metrics.md b/docs/metrics/service/endpoint-metrics.md index 4845988bdd..6cf0823f3a 100644 --- a/docs/metrics/service/endpoint-metrics.md +++ b/docs/metrics/service/endpoint-metrics.md @@ -3,8 +3,6 @@ | Metric name | Metric type | Description | Labels/tags | Status | | ------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | | kube_endpoint_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `endpoint`=<endpoint-name>
`namespace`=<endpoint-namespace>
`annotation_ENDPOINT_ANNOTATION`=<ENDPOINT_ANNOTATION> | EXPERIMENTAL | -| kube_endpoint_address_not_ready | Gauge | | `endpoint`=<endpoint-name>
`namespace`=<endpoint-namespace> | DEPRECATED | -| kube_endpoint_address_available | Gauge | | `endpoint`=<endpoint-name>
`namespace`=<endpoint-namespace> | DEPRECATED | | kube_endpoint_info | Gauge | | `endpoint`=<endpoint-name>
`namespace`=<endpoint-namespace> | STABLE | | kube_endpoint_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `endpoint`=<endpoint-name>
`namespace`=<endpoint-namespace>
`label_ENDPOINT_LABEL`=<ENDPOINT_LABEL> | STABLE | | kube_endpoint_created | Gauge | | `endpoint`=<endpoint-name>
`namespace`=<endpoint-namespace> | STABLE | diff --git a/internal/store/endpoint.go b/internal/store/endpoint.go index 482eb98e2c..5694cdfc19 100644 --- a/internal/store/endpoint.go +++ b/internal/store/endpoint.go @@ -123,47 +123,6 @@ func endpointMetricFamilies(allowAnnotationsList, allowLabelsList []string) []ge } }), ), - *generator.NewFamilyGeneratorWithStability( - "kube_endpoint_address_available", - "Number of addresses available in endpoint.", - metric.Gauge, - basemetrics.ALPHA, - "v2.6.0", - wrapEndpointFunc(func(e *v1.Endpoints) *metric.Family { - var available int - for _, s := range e.Subsets { - available += len(s.Addresses) * len(s.Ports) - } - - return &metric.Family{ - Metrics: []*metric.Metric{ - { - Value: float64(available), - }, - }, - } - }), - ), - *generator.NewFamilyGeneratorWithStability( - "kube_endpoint_address_not_ready", - "Number of addresses not ready in endpoint", - metric.Gauge, - basemetrics.ALPHA, - "v2.6.0", - wrapEndpointFunc(func(e *v1.Endpoints) *metric.Family { - var notReady int - for _, s := range e.Subsets { - notReady += len(s.NotReadyAddresses) * len(s.Ports) - } - return &metric.Family{ - Metrics: []*metric.Metric{ - { - Value: float64(notReady), - }, - }, - } - }), - ), *generator.NewFamilyGeneratorWithStability( "kube_endpoint_address", "Information about Endpoint available and non available addresses.", diff --git a/internal/store/endpoint_test.go b/internal/store/endpoint_test.go index d090a38115..87205f4d50 100644 --- a/internal/store/endpoint_test.go +++ b/internal/store/endpoint_test.go @@ -32,10 +32,6 @@ func TestEndpointStore(t *testing.T) { const metadata = ` # HELP kube_endpoint_annotations Kubernetes annotations converted to Prometheus labels. # TYPE kube_endpoint_annotations gauge - # HELP kube_endpoint_address_available (Deprecated since v2.6.0) Number of addresses available in endpoint. - # TYPE kube_endpoint_address_available gauge - # HELP kube_endpoint_address_not_ready (Deprecated since v2.6.0) Number of addresses not ready in endpoint - # TYPE kube_endpoint_address_not_ready gauge # HELP kube_endpoint_created [STABLE] Unix creation timestamp # TYPE kube_endpoint_created gauge # HELP kube_endpoint_info [STABLE] Information about endpoint. @@ -89,8 +85,6 @@ func TestEndpointStore(t *testing.T) { }, }, Want: metadata + ` - kube_endpoint_address_available{endpoint="test-endpoint",namespace="default"} 6 - kube_endpoint_address_not_ready{endpoint="test-endpoint",namespace="default"} 6 kube_endpoint_created{endpoint="test-endpoint",namespace="default"} 1.5e+09 kube_endpoint_info{endpoint="test-endpoint",namespace="default"} 1 kube_endpoint_ports{endpoint="test-endpoint",namespace="default",port_name="http",port_protocol="TCP",port_number="8080"} 1 @@ -132,8 +126,6 @@ func TestEndpointStore(t *testing.T) { }, }, Want: metadata + ` - kube_endpoint_address_available{endpoint="single-port-endpoint",namespace="default"} 2 - kube_endpoint_address_not_ready{endpoint="single-port-endpoint",namespace="default"} 1 kube_endpoint_created{endpoint="single-port-endpoint",namespace="default"} 1.5e+09 kube_endpoint_info{endpoint="single-port-endpoint",namespace="default"} 1 kube_endpoint_ports{endpoint="single-port-endpoint",namespace="default",port_name="",port_number="8080",port_protocol="TCP"} 1 @@ -156,10 +148,6 @@ func TestEndpointStoreWithLabels(t *testing.T) { // Fixed metadata on type and help text. We prepend this to every expected // output so we only have to modify a single place when doing adjustments. const metadata = ` - # HELP kube_endpoint_address_available (Deprecated since v2.6.0) Number of addresses available in endpoint. - # TYPE kube_endpoint_address_available gauge - # HELP kube_endpoint_address_not_ready (Deprecated since v2.6.0) Number of addresses not ready in endpoint - # TYPE kube_endpoint_address_not_ready gauge # HELP kube_endpoint_annotations Kubernetes annotations converted to Prometheus labels. # TYPE kube_endpoint_annotations gauge # HELP kube_endpoint_created [STABLE] Unix creation timestamp @@ -218,8 +206,6 @@ func TestEndpointStoreWithLabels(t *testing.T) { }, }, Want: metadata + ` - kube_endpoint_address_available{endpoint="test-endpoint",namespace="default"} 6 - kube_endpoint_address_not_ready{endpoint="test-endpoint",namespace="default"} 6 kube_endpoint_annotations{endpoint="test-endpoint",annotation_app="foobar",namespace="default"} 1 kube_endpoint_created{endpoint="test-endpoint",namespace="default"} 1.5e+09 kube_endpoint_info{endpoint="test-endpoint",namespace="default"} 1 @@ -267,8 +253,6 @@ func TestEndpointStoreWithLabels(t *testing.T) { }, Want: metadata + ` kube_endpoint_annotations{endpoint="single-port-endpoint",annotation_app="single-foobar",namespace="default"} 1 - kube_endpoint_address_available{endpoint="single-port-endpoint",namespace="default"} 2 - kube_endpoint_address_not_ready{endpoint="single-port-endpoint",namespace="default"} 1 kube_endpoint_created{endpoint="single-port-endpoint",namespace="default"} 1.5e+09 kube_endpoint_info{endpoint="single-port-endpoint",namespace="default"} 1 kube_endpoint_labels{endpoint="single-port-endpoint",label_app="single-foobar",namespace="default"} 1