Skip to content

Commit f4db821

Browse files
authored
Merge pull request kubernetes#76496 from danielqsj/metrics-2
Clean deprecated metrics
2 parents 61d36e4 + 0e8b956 commit f4db821

File tree

27 files changed

+30
-594
lines changed

27 files changed

+30
-594
lines changed

pkg/kubelet/cm/cgroup_manager_linux.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ func (m *cgroupManagerImpl) Destroy(cgroupConfig *CgroupConfig) error {
285285
start := time.Now()
286286
defer func() {
287287
metrics.CgroupManagerDuration.WithLabelValues("destroy").Observe(metrics.SinceInSeconds(start))
288-
metrics.DeprecatedCgroupManagerLatency.WithLabelValues("destroy").Observe(metrics.SinceInMicroseconds(start))
289288
}()
290289

291290
cgroupPaths := m.buildCgroupPaths(cgroupConfig.Name)
@@ -413,7 +412,6 @@ func (m *cgroupManagerImpl) Update(cgroupConfig *CgroupConfig) error {
413412
start := time.Now()
414413
defer func() {
415414
metrics.CgroupManagerDuration.WithLabelValues("update").Observe(metrics.SinceInSeconds(start))
416-
metrics.DeprecatedCgroupManagerLatency.WithLabelValues("update").Observe(metrics.SinceInMicroseconds(start))
417415
}()
418416

419417
// Extract the cgroup resource parameters
@@ -449,7 +447,6 @@ func (m *cgroupManagerImpl) Create(cgroupConfig *CgroupConfig) error {
449447
start := time.Now()
450448
defer func() {
451449
metrics.CgroupManagerDuration.WithLabelValues("create").Observe(metrics.SinceInSeconds(start))
452-
metrics.DeprecatedCgroupManagerLatency.WithLabelValues("create").Observe(metrics.SinceInMicroseconds(start))
453450
}()
454451

455452
resources := m.toResources(cgroupConfig.ResourceParameters)

pkg/kubelet/cm/devicemanager/manager.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ func (m *ManagerImpl) Allocate(node *schedulernodeinfo.NodeInfo, attrs *lifecycl
393393
func (m *ManagerImpl) Register(ctx context.Context, r *pluginapi.RegisterRequest) (*pluginapi.Empty, error) {
394394
klog.Infof("Got registration request from device plugin with resource name %q", r.ResourceName)
395395
metrics.DevicePluginRegistrationCount.WithLabelValues(r.ResourceName).Inc()
396-
metrics.DeprecatedDevicePluginRegistrationCount.WithLabelValues(r.ResourceName).Inc()
397396
var versionCompatible bool
398397
for _, v := range pluginapi.SupportedVersions {
399398
if r.Version == v {
@@ -814,7 +813,6 @@ func (m *ManagerImpl) allocateContainerResources(pod *v1.Pod, container *v1.Cont
814813
klog.V(3).Infof("Making allocation request for devices %v for device plugin %s", devs, resource)
815814
resp, err := eI.e.allocate(devs)
816815
metrics.DevicePluginAllocationDuration.WithLabelValues(resource).Observe(metrics.SinceInSeconds(startRPCTime))
817-
metrics.DeprecatedDevicePluginAllocationLatency.WithLabelValues(resource).Observe(metrics.SinceInMicroseconds(startRPCTime))
818816
if err != nil {
819817
// In case of allocation failure, we want to restore m.allocatedDevices
820818
// to the actual allocated state from m.podDevices.

pkg/kubelet/dockershim/libdocker/instrumented_client.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,17 @@ func NewInstrumentedInterface(dockerClient Interface) Interface {
4242
// recordOperation records the duration of the operation.
4343
func recordOperation(operation string, start time.Time) {
4444
metrics.DockerOperations.WithLabelValues(operation).Inc()
45-
metrics.DeprecatedDockerOperations.WithLabelValues(operation).Inc()
4645
metrics.DockerOperationsLatency.WithLabelValues(operation).Observe(metrics.SinceInSeconds(start))
47-
metrics.DeprecatedDockerOperationsLatency.WithLabelValues(operation).Observe(metrics.SinceInMicroseconds(start))
4846
}
4947

5048
// recordError records error for metric if an error occurred.
5149
func recordError(operation string, err error) {
5250
if err != nil {
5351
if _, ok := err.(operationTimeout); ok {
5452
metrics.DockerOperationsTimeout.WithLabelValues(operation).Inc()
55-
metrics.DeprecatedDockerOperationsTimeout.WithLabelValues(operation).Inc()
5653
}
5754
// Docker operation timeout error is also a docker error, so we don't add else here.
5855
metrics.DockerOperationsErrors.WithLabelValues(operation).Inc()
59-
metrics.DeprecatedDockerOperationsErrors.WithLabelValues(operation).Inc()
6056
}
6157
}
6258

pkg/kubelet/dockershim/metrics/metrics.go

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ const (
3434
// DockerOperationsTimeoutKey is the key for the operation timeout metrics.
3535
DockerOperationsTimeoutKey = "docker_operations_timeout_total"
3636

37-
// DeprecatedDockerOperationsKey is the deprecated key for docker operation metrics.
38-
DeprecatedDockerOperationsKey = "docker_operations"
39-
// DeprecatedDockerOperationsLatencyKey is the deprecated key for the operation latency metrics.
40-
DeprecatedDockerOperationsLatencyKey = "docker_operations_latency_microseconds"
41-
// DeprecatedDockerOperationsErrorsKey is the deprecated key for the operation error metrics.
42-
DeprecatedDockerOperationsErrorsKey = "docker_operations_errors"
43-
// DeprecatedDockerOperationsTimeoutKey is the deprecated key for the operation timeout metrics.
44-
DeprecatedDockerOperationsTimeoutKey = "docker_operations_timeout"
45-
4637
// Keep the "kubelet" subsystem for backward compatibility.
4738
kubeletSubsystem = "kubelet"
4839
)
@@ -91,53 +82,6 @@ var (
9182
},
9283
[]string{"operation_type"},
9384
)
94-
95-
// DeprecatedDockerOperationsLatency collects operation latency numbers by operation
96-
// type.
97-
DeprecatedDockerOperationsLatency = metrics.NewSummaryVec(
98-
&metrics.SummaryOpts{
99-
Subsystem: kubeletSubsystem,
100-
Name: DeprecatedDockerOperationsLatencyKey,
101-
Help: "Latency in microseconds of Docker operations. Broken down by operation type.",
102-
StabilityLevel: metrics.ALPHA,
103-
DeprecatedVersion: "1.14.0",
104-
},
105-
[]string{"operation_type"},
106-
)
107-
// DeprecatedDockerOperations collects operation counts by operation type.
108-
DeprecatedDockerOperations = metrics.NewCounterVec(
109-
&metrics.CounterOpts{
110-
Subsystem: kubeletSubsystem,
111-
Name: DeprecatedDockerOperationsKey,
112-
Help: "Cumulative number of Docker operations by operation type.",
113-
StabilityLevel: metrics.ALPHA,
114-
DeprecatedVersion: "1.14.0",
115-
},
116-
[]string{"operation_type"},
117-
)
118-
// DeprecatedDockerOperationsErrors collects operation errors by operation
119-
// type.
120-
DeprecatedDockerOperationsErrors = metrics.NewCounterVec(
121-
&metrics.CounterOpts{
122-
Subsystem: kubeletSubsystem,
123-
Name: DeprecatedDockerOperationsErrorsKey,
124-
Help: "Cumulative number of Docker operation errors by operation type.",
125-
StabilityLevel: metrics.ALPHA,
126-
DeprecatedVersion: "1.14.0",
127-
},
128-
[]string{"operation_type"},
129-
)
130-
// DeprecatedDockerOperationsTimeout collects operation timeouts by operation type.
131-
DeprecatedDockerOperationsTimeout = metrics.NewCounterVec(
132-
&metrics.CounterOpts{
133-
Subsystem: kubeletSubsystem,
134-
Name: DeprecatedDockerOperationsTimeoutKey,
135-
Help: "Cumulative number of Docker operation timeout by operation type.",
136-
StabilityLevel: metrics.ALPHA,
137-
DeprecatedVersion: "1.14.0",
138-
},
139-
[]string{"operation_type"},
140-
)
14185
)
14286

14387
var registerMetrics sync.Once
@@ -149,18 +93,9 @@ func Register() {
14993
legacyregistry.MustRegister(DockerOperations)
15094
legacyregistry.MustRegister(DockerOperationsErrors)
15195
legacyregistry.MustRegister(DockerOperationsTimeout)
152-
legacyregistry.MustRegister(DeprecatedDockerOperationsLatency)
153-
legacyregistry.MustRegister(DeprecatedDockerOperations)
154-
legacyregistry.MustRegister(DeprecatedDockerOperationsErrors)
155-
legacyregistry.MustRegister(DeprecatedDockerOperationsTimeout)
15696
})
15797
}
15898

159-
// SinceInMicroseconds gets the time since the specified start in microseconds.
160-
func SinceInMicroseconds(start time.Time) float64 {
161-
return float64(time.Since(start).Nanoseconds() / time.Microsecond.Nanoseconds())
162-
}
163-
16499
// SinceInSeconds gets the time since the specified start in seconds.
165100
func SinceInSeconds(start time.Time) float64 {
166101
return time.Since(start).Seconds()

pkg/kubelet/dockershim/network/metrics/metrics.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ const (
2929
NetworkPluginOperationsKey = "network_plugin_operations"
3030
// NetworkPluginOperationsLatencyKey is the key for the operation latency metrics.
3131
NetworkPluginOperationsLatencyKey = "network_plugin_operations_duration_seconds"
32-
// DeprecatedNetworkPluginOperationsLatencyKey is the deprecated key for the operation latency metrics.
33-
DeprecatedNetworkPluginOperationsLatencyKey = "network_plugin_operations_latency_microseconds"
3432

3533
// Keep the "kubelet" subsystem for backward compatibility.
3634
kubeletSubsystem = "kubelet"
@@ -49,19 +47,6 @@ var (
4947
},
5048
[]string{"operation_type"},
5149
)
52-
53-
// DeprecatedNetworkPluginOperationsLatency collects operation latency numbers by operation
54-
// type.
55-
DeprecatedNetworkPluginOperationsLatency = metrics.NewSummaryVec(
56-
&metrics.SummaryOpts{
57-
Subsystem: kubeletSubsystem,
58-
Name: DeprecatedNetworkPluginOperationsLatencyKey,
59-
Help: "Latency in microseconds of network plugin operations. Broken down by operation type.",
60-
StabilityLevel: metrics.ALPHA,
61-
DeprecatedVersion: "1.14.0",
62-
},
63-
[]string{"operation_type"},
64-
)
6550
)
6651

6752
var registerMetrics sync.Once
@@ -70,15 +55,9 @@ var registerMetrics sync.Once
7055
func Register() {
7156
registerMetrics.Do(func() {
7257
legacyregistry.MustRegister(NetworkPluginOperationsLatency)
73-
legacyregistry.MustRegister(DeprecatedNetworkPluginOperationsLatency)
7458
})
7559
}
7660

77-
// SinceInMicroseconds gets the time since the specified start in microseconds.
78-
func SinceInMicroseconds(start time.Time) float64 {
79-
return float64(time.Since(start).Nanoseconds() / time.Microsecond.Nanoseconds())
80-
}
81-
8261
// SinceInSeconds gets the time since the specified start in seconds.
8362
func SinceInSeconds(start time.Time) float64 {
8463
return time.Since(start).Seconds()

pkg/kubelet/dockershim/network/plugins.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,6 @@ func (pm *PluginManager) podUnlock(fullPodName string) {
381381
// recordOperation records operation and duration
382382
func recordOperation(operation string, start time.Time) {
383383
metrics.NetworkPluginOperationsLatency.WithLabelValues(operation).Observe(metrics.SinceInSeconds(start))
384-
metrics.DeprecatedNetworkPluginOperationsLatency.WithLabelValues(operation).Observe(metrics.SinceInMicroseconds(start))
385384
}
386385

387386
func (pm *PluginManager) GetPodNetworkStatus(podNamespace, podName string, id kubecontainer.ContainerID) (*PodNetworkStatus, error) {

pkg/kubelet/eviction/eviction_manager.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ func (m *managerImpl) synchronize(diskInfoProvider DiskInfoProvider, podFunc Act
363363
timeObserved := observations[t.Signal].time
364364
if !timeObserved.IsZero() {
365365
metrics.EvictionStatsAge.WithLabelValues(string(t.Signal)).Observe(metrics.SinceInSeconds(timeObserved.Time))
366-
metrics.DeprecatedEvictionStatsAge.WithLabelValues(string(t.Signal)).Observe(metrics.SinceInMicroseconds(timeObserved.Time))
367366
}
368367
}
369368

pkg/kubelet/kubelet.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,6 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error {
15251525
// This is the first time we are syncing the pod. Record the latency
15261526
// since kubelet first saw the pod if firstSeenTime is set.
15271527
metrics.PodWorkerStartDuration.Observe(metrics.SinceInSeconds(firstSeenTime))
1528-
metrics.DeprecatedPodWorkerStartLatency.Observe(metrics.SinceInMicroseconds(firstSeenTime))
15291528
} else {
15301529
klog.V(3).Infof("First seen time not recorded for pod %q", pod.UID)
15311530
}
@@ -1550,7 +1549,6 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error {
15501549
if !ok || existingStatus.Phase == v1.PodPending && apiPodStatus.Phase == v1.PodRunning &&
15511550
!firstSeenTime.IsZero() {
15521551
metrics.PodStartDuration.Observe(metrics.SinceInSeconds(firstSeenTime))
1553-
metrics.DeprecatedPodStartLatency.Observe(metrics.SinceInMicroseconds(firstSeenTime))
15541552
}
15551553

15561554
runnable := kl.canRunPod(pod)
@@ -2030,7 +2028,6 @@ func (kl *Kubelet) dispatchWork(pod *v1.Pod, syncType kubetypes.SyncPodType, mir
20302028
OnCompleteFunc: func(err error) {
20312029
if err != nil {
20322030
metrics.PodWorkerDuration.WithLabelValues(syncType.String()).Observe(metrics.SinceInSeconds(start))
2033-
metrics.DeprecatedPodWorkerLatency.WithLabelValues(syncType.String()).Observe(metrics.SinceInMicroseconds(start))
20342031
}
20352032
},
20362033
})

pkg/kubelet/kuberuntime/instrumented_services.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,13 @@ func newInstrumentedImageManagerService(service internalapi.ImageManagerService)
4949
// recordOperation records the duration of the operation.
5050
func recordOperation(operation string, start time.Time) {
5151
metrics.RuntimeOperations.WithLabelValues(operation).Inc()
52-
metrics.DeprecatedRuntimeOperations.WithLabelValues(operation).Inc()
5352
metrics.RuntimeOperationsDuration.WithLabelValues(operation).Observe(metrics.SinceInSeconds(start))
54-
metrics.DeprecatedRuntimeOperationsLatency.WithLabelValues(operation).Observe(metrics.SinceInMicroseconds(start))
5553
}
5654

5755
// recordError records error for metric if an error occurred.
5856
func recordError(operation string, err error) {
5957
if err != nil {
6058
metrics.RuntimeOperationsErrors.WithLabelValues(operation).Inc()
61-
metrics.DeprecatedRuntimeOperationsErrors.WithLabelValues(operation).Inc()
6259
}
6360
}
6461

0 commit comments

Comments
 (0)