@@ -22,7 +22,6 @@ import (
22
22
"time"
23
23
24
24
"github.com/prometheus/client_golang/prometheus"
25
- reflectormetrics "k8s.io/client-go/tools/cache"
26
25
clientmetrics "k8s.io/client-go/tools/metrics"
27
26
)
28
27
@@ -37,19 +36,6 @@ const (
37
36
ResultKey = "requests_total"
38
37
)
39
38
40
- // Metrics subsystem and all keys used by the reflectors.
41
- const (
42
- ReflectorSubsystem = "reflector"
43
- ListsTotalKey = "lists_total"
44
- ListsDurationKey = "list_duration_seconds"
45
- ItemsPerListKey = "items_per_list"
46
- WatchesTotalKey = "watches_total"
47
- ShortWatchesTotalKey = "short_watches_total"
48
- WatchDurationKey = "watch_duration_seconds"
49
- ItemsPerWatchKey = "items_per_watch"
50
- LastResourceVersionKey = "last_resource_version"
51
- )
52
-
53
39
var (
54
40
// client metrics.
55
41
@@ -81,64 +67,10 @@ var (
81
67
Name : ResultKey ,
82
68
Help : "Number of HTTP requests, partitioned by status code, method, and host." ,
83
69
}, []string {"code" , "method" , "host" })
84
-
85
- // reflector metrics.
86
-
87
- // TODO(directxman12): update these to be histograms once the metrics overhaul KEP
88
- // PRs start landing.
89
-
90
- listsTotal = prometheus .NewCounterVec (prometheus.CounterOpts {
91
- Subsystem : ReflectorSubsystem ,
92
- Name : ListsTotalKey ,
93
- Help : "Total number of API lists done by the reflectors" ,
94
- }, []string {"name" })
95
-
96
- listsDuration = prometheus .NewSummaryVec (prometheus.SummaryOpts {
97
- Subsystem : ReflectorSubsystem ,
98
- Name : ListsDurationKey ,
99
- Help : "How long an API list takes to return and decode for the reflectors" ,
100
- }, []string {"name" })
101
-
102
- itemsPerList = prometheus .NewSummaryVec (prometheus.SummaryOpts {
103
- Subsystem : ReflectorSubsystem ,
104
- Name : ItemsPerListKey ,
105
- Help : "How many items an API list returns to the reflectors" ,
106
- }, []string {"name" })
107
-
108
- watchesTotal = prometheus .NewCounterVec (prometheus.CounterOpts {
109
- Subsystem : ReflectorSubsystem ,
110
- Name : WatchesTotalKey ,
111
- Help : "Total number of API watches done by the reflectors" ,
112
- }, []string {"name" })
113
-
114
- shortWatchesTotal = prometheus .NewCounterVec (prometheus.CounterOpts {
115
- Subsystem : ReflectorSubsystem ,
116
- Name : ShortWatchesTotalKey ,
117
- Help : "Total number of short API watches done by the reflectors" ,
118
- }, []string {"name" })
119
-
120
- watchDuration = prometheus .NewSummaryVec (prometheus.SummaryOpts {
121
- Subsystem : ReflectorSubsystem ,
122
- Name : WatchDurationKey ,
123
- Help : "How long an API watch takes to return and decode for the reflectors" ,
124
- }, []string {"name" })
125
-
126
- itemsPerWatch = prometheus .NewSummaryVec (prometheus.SummaryOpts {
127
- Subsystem : ReflectorSubsystem ,
128
- Name : ItemsPerWatchKey ,
129
- Help : "How many items an API watch returns to the reflectors" ,
130
- }, []string {"name" })
131
-
132
- lastResourceVersion = prometheus .NewGaugeVec (prometheus.GaugeOpts {
133
- Subsystem : ReflectorSubsystem ,
134
- Name : LastResourceVersionKey ,
135
- Help : "Last resource version seen for the reflectors" ,
136
- }, []string {"name" })
137
70
)
138
71
139
72
func init () {
140
73
registerClientMetrics ()
141
- registerReflectorMetrics ()
142
74
}
143
75
144
76
// registerClientMetrics sets up the client latency metrics from client-go.
@@ -152,20 +84,6 @@ func registerClientMetrics() {
152
84
})
153
85
}
154
86
155
- // registerReflectorMetrics sets up reflector (reconcile) loop metrics.
156
- func registerReflectorMetrics () {
157
- Registry .MustRegister (listsTotal )
158
- Registry .MustRegister (listsDuration )
159
- Registry .MustRegister (itemsPerList )
160
- Registry .MustRegister (watchesTotal )
161
- Registry .MustRegister (shortWatchesTotal )
162
- Registry .MustRegister (watchDuration )
163
- Registry .MustRegister (itemsPerWatch )
164
- Registry .MustRegister (lastResourceVersion )
165
-
166
- reflectormetrics .SetReflectorMetricsProvider (reflectorMetricsProvider {})
167
- }
168
-
169
87
// this section contains adapters, implementations, and other sundry organic, artisanally
170
88
// hand-crafted syntax trees required to convince client-go that it actually wants to let
171
89
// someone use its metrics.
@@ -191,41 +109,3 @@ type resultAdapter struct {
191
109
func (r * resultAdapter ) Increment (_ context.Context , code , method , host string ) {
192
110
r .metric .WithLabelValues (code , method , host ).Inc ()
193
111
}
194
-
195
- // Reflector metrics provider (method #2 for client-go metrics),
196
- // copied (more-or-less directly) from k8s.io/kubernetes setup code
197
- // (which isn't anywhere in an easily-importable place).
198
-
199
- type reflectorMetricsProvider struct {}
200
-
201
- func (reflectorMetricsProvider ) NewListsMetric (name string ) reflectormetrics.CounterMetric {
202
- return listsTotal .WithLabelValues (name )
203
- }
204
-
205
- func (reflectorMetricsProvider ) NewListDurationMetric (name string ) reflectormetrics.SummaryMetric {
206
- return listsDuration .WithLabelValues (name )
207
- }
208
-
209
- func (reflectorMetricsProvider ) NewItemsInListMetric (name string ) reflectormetrics.SummaryMetric {
210
- return itemsPerList .WithLabelValues (name )
211
- }
212
-
213
- func (reflectorMetricsProvider ) NewWatchesMetric (name string ) reflectormetrics.CounterMetric {
214
- return watchesTotal .WithLabelValues (name )
215
- }
216
-
217
- func (reflectorMetricsProvider ) NewShortWatchesMetric (name string ) reflectormetrics.CounterMetric {
218
- return shortWatchesTotal .WithLabelValues (name )
219
- }
220
-
221
- func (reflectorMetricsProvider ) NewWatchDurationMetric (name string ) reflectormetrics.SummaryMetric {
222
- return watchDuration .WithLabelValues (name )
223
- }
224
-
225
- func (reflectorMetricsProvider ) NewItemsInWatchMetric (name string ) reflectormetrics.SummaryMetric {
226
- return itemsPerWatch .WithLabelValues (name )
227
- }
228
-
229
- func (reflectorMetricsProvider ) NewLastResourceVersionMetric (name string ) reflectormetrics.GaugeMetric {
230
- return lastResourceVersion .WithLabelValues (name )
231
- }
0 commit comments