Merge pull request #120574 from logicalhan/cslis

promote component SLIs to GA; remove feature gates for component slis
This commit is contained in:
Kubernetes Prow Robot
2023-09-14 22:52:12 -07:00
committed by GitHub
9 changed files with 36 additions and 44 deletions

View File

@@ -994,14 +994,10 @@ func installAPI(s *GenericAPIServer, c *Config) {
if c.EnableMetrics {
if c.EnableProfiling {
routes.MetricsWithReset{}.Install(s.Handler.NonGoRestfulMux)
if utilfeature.DefaultFeatureGate.Enabled(features.ComponentSLIs) {
slis.SLIMetricsWithReset{}.Install(s.Handler.NonGoRestfulMux)
}
slis.SLIMetricsWithReset{}.Install(s.Handler.NonGoRestfulMux)
} else {
routes.DefaultMetrics{}.Install(s.Handler.NonGoRestfulMux)
if utilfeature.DefaultFeatureGate.Enabled(features.ComponentSLIs) {
slis.SLIMetrics{}.Install(s.Handler.NonGoRestfulMux)
}
slis.SLIMetrics{}.Install(s.Handler.NonGoRestfulMux)
}
}

View File

@@ -202,9 +202,9 @@ func Run(c *cloudcontrollerconfig.CompletedConfig, cloud cloudprovider.Interface
// Start the controller manager HTTP server
if c.SecureServing != nil {
unsecuredMux := genericcontrollermanager.NewBaseHandler(&c.ComponentConfig.Generic.Debugging, healthzHandler)
if utilfeature.DefaultFeatureGate.Enabled(features.ComponentSLIs) {
slis.SLIMetricsWithReset{}.Install(unsecuredMux)
}
slis.SLIMetricsWithReset{}.Install(unsecuredMux)
handler := genericcontrollermanager.BuildHandlerChain(unsecuredMux, &c.Authorization, &c.Authentication)
// TODO: handle stoppedCh and listenerStoppedCh returned by c.SecureServing.Serve
if _, _, err := c.SecureServing.Serve(handler, 0, stopCh); err != nil {

View File

@@ -37,7 +37,7 @@ var (
Namespace: "kubernetes",
Name: "healthcheck",
Help: "This metric records the result of a single healthcheck.",
StabilityLevel: k8smetrics.BETA,
StabilityLevel: k8smetrics.STABLE,
},
[]string{"name", "type"},
)
@@ -48,7 +48,7 @@ var (
Namespace: "kubernetes",
Name: "healthchecks_total",
Help: "This metric records the results of all healthcheck.",
StabilityLevel: k8smetrics.BETA,
StabilityLevel: k8smetrics.STABLE,
},
[]string{"name", "type", "status"},
)

View File

@@ -37,10 +37,10 @@ func TestObserveHealthcheck(t *testing.T) {
initialState := Error
healthcheckName := "healthcheck-a"
initialOutput := `
# HELP kubernetes_healthcheck [BETA] This metric records the result of a single healthcheck.
# HELP kubernetes_healthcheck [STABLE] This metric records the result of a single healthcheck.
# TYPE kubernetes_healthcheck gauge
kubernetes_healthcheck{name="healthcheck-a",type="healthz"} 0
# HELP kubernetes_healthchecks_total [BETA] This metric records the results of all healthcheck.
# HELP kubernetes_healthchecks_total [STABLE] This metric records the results of all healthcheck.
# TYPE kubernetes_healthchecks_total counter
kubernetes_healthchecks_total{name="healthcheck-a",status="error",type="healthz"} 1
`
@@ -57,10 +57,10 @@ func TestObserveHealthcheck(t *testing.T) {
hcType: "healthz",
hcStatus: Success,
want: `
# HELP kubernetes_healthcheck [BETA] This metric records the result of a single healthcheck.
# HELP kubernetes_healthcheck [STABLE] This metric records the result of a single healthcheck.
# TYPE kubernetes_healthcheck gauge
kubernetes_healthcheck{name="healthcheck-a",type="healthz"} 1
# HELP kubernetes_healthchecks_total [BETA] This metric records the results of all healthcheck.
# HELP kubernetes_healthchecks_total [STABLE] This metric records the results of all healthcheck.
# TYPE kubernetes_healthchecks_total counter
kubernetes_healthchecks_total{name="healthcheck-a",status="error",type="healthz"} 1
kubernetes_healthchecks_total{name="healthcheck-a",status="success",type="healthz"} 1