mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #83837 from RainbowMango/pr_hide_apiserver_deprecated_metrics
Turn off apiserver deprecated metrics
This commit is contained in:
		@@ -76,9 +76,10 @@ var (
 | 
			
		||||
	)
 | 
			
		||||
	deprecatedRequestCounter = compbasemetrics.NewCounterVec(
 | 
			
		||||
		&compbasemetrics.CounterOpts{
 | 
			
		||||
			Name:           "apiserver_request_count",
 | 
			
		||||
			Help:           "(Deprecated) Counter of apiserver requests broken out for each verb, group, version, resource, scope, component, client, and HTTP response contentType and code.",
 | 
			
		||||
			StabilityLevel: compbasemetrics.ALPHA,
 | 
			
		||||
			Name:              "apiserver_request_count",
 | 
			
		||||
			Help:              "Counter of apiserver requests broken out for each verb, group, version, resource, scope, component, client, and HTTP response contentType and code.",
 | 
			
		||||
			StabilityLevel:    compbasemetrics.ALPHA,
 | 
			
		||||
			DeprecatedVersion: "1.14.0",
 | 
			
		||||
		},
 | 
			
		||||
		[]string{"verb", "group", "version", "resource", "subresource", "scope", "component", "client", "contentType", "code"},
 | 
			
		||||
	)
 | 
			
		||||
@@ -106,21 +107,23 @@ var (
 | 
			
		||||
	deprecatedRequestLatencies = compbasemetrics.NewHistogramVec(
 | 
			
		||||
		&compbasemetrics.HistogramOpts{
 | 
			
		||||
			Name: "apiserver_request_latencies",
 | 
			
		||||
			Help: "(Deprecated) Response latency distribution in microseconds for each verb, group, version, resource, subresource, scope and component.",
 | 
			
		||||
			Help: "Response latency distribution in microseconds for each verb, group, version, resource, subresource, scope and component.",
 | 
			
		||||
			// Use buckets ranging from 125 ms to 8 seconds.
 | 
			
		||||
			Buckets:        compbasemetrics.ExponentialBuckets(125000, 2.0, 7),
 | 
			
		||||
			StabilityLevel: compbasemetrics.ALPHA,
 | 
			
		||||
			Buckets:           compbasemetrics.ExponentialBuckets(125000, 2.0, 7),
 | 
			
		||||
			StabilityLevel:    compbasemetrics.ALPHA,
 | 
			
		||||
			DeprecatedVersion: "1.14.0",
 | 
			
		||||
		},
 | 
			
		||||
		[]string{"verb", "group", "version", "resource", "subresource", "scope", "component"},
 | 
			
		||||
	)
 | 
			
		||||
	deprecatedRequestLatenciesSummary = compbasemetrics.NewSummaryVec(
 | 
			
		||||
		&compbasemetrics.SummaryOpts{
 | 
			
		||||
			Name: "apiserver_request_latencies_summary",
 | 
			
		||||
			Help: "(Deprecated) Response latency summary in microseconds for each verb, group, version, resource, subresource, scope and component.",
 | 
			
		||||
			Help: "Response latency summary in microseconds for each verb, group, version, resource, subresource, scope and component.",
 | 
			
		||||
			// Make the sliding window of 5h.
 | 
			
		||||
			// TODO: The value for this should be based on our SLI definition (medium term).
 | 
			
		||||
			MaxAge:         5 * time.Hour,
 | 
			
		||||
			StabilityLevel: compbasemetrics.ALPHA,
 | 
			
		||||
			MaxAge:            5 * time.Hour,
 | 
			
		||||
			StabilityLevel:    compbasemetrics.ALPHA,
 | 
			
		||||
			DeprecatedVersion: "1.14.0",
 | 
			
		||||
		},
 | 
			
		||||
		[]string{"verb", "group", "version", "resource", "subresource", "scope", "component"},
 | 
			
		||||
	)
 | 
			
		||||
@@ -145,9 +148,10 @@ var (
 | 
			
		||||
	)
 | 
			
		||||
	DeprecatedDroppedRequests = compbasemetrics.NewCounterVec(
 | 
			
		||||
		&compbasemetrics.CounterOpts{
 | 
			
		||||
			Name:           "apiserver_dropped_requests",
 | 
			
		||||
			Help:           "(Deprecated) Number of requests dropped with 'Try again later' response",
 | 
			
		||||
			StabilityLevel: compbasemetrics.ALPHA,
 | 
			
		||||
			Name:              "apiserver_dropped_requests",
 | 
			
		||||
			Help:              "Number of requests dropped with 'Try again later' response",
 | 
			
		||||
			StabilityLevel:    compbasemetrics.ALPHA,
 | 
			
		||||
			DeprecatedVersion: "1.14.0",
 | 
			
		||||
		},
 | 
			
		||||
		[]string{"requestKind"},
 | 
			
		||||
	)
 | 
			
		||||
 
 | 
			
		||||
@@ -52,9 +52,10 @@ var (
 | 
			
		||||
 | 
			
		||||
	deprecatedEtcdRequestLatenciesSummary = compbasemetrics.NewSummaryVec(
 | 
			
		||||
		&compbasemetrics.SummaryOpts{
 | 
			
		||||
			Name:           "etcd_request_latencies_summary",
 | 
			
		||||
			Help:           "(Deprecated) Etcd request latency summary in microseconds for each operation and object type.",
 | 
			
		||||
			StabilityLevel: compbasemetrics.ALPHA,
 | 
			
		||||
			Name:              "etcd_request_latencies_summary",
 | 
			
		||||
			Help:              "Etcd request latency summary in microseconds for each operation and object type.",
 | 
			
		||||
			StabilityLevel:    compbasemetrics.ALPHA,
 | 
			
		||||
			DeprecatedVersion: "1.14.0",
 | 
			
		||||
		},
 | 
			
		||||
		[]string{"operation", "type"},
 | 
			
		||||
	)
 | 
			
		||||
 
 | 
			
		||||
@@ -58,11 +58,12 @@ var (
 | 
			
		||||
			Namespace: namespace,
 | 
			
		||||
			Subsystem: subsystem,
 | 
			
		||||
			Name:      "transformation_latencies_microseconds",
 | 
			
		||||
			Help:      "(Deprecated) Latencies in microseconds of value transformation operations.",
 | 
			
		||||
			Help:      "Latencies in microseconds of value transformation operations.",
 | 
			
		||||
			// In-process transformations (ex. AES CBC) complete on the order of 20 microseconds. However, when
 | 
			
		||||
			// external KMS is involved latencies may climb into milliseconds.
 | 
			
		||||
			Buckets:        metrics.ExponentialBuckets(5, 2, 14),
 | 
			
		||||
			StabilityLevel: metrics.ALPHA,
 | 
			
		||||
			Buckets:           metrics.ExponentialBuckets(5, 2, 14),
 | 
			
		||||
			StabilityLevel:    metrics.ALPHA,
 | 
			
		||||
			DeprecatedVersion: "1.14.0",
 | 
			
		||||
		},
 | 
			
		||||
		[]string{"transformation_type"},
 | 
			
		||||
	)
 | 
			
		||||
@@ -80,11 +81,12 @@ var (
 | 
			
		||||
 | 
			
		||||
	deprecatedTransformerFailuresTotal = metrics.NewCounterVec(
 | 
			
		||||
		&metrics.CounterOpts{
 | 
			
		||||
			Namespace:      namespace,
 | 
			
		||||
			Subsystem:      subsystem,
 | 
			
		||||
			Name:           "transformation_failures_total",
 | 
			
		||||
			Help:           "(Deprecated) Total number of failed transformation operations.",
 | 
			
		||||
			StabilityLevel: metrics.ALPHA,
 | 
			
		||||
			Namespace:         namespace,
 | 
			
		||||
			Subsystem:         subsystem,
 | 
			
		||||
			Name:              "transformation_failures_total",
 | 
			
		||||
			Help:              "Total number of failed transformation operations.",
 | 
			
		||||
			StabilityLevel:    metrics.ALPHA,
 | 
			
		||||
			DeprecatedVersion: "1.15.0",
 | 
			
		||||
		},
 | 
			
		||||
		[]string{"transformation_type"},
 | 
			
		||||
	)
 | 
			
		||||
@@ -111,12 +113,13 @@ var (
 | 
			
		||||
	)
 | 
			
		||||
	deprecatedDataKeyGenerationLatencies = metrics.NewHistogram(
 | 
			
		||||
		&metrics.HistogramOpts{
 | 
			
		||||
			Namespace:      namespace,
 | 
			
		||||
			Subsystem:      subsystem,
 | 
			
		||||
			Name:           "data_key_generation_latencies_microseconds",
 | 
			
		||||
			Help:           "(Deprecated) Latencies in microseconds of data encryption key(DEK) generation operations.",
 | 
			
		||||
			Buckets:        metrics.ExponentialBuckets(5, 2, 14),
 | 
			
		||||
			StabilityLevel: metrics.ALPHA,
 | 
			
		||||
			Namespace:         namespace,
 | 
			
		||||
			Subsystem:         subsystem,
 | 
			
		||||
			Name:              "data_key_generation_latencies_microseconds",
 | 
			
		||||
			Help:              "Latencies in microseconds of data encryption key(DEK) generation operations.",
 | 
			
		||||
			Buckets:           metrics.ExponentialBuckets(5, 2, 14),
 | 
			
		||||
			StabilityLevel:    metrics.ALPHA,
 | 
			
		||||
			DeprecatedVersion: "1.14.0",
 | 
			
		||||
		},
 | 
			
		||||
	)
 | 
			
		||||
	dataKeyGenerationFailuresTotal = metrics.NewCounter(
 | 
			
		||||
 
 | 
			
		||||
@@ -48,68 +48,52 @@ func TestTotals(t *testing.T) {
 | 
			
		||||
			prefix: NewPrefixTransformers(nil, nonStatusErrTransformer),
 | 
			
		||||
			metrics: []string{
 | 
			
		||||
				"apiserver_storage_transformation_operations_total",
 | 
			
		||||
				"apiserver_storage_transformation_failures_total",
 | 
			
		||||
			},
 | 
			
		||||
			want: `
 | 
			
		||||
# HELP apiserver_storage_transformation_failures_total [ALPHA] (Deprecated) Total number of failed transformation operations.
 | 
			
		||||
# TYPE apiserver_storage_transformation_failures_total counter
 | 
			
		||||
apiserver_storage_transformation_failures_total{transformation_type="from_storage"} 1
 | 
			
		||||
apiserver_storage_transformation_failures_total{transformation_type="to_storage"} 1
 | 
			
		||||
# HELP apiserver_storage_transformation_operations_total [ALPHA] Total number of transformations.
 | 
			
		||||
# TYPE apiserver_storage_transformation_operations_total counter
 | 
			
		||||
apiserver_storage_transformation_operations_total{status="Unknown",transformation_type="from_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
apiserver_storage_transformation_operations_total{status="Unknown",transformation_type="to_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
`,
 | 
			
		||||
				# HELP apiserver_storage_transformation_operations_total [ALPHA] Total number of transformations.
 | 
			
		||||
				# TYPE apiserver_storage_transformation_operations_total counter
 | 
			
		||||
				apiserver_storage_transformation_operations_total{status="Unknown",transformation_type="from_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
				apiserver_storage_transformation_operations_total{status="Unknown",transformation_type="to_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
				`,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			desc:   "ok",
 | 
			
		||||
			prefix: NewPrefixTransformers(nil, okTransformer),
 | 
			
		||||
			metrics: []string{
 | 
			
		||||
				"apiserver_storage_transformation_operations_total",
 | 
			
		||||
				"apiserver_storage_transformation_failures_total",
 | 
			
		||||
			},
 | 
			
		||||
			want: `
 | 
			
		||||
# HELP apiserver_storage_transformation_operations_total [ALPHA] Total number of transformations.
 | 
			
		||||
# TYPE apiserver_storage_transformation_operations_total counter
 | 
			
		||||
apiserver_storage_transformation_operations_total{status="OK",transformation_type="from_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
apiserver_storage_transformation_operations_total{status="OK",transformation_type="to_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
`,
 | 
			
		||||
				# HELP apiserver_storage_transformation_operations_total [ALPHA] Total number of transformations.
 | 
			
		||||
				# TYPE apiserver_storage_transformation_operations_total counter
 | 
			
		||||
				apiserver_storage_transformation_operations_total{status="OK",transformation_type="from_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
				apiserver_storage_transformation_operations_total{status="OK",transformation_type="to_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
				`,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			desc:   "failed precondition",
 | 
			
		||||
			prefix: NewPrefixTransformers(nil, failedPreconditionErrTransformer),
 | 
			
		||||
			metrics: []string{
 | 
			
		||||
				"apiserver_storage_transformation_operations_total",
 | 
			
		||||
				"apiserver_storage_transformation_failures_total",
 | 
			
		||||
			},
 | 
			
		||||
			want: `
 | 
			
		||||
# HELP apiserver_storage_transformation_failures_total [ALPHA] (Deprecated) Total number of failed transformation operations.
 | 
			
		||||
# TYPE apiserver_storage_transformation_failures_total counter
 | 
			
		||||
apiserver_storage_transformation_failures_total{transformation_type="from_storage"} 1
 | 
			
		||||
apiserver_storage_transformation_failures_total{transformation_type="to_storage"} 1
 | 
			
		||||
# HELP apiserver_storage_transformation_operations_total [ALPHA] Total number of transformations.
 | 
			
		||||
# TYPE apiserver_storage_transformation_operations_total counter
 | 
			
		||||
apiserver_storage_transformation_operations_total{status="FailedPrecondition",transformation_type="from_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
apiserver_storage_transformation_operations_total{status="FailedPrecondition",transformation_type="to_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
`,
 | 
			
		||||
				# HELP apiserver_storage_transformation_operations_total [ALPHA] Total number of transformations.
 | 
			
		||||
				# TYPE apiserver_storage_transformation_operations_total counter
 | 
			
		||||
				apiserver_storage_transformation_operations_total{status="FailedPrecondition",transformation_type="from_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
				apiserver_storage_transformation_operations_total{status="FailedPrecondition",transformation_type="to_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
				`,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			desc:   "internal",
 | 
			
		||||
			prefix: NewPrefixTransformers(nil, internalErrTransformer),
 | 
			
		||||
			metrics: []string{
 | 
			
		||||
				"apiserver_storage_transformation_operations_total",
 | 
			
		||||
				"apiserver_storage_transformation_failures_total",
 | 
			
		||||
			},
 | 
			
		||||
			want: `
 | 
			
		||||
# HELP apiserver_storage_transformation_failures_total [ALPHA] (Deprecated) Total number of failed transformation operations.
 | 
			
		||||
# TYPE apiserver_storage_transformation_failures_total counter
 | 
			
		||||
apiserver_storage_transformation_failures_total{transformation_type="from_storage"} 1
 | 
			
		||||
apiserver_storage_transformation_failures_total{transformation_type="to_storage"} 1
 | 
			
		||||
# HELP apiserver_storage_transformation_operations_total [ALPHA] Total number of transformations.
 | 
			
		||||
# TYPE apiserver_storage_transformation_operations_total counter
 | 
			
		||||
apiserver_storage_transformation_operations_total{status="Internal",transformation_type="from_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
apiserver_storage_transformation_operations_total{status="Internal",transformation_type="to_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
`,
 | 
			
		||||
				# HELP apiserver_storage_transformation_operations_total [ALPHA] Total number of transformations.
 | 
			
		||||
				# TYPE apiserver_storage_transformation_operations_total counter
 | 
			
		||||
				apiserver_storage_transformation_operations_total{status="Internal",transformation_type="from_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
				apiserver_storage_transformation_operations_total{status="Internal",transformation_type="to_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
 | 
			
		||||
				`,
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -18,9 +18,7 @@ package metrics
 | 
			
		||||
 | 
			
		||||
var interestingAPIServerMetrics = []string{
 | 
			
		||||
	"apiserver_request_total",
 | 
			
		||||
	// TODO(krzysied): apiserver_request_latencies_summary is a deprecated metric.
 | 
			
		||||
	// It should be replaced with new metric.
 | 
			
		||||
	"apiserver_request_latencies_summary",
 | 
			
		||||
	"apiserver_request_latency_seconds",
 | 
			
		||||
	"apiserver_init_events_total",
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user