Skip to content

Commit 8d55456

Browse files
authored
Merge pull request kubernetes-sigs#2895 from alvaroaleman/workq-controller
✨ Workqueue: Add `controller` label
2 parents 6785442 + 3006973 commit 8d55456

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

pkg/metrics/workqueue.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,27 @@ var (
4242
Subsystem: WorkQueueSubsystem,
4343
Name: DepthKey,
4444
Help: "Current depth of workqueue",
45-
}, []string{"name"})
45+
}, []string{"name", "controller"})
4646

4747
adds = prometheus.NewCounterVec(prometheus.CounterOpts{
4848
Subsystem: WorkQueueSubsystem,
4949
Name: AddsKey,
5050
Help: "Total number of adds handled by workqueue",
51-
}, []string{"name"})
51+
}, []string{"name", "controller"})
5252

5353
latency = prometheus.NewHistogramVec(prometheus.HistogramOpts{
5454
Subsystem: WorkQueueSubsystem,
5555
Name: QueueLatencyKey,
5656
Help: "How long in seconds an item stays in workqueue before being requested",
5757
Buckets: prometheus.ExponentialBuckets(10e-9, 10, 12),
58-
}, []string{"name"})
58+
}, []string{"name", "controller"})
5959

6060
workDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
6161
Subsystem: WorkQueueSubsystem,
6262
Name: WorkDurationKey,
6363
Help: "How long in seconds processing an item from workqueue takes.",
6464
Buckets: prometheus.ExponentialBuckets(10e-9, 10, 12),
65-
}, []string{"name"})
65+
}, []string{"name", "controller"})
6666

6767
unfinished = prometheus.NewGaugeVec(prometheus.GaugeOpts{
6868
Subsystem: WorkQueueSubsystem,
@@ -71,20 +71,20 @@ var (
7171
"is in progress and hasn't been observed by work_duration. Large " +
7272
"values indicate stuck threads. One can deduce the number of stuck " +
7373
"threads by observing the rate at which this increases.",
74-
}, []string{"name"})
74+
}, []string{"name", "controller"})
7575

7676
longestRunningProcessor = prometheus.NewGaugeVec(prometheus.GaugeOpts{
7777
Subsystem: WorkQueueSubsystem,
7878
Name: LongestRunningProcessorKey,
7979
Help: "How many seconds has the longest running " +
8080
"processor for workqueue been running.",
81-
}, []string{"name"})
81+
}, []string{"name", "controller"})
8282

8383
retries = prometheus.NewCounterVec(prometheus.CounterOpts{
8484
Subsystem: WorkQueueSubsystem,
8585
Name: RetriesKey,
8686
Help: "Total number of retries handled by workqueue",
87-
}, []string{"name"})
87+
}, []string{"name", "controller"})
8888
)
8989

9090
func init() {
@@ -102,29 +102,29 @@ func init() {
102102
type workqueueMetricsProvider struct{}
103103

104104
func (workqueueMetricsProvider) NewDepthMetric(name string) workqueue.GaugeMetric {
105-
return depth.WithLabelValues(name)
105+
return depth.WithLabelValues(name, name)
106106
}
107107

108108
func (workqueueMetricsProvider) NewAddsMetric(name string) workqueue.CounterMetric {
109-
return adds.WithLabelValues(name)
109+
return adds.WithLabelValues(name, name)
110110
}
111111

112112
func (workqueueMetricsProvider) NewLatencyMetric(name string) workqueue.HistogramMetric {
113-
return latency.WithLabelValues(name)
113+
return latency.WithLabelValues(name, name)
114114
}
115115

116116
func (workqueueMetricsProvider) NewWorkDurationMetric(name string) workqueue.HistogramMetric {
117-
return workDuration.WithLabelValues(name)
117+
return workDuration.WithLabelValues(name, name)
118118
}
119119

120120
func (workqueueMetricsProvider) NewUnfinishedWorkSecondsMetric(name string) workqueue.SettableGaugeMetric {
121-
return unfinished.WithLabelValues(name)
121+
return unfinished.WithLabelValues(name, name)
122122
}
123123

124124
func (workqueueMetricsProvider) NewLongestRunningProcessorSecondsMetric(name string) workqueue.SettableGaugeMetric {
125-
return longestRunningProcessor.WithLabelValues(name)
125+
return longestRunningProcessor.WithLabelValues(name, name)
126126
}
127127

128128
func (workqueueMetricsProvider) NewRetriesMetric(name string) workqueue.CounterMetric {
129-
return retries.WithLabelValues(name)
129+
return retries.WithLabelValues(name, name)
130130
}

0 commit comments

Comments
 (0)