Skip to content

Commit 7342823

Browse files
authored
Merge pull request kubernetes#83223 from RainbowMango/pr_remove_direct_reference_to_prom_label
Remove direct reference to prometheus.Label
2 parents cd95e57 + b915774 commit 7342823

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ go_library(
2929
"//staging/src/k8s.io/client-go/pkg/version:go_default_library",
3030
"//staging/src/k8s.io/component-base/metrics:go_default_library",
3131
"//staging/src/k8s.io/component-base/metrics/legacyregistry:go_default_library",
32-
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
3332
"//vendor/github.com/vmware/govmomi/find:go_default_library",
3433
"//vendor/github.com/vmware/govmomi/object:go_default_library",
3534
"//vendor/github.com/vmware/govmomi/pbm:go_default_library",

staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/vsphere_metrics.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ package vclib
1919
import (
2020
"time"
2121

22-
"github.com/prometheus/client_golang/prometheus"
23-
2422
"k8s.io/component-base/metrics"
2523
"k8s.io/component-base/metrics/legacyregistry"
2624
)
@@ -103,17 +101,17 @@ func RecordvSphereMetric(actionName string, requestTime time.Time, err error) {
103101

104102
func recordvSphereAPIMetric(actionName string, requestTime time.Time, err error) {
105103
if err != nil {
106-
vsphereAPIErrorMetric.With(prometheus.Labels{"request": actionName}).Inc()
104+
vsphereAPIErrorMetric.With(metrics.Labels{"request": actionName}).Inc()
107105
} else {
108-
vsphereAPIMetric.With(prometheus.Labels{"request": actionName}).Observe(calculateTimeTaken(requestTime))
106+
vsphereAPIMetric.With(metrics.Labels{"request": actionName}).Observe(calculateTimeTaken(requestTime))
109107
}
110108
}
111109

112110
func recordvSphereOperationMetric(actionName string, requestTime time.Time, err error) {
113111
if err != nil {
114-
vsphereOperationErrorMetric.With(prometheus.Labels{"operation": actionName}).Inc()
112+
vsphereOperationErrorMetric.With(metrics.Labels{"operation": actionName}).Inc()
115113
} else {
116-
vsphereOperationMetric.With(prometheus.Labels{"operation": actionName}).Observe(calculateTimeTaken(requestTime))
114+
vsphereOperationMetric.With(metrics.Labels{"operation": actionName}).Observe(calculateTimeTaken(requestTime))
117115
}
118116
}
119117

0 commit comments

Comments
 (0)