@@ -11,7 +11,6 @@ import (
11
11
"testing"
12
12
"time"
13
13
14
- gokitlog "github.com/go-kit/log"
15
14
"github.com/prometheus/client_golang/prometheus"
16
15
commonconfig "github.com/prometheus/common/config"
17
16
"github.com/prometheus/common/model"
@@ -26,12 +25,6 @@ import (
26
25
allocatorWatcher "github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/watcher"
27
26
)
28
27
29
- var defaultScrapeProtocols = []promconfig.ScrapeProtocol {
30
- promconfig .OpenMetricsText1_0_0 ,
31
- promconfig .OpenMetricsText0_0_1 ,
32
- promconfig .PrometheusText0_0_4 ,
33
- }
34
-
35
28
func TestDiscovery (t * testing.T ) {
36
29
type args struct {
37
30
file string
@@ -61,7 +54,7 @@ func TestDiscovery(t *testing.T) {
61
54
registry := prometheus .NewRegistry ()
62
55
sdMetrics , err := discovery .CreateAndRegisterSDMetrics (registry )
63
56
require .NoError (t , err )
64
- d := discovery .NewManager (ctx , gokitlog . NewNopLogger () , registry , sdMetrics )
57
+ d := discovery .NewManager (ctx , nil , registry , sdMetrics )
65
58
results := make (chan []string )
66
59
manager := NewDiscoverer (ctrl .Log .WithName ("test" ), d , nil , scu , func (targets map [string ]* Item ) {
67
60
var result []string
@@ -122,7 +115,7 @@ func TestDiscovery_ScrapeConfigHashing(t *testing.T) {
122
115
JobName : "serviceMonitor/testapp/testapp/0" ,
123
116
HonorTimestamps : true ,
124
117
ScrapeInterval : model .Duration (30 * time .Second ),
125
- ScrapeProtocols : defaultScrapeProtocols ,
118
+ ScrapeProtocols : promconfig . DefaultScrapeProtocols ,
126
119
ScrapeTimeout : model .Duration (30 * time .Second ),
127
120
MetricsPath : "/metrics" ,
128
121
Scheme : "http" ,
@@ -151,7 +144,7 @@ func TestDiscovery_ScrapeConfigHashing(t *testing.T) {
151
144
JobName : "serviceMonitor/testapp/testapp/0" ,
152
145
HonorTimestamps : false ,
153
146
ScrapeInterval : model .Duration (30 * time .Second ),
154
- ScrapeProtocols : defaultScrapeProtocols ,
147
+ ScrapeProtocols : promconfig . DefaultScrapeProtocols ,
155
148
ScrapeTimeout : model .Duration (30 * time .Second ),
156
149
MetricsPath : "/metrics" ,
157
150
Scheme : "http" ,
@@ -180,7 +173,7 @@ func TestDiscovery_ScrapeConfigHashing(t *testing.T) {
180
173
JobName : "serviceMonitor/testapp/testapp/1" ,
181
174
HonorTimestamps : false ,
182
175
ScrapeInterval : model .Duration (30 * time .Second ),
183
- ScrapeProtocols : defaultScrapeProtocols ,
176
+ ScrapeProtocols : promconfig . DefaultScrapeProtocols ,
184
177
ScrapeTimeout : model .Duration (30 * time .Second ),
185
178
MetricsPath : "/metrics" ,
186
179
Scheme : "http" ,
@@ -209,7 +202,7 @@ func TestDiscovery_ScrapeConfigHashing(t *testing.T) {
209
202
JobName : "serviceMonitor/testapp/testapp/1" ,
210
203
HonorTimestamps : false ,
211
204
ScrapeInterval : model .Duration (30 * time .Second ),
212
- ScrapeProtocols : defaultScrapeProtocols ,
205
+ ScrapeProtocols : promconfig . DefaultScrapeProtocols ,
213
206
ScrapeTimeout : model .Duration (30 * time .Second ),
214
207
MetricsPath : "/metrics" ,
215
208
Scheme : "http" ,
@@ -238,7 +231,7 @@ func TestDiscovery_ScrapeConfigHashing(t *testing.T) {
238
231
JobName : "serviceMonitor/testapp/testapp/1" ,
239
232
HonorTimestamps : false ,
240
233
ScrapeTimeout : model .Duration (30 * time .Second ),
241
- ScrapeProtocols : defaultScrapeProtocols ,
234
+ ScrapeProtocols : promconfig . DefaultScrapeProtocols ,
242
235
MetricsPath : "/metrics" ,
243
236
Scheme : "http" ,
244
237
HTTPClientConfig : commonconfig.HTTPClientConfig {
@@ -266,7 +259,7 @@ func TestDiscovery_ScrapeConfigHashing(t *testing.T) {
266
259
JobName : "serviceMonitor/testapp/testapp/1" ,
267
260
HonorTimestamps : false ,
268
261
ScrapeTimeout : model .Duration (30 * time .Second ),
269
- ScrapeProtocols : defaultScrapeProtocols ,
262
+ ScrapeProtocols : promconfig . DefaultScrapeProtocols ,
270
263
MetricsPath : "/metrics" ,
271
264
Scheme : "http" ,
272
265
HTTPClientConfig : commonconfig.HTTPClientConfig {
@@ -309,7 +302,7 @@ func TestDiscovery_ScrapeConfigHashing(t *testing.T) {
309
302
registry := prometheus .NewRegistry ()
310
303
sdMetrics , err := discovery .CreateAndRegisterSDMetrics (registry )
311
304
require .NoError (t , err )
312
- d := discovery .NewManager (ctx , gokitlog . NewNopLogger () , registry , sdMetrics )
305
+ d := discovery .NewManager (ctx , nil , registry , sdMetrics )
313
306
manager := NewDiscoverer (ctrl .Log .WithName ("test" ), d , nil , scu , nil )
314
307
315
308
for _ , tc := range tests {
@@ -348,7 +341,7 @@ func TestDiscovery_NoConfig(t *testing.T) {
348
341
registry := prometheus .NewRegistry ()
349
342
sdMetrics , err := discovery .CreateAndRegisterSDMetrics (registry )
350
343
require .NoError (t , err )
351
- d := discovery .NewManager (ctx , gokitlog . NewNopLogger () , registry , sdMetrics )
344
+ d := discovery .NewManager (ctx , nil , registry , sdMetrics )
352
345
manager := NewDiscoverer (ctrl .Log .WithName ("test" ), d , nil , scu , nil )
353
346
defer close (manager .close )
354
347
defer cancelFunc ()
@@ -398,7 +391,7 @@ func BenchmarkApplyScrapeConfig(b *testing.B) {
398
391
registry := prometheus .NewRegistry ()
399
392
sdMetrics , err := discovery .CreateAndRegisterSDMetrics (registry )
400
393
require .NoError (b , err )
401
- d := discovery .NewManager (ctx , gokitlog . NewNopLogger () , registry , sdMetrics )
394
+ d := discovery .NewManager (ctx , nil , registry , sdMetrics )
402
395
manager := NewDiscoverer (ctrl .Log .WithName ("test" ), d , nil , scu , nil )
403
396
404
397
b .ResetTimer ()
0 commit comments