Merge pull request #83837 from RainbowMango/pr_hide_apiserver_deprecated_metrics

Turn off apiserver deprecated metrics
This commit is contained in:
Kubernetes Prow Robot 2019-11-16 20:25:40 -08:00 committed by GitHub
commit beaf3a2f04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 58 additions and 68 deletions

View File

@ -76,9 +76,10 @@ var (
) )
deprecatedRequestCounter = compbasemetrics.NewCounterVec( deprecatedRequestCounter = compbasemetrics.NewCounterVec(
&compbasemetrics.CounterOpts{ &compbasemetrics.CounterOpts{
Name: "apiserver_request_count", 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.", 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, StabilityLevel: compbasemetrics.ALPHA,
DeprecatedVersion: "1.14.0",
}, },
[]string{"verb", "group", "version", "resource", "subresource", "scope", "component", "client", "contentType", "code"}, []string{"verb", "group", "version", "resource", "subresource", "scope", "component", "client", "contentType", "code"},
) )
@ -106,21 +107,23 @@ var (
deprecatedRequestLatencies = compbasemetrics.NewHistogramVec( deprecatedRequestLatencies = compbasemetrics.NewHistogramVec(
&compbasemetrics.HistogramOpts{ &compbasemetrics.HistogramOpts{
Name: "apiserver_request_latencies", 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. // Use buckets ranging from 125 ms to 8 seconds.
Buckets: compbasemetrics.ExponentialBuckets(125000, 2.0, 7), Buckets: compbasemetrics.ExponentialBuckets(125000, 2.0, 7),
StabilityLevel: compbasemetrics.ALPHA, StabilityLevel: compbasemetrics.ALPHA,
DeprecatedVersion: "1.14.0",
}, },
[]string{"verb", "group", "version", "resource", "subresource", "scope", "component"}, []string{"verb", "group", "version", "resource", "subresource", "scope", "component"},
) )
deprecatedRequestLatenciesSummary = compbasemetrics.NewSummaryVec( deprecatedRequestLatenciesSummary = compbasemetrics.NewSummaryVec(
&compbasemetrics.SummaryOpts{ &compbasemetrics.SummaryOpts{
Name: "apiserver_request_latencies_summary", 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. // Make the sliding window of 5h.
// TODO: The value for this should be based on our SLI definition (medium term). // TODO: The value for this should be based on our SLI definition (medium term).
MaxAge: 5 * time.Hour, MaxAge: 5 * time.Hour,
StabilityLevel: compbasemetrics.ALPHA, StabilityLevel: compbasemetrics.ALPHA,
DeprecatedVersion: "1.14.0",
}, },
[]string{"verb", "group", "version", "resource", "subresource", "scope", "component"}, []string{"verb", "group", "version", "resource", "subresource", "scope", "component"},
) )
@ -145,9 +148,10 @@ var (
) )
DeprecatedDroppedRequests = compbasemetrics.NewCounterVec( DeprecatedDroppedRequests = compbasemetrics.NewCounterVec(
&compbasemetrics.CounterOpts{ &compbasemetrics.CounterOpts{
Name: "apiserver_dropped_requests", Name: "apiserver_dropped_requests",
Help: "(Deprecated) Number of requests dropped with 'Try again later' response", Help: "Number of requests dropped with 'Try again later' response",
StabilityLevel: compbasemetrics.ALPHA, StabilityLevel: compbasemetrics.ALPHA,
DeprecatedVersion: "1.14.0",
}, },
[]string{"requestKind"}, []string{"requestKind"},
) )

View File

@ -52,9 +52,10 @@ var (
deprecatedEtcdRequestLatenciesSummary = compbasemetrics.NewSummaryVec( deprecatedEtcdRequestLatenciesSummary = compbasemetrics.NewSummaryVec(
&compbasemetrics.SummaryOpts{ &compbasemetrics.SummaryOpts{
Name: "etcd_request_latencies_summary", Name: "etcd_request_latencies_summary",
Help: "(Deprecated) Etcd request latency summary in microseconds for each operation and object type.", Help: "Etcd request latency summary in microseconds for each operation and object type.",
StabilityLevel: compbasemetrics.ALPHA, StabilityLevel: compbasemetrics.ALPHA,
DeprecatedVersion: "1.14.0",
}, },
[]string{"operation", "type"}, []string{"operation", "type"},
) )

View File

@ -58,11 +58,12 @@ var (
Namespace: namespace, Namespace: namespace,
Subsystem: subsystem, Subsystem: subsystem,
Name: "transformation_latencies_microseconds", 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 // In-process transformations (ex. AES CBC) complete on the order of 20 microseconds. However, when
// external KMS is involved latencies may climb into milliseconds. // external KMS is involved latencies may climb into milliseconds.
Buckets: metrics.ExponentialBuckets(5, 2, 14), Buckets: metrics.ExponentialBuckets(5, 2, 14),
StabilityLevel: metrics.ALPHA, StabilityLevel: metrics.ALPHA,
DeprecatedVersion: "1.14.0",
}, },
[]string{"transformation_type"}, []string{"transformation_type"},
) )
@ -80,11 +81,12 @@ var (
deprecatedTransformerFailuresTotal = metrics.NewCounterVec( deprecatedTransformerFailuresTotal = metrics.NewCounterVec(
&metrics.CounterOpts{ &metrics.CounterOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: subsystem, Subsystem: subsystem,
Name: "transformation_failures_total", Name: "transformation_failures_total",
Help: "(Deprecated) Total number of failed transformation operations.", Help: "Total number of failed transformation operations.",
StabilityLevel: metrics.ALPHA, StabilityLevel: metrics.ALPHA,
DeprecatedVersion: "1.15.0",
}, },
[]string{"transformation_type"}, []string{"transformation_type"},
) )
@ -111,12 +113,13 @@ var (
) )
deprecatedDataKeyGenerationLatencies = metrics.NewHistogram( deprecatedDataKeyGenerationLatencies = metrics.NewHistogram(
&metrics.HistogramOpts{ &metrics.HistogramOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: subsystem, Subsystem: subsystem,
Name: "data_key_generation_latencies_microseconds", Name: "data_key_generation_latencies_microseconds",
Help: "(Deprecated) Latencies in microseconds of data encryption key(DEK) generation operations.", Help: "Latencies in microseconds of data encryption key(DEK) generation operations.",
Buckets: metrics.ExponentialBuckets(5, 2, 14), Buckets: metrics.ExponentialBuckets(5, 2, 14),
StabilityLevel: metrics.ALPHA, StabilityLevel: metrics.ALPHA,
DeprecatedVersion: "1.14.0",
}, },
) )
dataKeyGenerationFailuresTotal = metrics.NewCounter( dataKeyGenerationFailuresTotal = metrics.NewCounter(

View File

@ -48,68 +48,52 @@ func TestTotals(t *testing.T) {
prefix: NewPrefixTransformers(nil, nonStatusErrTransformer), prefix: NewPrefixTransformers(nil, nonStatusErrTransformer),
metrics: []string{ metrics: []string{
"apiserver_storage_transformation_operations_total", "apiserver_storage_transformation_operations_total",
"apiserver_storage_transformation_failures_total",
}, },
want: ` want: `
# HELP apiserver_storage_transformation_failures_total [ALPHA] (Deprecated) Total number of failed transformation operations. # HELP apiserver_storage_transformation_operations_total [ALPHA] Total number of transformations.
# TYPE apiserver_storage_transformation_failures_total counter # TYPE apiserver_storage_transformation_operations_total counter
apiserver_storage_transformation_failures_total{transformation_type="from_storage"} 1 apiserver_storage_transformation_operations_total{status="Unknown",transformation_type="from_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
apiserver_storage_transformation_failures_total{transformation_type="to_storage"} 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", desc: "ok",
prefix: NewPrefixTransformers(nil, okTransformer), prefix: NewPrefixTransformers(nil, okTransformer),
metrics: []string{ metrics: []string{
"apiserver_storage_transformation_operations_total", "apiserver_storage_transformation_operations_total",
"apiserver_storage_transformation_failures_total",
}, },
want: ` want: `
# HELP apiserver_storage_transformation_operations_total [ALPHA] Total number of transformations. # HELP apiserver_storage_transformation_operations_total [ALPHA] Total number of transformations.
# TYPE apiserver_storage_transformation_operations_total counter # 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="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 apiserver_storage_transformation_operations_total{status="OK",transformation_type="to_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
`, `,
}, },
{ {
desc: "failed precondition", desc: "failed precondition",
prefix: NewPrefixTransformers(nil, failedPreconditionErrTransformer), prefix: NewPrefixTransformers(nil, failedPreconditionErrTransformer),
metrics: []string{ metrics: []string{
"apiserver_storage_transformation_operations_total", "apiserver_storage_transformation_operations_total",
"apiserver_storage_transformation_failures_total",
}, },
want: ` want: `
# HELP apiserver_storage_transformation_failures_total [ALPHA] (Deprecated) Total number of failed transformation operations. # HELP apiserver_storage_transformation_operations_total [ALPHA] Total number of transformations.
# TYPE apiserver_storage_transformation_failures_total counter # TYPE apiserver_storage_transformation_operations_total counter
apiserver_storage_transformation_failures_total{transformation_type="from_storage"} 1 apiserver_storage_transformation_operations_total{status="FailedPrecondition",transformation_type="from_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
apiserver_storage_transformation_failures_total{transformation_type="to_storage"} 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", desc: "internal",
prefix: NewPrefixTransformers(nil, internalErrTransformer), prefix: NewPrefixTransformers(nil, internalErrTransformer),
metrics: []string{ metrics: []string{
"apiserver_storage_transformation_operations_total", "apiserver_storage_transformation_operations_total",
"apiserver_storage_transformation_failures_total",
}, },
want: ` want: `
# HELP apiserver_storage_transformation_failures_total [ALPHA] (Deprecated) Total number of failed transformation operations. # HELP apiserver_storage_transformation_operations_total [ALPHA] Total number of transformations.
# TYPE apiserver_storage_transformation_failures_total counter # TYPE apiserver_storage_transformation_operations_total counter
apiserver_storage_transformation_failures_total{transformation_type="from_storage"} 1 apiserver_storage_transformation_operations_total{status="Internal",transformation_type="from_storage",transformer_prefix="k8s:enc:kms:v1:"} 1
apiserver_storage_transformation_failures_total{transformation_type="to_storage"} 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
`,
}, },
} }

View File

@ -18,9 +18,7 @@ package metrics
var interestingAPIServerMetrics = []string{ var interestingAPIServerMetrics = []string{
"apiserver_request_total", "apiserver_request_total",
// TODO(krzysied): apiserver_request_latencies_summary is a deprecated metric. "apiserver_request_latency_seconds",
// It should be replaced with new metric.
"apiserver_request_latencies_summary",
"apiserver_init_events_total", "apiserver_init_events_total",
} }