From 8ae3f80048af655f32c5cd51204900d2169273ed Mon Sep 17 00:00:00 2001 From: danielqsj Date: Fri, 12 Apr 2019 16:15:26 +0800 Subject: [PATCH] remove deprecated metrics of dockershim --- .../libdocker/instrumented_client.go | 4 -- pkg/kubelet/dockershim/metrics/metrics.go | 60 ------------------- .../dockershim/network/metrics/metrics.go | 16 ----- pkg/kubelet/dockershim/network/plugins.go | 1 - 4 files changed, 81 deletions(-) diff --git a/pkg/kubelet/dockershim/libdocker/instrumented_client.go b/pkg/kubelet/dockershim/libdocker/instrumented_client.go index 29c0f9e6b86..d2cefafb729 100644 --- a/pkg/kubelet/dockershim/libdocker/instrumented_client.go +++ b/pkg/kubelet/dockershim/libdocker/instrumented_client.go @@ -42,9 +42,7 @@ func NewInstrumentedInterface(dockerClient Interface) Interface { // recordOperation records the duration of the operation. func recordOperation(operation string, start time.Time) { metrics.DockerOperations.WithLabelValues(operation).Inc() - metrics.DeprecatedDockerOperations.WithLabelValues(operation).Inc() metrics.DockerOperationsLatency.WithLabelValues(operation).Observe(metrics.SinceInSeconds(start)) - metrics.DeprecatedDockerOperationsLatency.WithLabelValues(operation).Observe(metrics.SinceInMicroseconds(start)) } // recordError records error for metric if an error occurred. @@ -52,11 +50,9 @@ func recordError(operation string, err error) { if err != nil { if _, ok := err.(operationTimeout); ok { metrics.DockerOperationsTimeout.WithLabelValues(operation).Inc() - metrics.DeprecatedDockerOperationsTimeout.WithLabelValues(operation).Inc() } // Docker operation timeout error is also a docker error, so we don't add else here. metrics.DockerOperationsErrors.WithLabelValues(operation).Inc() - metrics.DeprecatedDockerOperationsErrors.WithLabelValues(operation).Inc() } } diff --git a/pkg/kubelet/dockershim/metrics/metrics.go b/pkg/kubelet/dockershim/metrics/metrics.go index 79a76f19c5f..e5fbd604d46 100644 --- a/pkg/kubelet/dockershim/metrics/metrics.go +++ b/pkg/kubelet/dockershim/metrics/metrics.go @@ -34,15 +34,6 @@ const ( // DockerOperationsTimeoutKey is the key for the operation timeout metrics. DockerOperationsTimeoutKey = "docker_operations_timeout_total" - // DeprecatedDockerOperationsKey is the deprecated key for docker operation metrics. - DeprecatedDockerOperationsKey = "docker_operations" - // DeprecatedDockerOperationsLatencyKey is the deprecated key for the operation latency metrics. - DeprecatedDockerOperationsLatencyKey = "docker_operations_latency_microseconds" - // DeprecatedDockerOperationsErrorsKey is the deprecated key for the operation error metrics. - DeprecatedDockerOperationsErrorsKey = "docker_operations_errors" - // DeprecatedDockerOperationsTimeoutKey is the deprecated key for the operation timeout metrics. - DeprecatedDockerOperationsTimeoutKey = "docker_operations_timeout" - // Keep the "kubelet" subsystem for backward compatibility. kubeletSubsystem = "kubelet" ) @@ -91,53 +82,6 @@ var ( }, []string{"operation_type"}, ) - - // DeprecatedDockerOperationsLatency collects operation latency numbers by operation - // type. - DeprecatedDockerOperationsLatency = metrics.NewSummaryVec( - &metrics.SummaryOpts{ - Subsystem: kubeletSubsystem, - Name: DeprecatedDockerOperationsLatencyKey, - Help: "Latency in microseconds of Docker operations. Broken down by operation type.", - StabilityLevel: metrics.ALPHA, - DeprecatedVersion: "1.14.0", - }, - []string{"operation_type"}, - ) - // DeprecatedDockerOperations collects operation counts by operation type. - DeprecatedDockerOperations = metrics.NewCounterVec( - &metrics.CounterOpts{ - Subsystem: kubeletSubsystem, - Name: DeprecatedDockerOperationsKey, - Help: "Cumulative number of Docker operations by operation type.", - StabilityLevel: metrics.ALPHA, - DeprecatedVersion: "1.14.0", - }, - []string{"operation_type"}, - ) - // DeprecatedDockerOperationsErrors collects operation errors by operation - // type. - DeprecatedDockerOperationsErrors = metrics.NewCounterVec( - &metrics.CounterOpts{ - Subsystem: kubeletSubsystem, - Name: DeprecatedDockerOperationsErrorsKey, - Help: "Cumulative number of Docker operation errors by operation type.", - StabilityLevel: metrics.ALPHA, - DeprecatedVersion: "1.14.0", - }, - []string{"operation_type"}, - ) - // DeprecatedDockerOperationsTimeout collects operation timeouts by operation type. - DeprecatedDockerOperationsTimeout = metrics.NewCounterVec( - &metrics.CounterOpts{ - Subsystem: kubeletSubsystem, - Name: DeprecatedDockerOperationsTimeoutKey, - Help: "Cumulative number of Docker operation timeout by operation type.", - StabilityLevel: metrics.ALPHA, - DeprecatedVersion: "1.14.0", - }, - []string{"operation_type"}, - ) ) var registerMetrics sync.Once @@ -149,10 +93,6 @@ func Register() { legacyregistry.MustRegister(DockerOperations) legacyregistry.MustRegister(DockerOperationsErrors) legacyregistry.MustRegister(DockerOperationsTimeout) - legacyregistry.MustRegister(DeprecatedDockerOperationsLatency) - legacyregistry.MustRegister(DeprecatedDockerOperations) - legacyregistry.MustRegister(DeprecatedDockerOperationsErrors) - legacyregistry.MustRegister(DeprecatedDockerOperationsTimeout) }) } diff --git a/pkg/kubelet/dockershim/network/metrics/metrics.go b/pkg/kubelet/dockershim/network/metrics/metrics.go index 234e35343d4..2e61f3313f1 100644 --- a/pkg/kubelet/dockershim/network/metrics/metrics.go +++ b/pkg/kubelet/dockershim/network/metrics/metrics.go @@ -29,8 +29,6 @@ const ( NetworkPluginOperationsKey = "network_plugin_operations" // NetworkPluginOperationsLatencyKey is the key for the operation latency metrics. NetworkPluginOperationsLatencyKey = "network_plugin_operations_duration_seconds" - // DeprecatedNetworkPluginOperationsLatencyKey is the deprecated key for the operation latency metrics. - DeprecatedNetworkPluginOperationsLatencyKey = "network_plugin_operations_latency_microseconds" // Keep the "kubelet" subsystem for backward compatibility. kubeletSubsystem = "kubelet" @@ -49,19 +47,6 @@ var ( }, []string{"operation_type"}, ) - - // DeprecatedNetworkPluginOperationsLatency collects operation latency numbers by operation - // type. - DeprecatedNetworkPluginOperationsLatency = metrics.NewSummaryVec( - &metrics.SummaryOpts{ - Subsystem: kubeletSubsystem, - Name: DeprecatedNetworkPluginOperationsLatencyKey, - Help: "Latency in microseconds of network plugin operations. Broken down by operation type.", - StabilityLevel: metrics.ALPHA, - DeprecatedVersion: "1.14.0", - }, - []string{"operation_type"}, - ) ) var registerMetrics sync.Once @@ -70,7 +55,6 @@ var registerMetrics sync.Once func Register() { registerMetrics.Do(func() { legacyregistry.MustRegister(NetworkPluginOperationsLatency) - legacyregistry.MustRegister(DeprecatedNetworkPluginOperationsLatency) }) } diff --git a/pkg/kubelet/dockershim/network/plugins.go b/pkg/kubelet/dockershim/network/plugins.go index 0daa7d8398b..9c904202ba3 100644 --- a/pkg/kubelet/dockershim/network/plugins.go +++ b/pkg/kubelet/dockershim/network/plugins.go @@ -381,7 +381,6 @@ func (pm *PluginManager) podUnlock(fullPodName string) { // recordOperation records operation and duration func recordOperation(operation string, start time.Time) { metrics.NetworkPluginOperationsLatency.WithLabelValues(operation).Observe(metrics.SinceInSeconds(start)) - metrics.DeprecatedNetworkPluginOperationsLatency.WithLabelValues(operation).Observe(metrics.SinceInMicroseconds(start)) } func (pm *PluginManager) GetPodNetworkStatus(podNamespace, podName string, id kubecontainer.ContainerID) (*PodNetworkStatus, error) {