Skip to content

Commit f0b43b0

Browse files
committed
Remove global variables
1 parent 46a9877 commit f0b43b0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

internal/metrics/collectors/workqueue.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ import (
55
"k8s.io/client-go/util/workqueue"
66
)
77

8-
const workqueueSubsystem = "workqueue"
9-
10-
var workqueueLatencyBucketsSeconds = []float64{0.1, 0.5, 1, 5, 10, 50}
11-
128
// WorkQueueMetricsCollector collects the metrics about the work queue, which the Ingress Controller uses to process changes to the resources in the cluster.
139
// implements the prometheus.Collector interface
1410
type WorkQueueMetricsCollector struct {
@@ -19,6 +15,9 @@ type WorkQueueMetricsCollector struct {
1915

2016
// NewWorkQueueMetricsCollector creates a new WorkQueueMetricsCollector
2117
func NewWorkQueueMetricsCollector(constLabels map[string]string) *WorkQueueMetricsCollector {
18+
const workqueueSubsystem = "workqueue"
19+
var latencyBucketSeconds = []float64{0.1, 0.5, 1, 5, 10, 50}
20+
2221
return &WorkQueueMetricsCollector{
2322
depth: prometheus.NewGaugeVec(
2423
prometheus.GaugeOpts{
@@ -36,7 +35,7 @@ func NewWorkQueueMetricsCollector(constLabels map[string]string) *WorkQueueMetri
3635
Subsystem: workqueueSubsystem,
3736
Name: "queue_duration_seconds",
3837
Help: "How long in seconds an item stays in workqueue before being processed",
39-
Buckets: workqueueLatencyBucketsSeconds,
38+
Buckets: latencyBucketSeconds,
4039
ConstLabels: constLabels,
4140
},
4241
[]string{"name"},
@@ -47,7 +46,7 @@ func NewWorkQueueMetricsCollector(constLabels map[string]string) *WorkQueueMetri
4746
Subsystem: workqueueSubsystem,
4847
Name: "work_duration_seconds",
4948
Help: "How long in seconds processing an item from workqueue takes",
50-
Buckets: workqueueLatencyBucketsSeconds,
49+
Buckets: latencyBucketSeconds,
5150
ConstLabels: constLabels,
5251
},
5352
[]string{"name"},

0 commit comments

Comments
 (0)