Change:
testAPIServerIDHash = "sha256:14f9d63e669337ac6bfda2e2162915ee6a6067743eddd4e5c374b572f951ff37" ) <ins> func testMetricsRegistry(t *testing.T) metrics.KubeRegistry { // setting the version to 1.30.0 to test deprecation // of deprecatedEncryptionConfigAutomaticReloadFailureTotal and deprecatedEncryptionConfigAutomaticReloadSuccessTotal registry := testutil.NewFakeKubeRegistry("1.30.0") registry.MustRegister(encryptionConfigAutomaticReloadsTotal) registry.MustRegister(deprecatedEncryptionConfigAutomaticReloadFailureTotal) registry.MustRegister(deprecatedEncryptionConfigAutomaticReloadSuccessTotal) registry.MustRegister(encryptionConfigAutomaticReloadLastTimestampSeconds) t.Cleanup(func() { registry.Reset() }) return registry } </ins> func TestRecordEncryptionConfigAutomaticReloadFailure(t *testing.T) { <ins> registry := testMetricsRegistry(t) </ins> expectedValue := ` <del> # HELP apiserver_encryption_config_controller_automatic_reload_failures_total [ALPHA] Total number of failed automatic reloads of encryption configuration split by apiserver identity. </del> <ins> # HELP apiserver_encryption_config_controller_automatic_reload_failures_total [ALPHA] (Deprecated since 1.30.0) Total number of failed automatic reloads of encryption configuration split by apiserver identity. </ins> # TYPE apiserver_encryption_config_controller_automatic_reload_failures_total counter apiserver_encryption_config_controller_automatic_reload_failures_total {apiserver_id_hash="sha256:14f9d63e669337ac6bfda2e2162915ee6a6067743eddd4e5c374b572f951ff37"} 1 <ins> # HELP apiserver_encryption_config_controller_automatic_reloads_total [ALPHA] Total number of reload successes and failures of encryption configuration split by apiserver identity. # TYPE apiserver_encryption_config_controller_automatic_reloads_total counter apiserver_encryption_config_controller_automatic_reloads_total {apiserver_id_hash="sha256:14f9d63e669337ac6bfda2e2162915ee6a6067743eddd4e5c374b572f951ff37",status="failure"} 1 </ins> ` <del> metrics := []string{ </del> <ins> metricNames := []string{ </ins> namespace + "_" + subsystem + "_automatic_reload_failures_total", <ins> namespace + "_" + subsystem + "_automatic_reloads_total", </ins> } <del> encryptionConfigAutomaticReloadFailureTotal.Reset() </del> <ins> deprecatedEncryptionConfigAutomaticReloadFailureTotal.Reset() encryptionConfigAutomaticReloadsTotal.Reset() </ins> RegisterMetrics() RecordEncryptionConfigAutomaticReloadFailure(testAPIServerID) <del> if err := testutil.GatherAndCompare(legacyregistry.DefaultGatherer, strings.NewReader(expectedValue), metrics...); err != nil { </del> <ins> if err := testutil.GatherAndCompare(registry, strings.NewReader(expectedValue), metricNames...); err != nil { </ins> t.Fatal(err) } } func TestRecordEncryptionConfigAutomaticReloadSuccess(t *testing.T) { <ins> registry := testMetricsRegistry(t) </ins> expectedValue := ` <del> # HELP apiserver_encryption_config_controller_automatic_reload_success_total [ALPHA] Total number of successful automatic reloads of encryption configuration split by apiserver identity. </del> <ins> # HELP apiserver_encryption_config_controller_automatic_reload_success_total [ALPHA] (Deprecated since 1.30.0) Total number of successful automatic reloads of encryption configuration split by apiserver identity. </ins> # TYPE apiserver_encryption_config_controller_automatic_reload_success_total counter apiserver_encryption_config_controller_automatic_reload_success_total {apiserver_id_hash="sha256:14f9d63e669337ac6bfda2e2162915ee6a6067743eddd4e5c374b572f951ff37"} 1 <ins> # HELP apiserver_encryption_config_controller_automatic_reloads_total [ALPHA] Total number of reload successes and failures of encryption configuration split by apiserver identity. # TYPE apiserver_encryption_config_controller_automatic_reloads_total counter apiserver_encryption_config_controller_automatic_reloads_total {apiserver_id_hash="sha256:14f9d63e669337ac6bfda2e2162915ee6a6067743eddd4e5c374b572f951ff37",status="success"} 1 </ins> ` <del> metrics := []string{ </del> <ins> metricNames := []string{ </ins> namespace + "_" + subsystem + "_automatic_reload_success_total", <ins> namespace + "_" + subsystem + "_automatic_reloads_total", </ins> } <del> encryptionConfigAutomaticReloadSuccessTotal.Reset() </del> <ins> deprecatedEncryptionConfigAutomaticReloadSuccessTotal.Reset() encryptionConfigAutomaticReloadsTotal.Reset() </ins> RegisterMetrics() RecordEncryptionConfigAutomaticReloadSuccess(testAPIServerID) <del> if err := testutil.GatherAndCompare(legacyregistry.DefaultGatherer, strings.NewReader(expectedValue), metrics...); err != nil { </del> <ins> if err := testutil.GatherAndCompare(registry, strings.NewReader(expectedValue), metricNames...); err != nil { </ins> t.Fatal(err) } }

Discussion:
Change encryption config controller reload metrics to be consistent with other places (Authn, Authz) xref: Combine and into a single metric with with an enum value of and . /sig auth /triage accepted
cc
We probably should keep the existing metrics for some time to allow folks to migrate to the new one.
Ah I was thinking about this as well! Looking at "may be deleted at any time", I was leaning towards just removing it. If the common approach is to keep it for a release before removing, we could do that. I believe we can set a for the 2 metrics we want to remove.
I don't have a good sense of metrics stability because they tend to stay alpha forever and folks don't go back to update them. Since the associated feature set is GA, I think we should be conservative with the changes we make. Perhaps SIG instrumentation folks can provide some guidance here?
As part of the PR, I was going to ask when is the right time to graduate these metrics do you have thoughts on to take while deleting an alpha metric metrics should be graduated from alpha to beta and stable?