File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 49
49
tlsCert = kingpin .Flag ("tls.cert" , "<cert> Client certificate file" ).String ()
50
50
tlsKey = kingpin .Flag ("tls.key" , "<key> Private key file" ).String ()
51
51
metricsAddr = kingpin .Flag ("metrics-addr" , "Serve Prometheus metrics at this address" ).Default (":9369" ).String ()
52
+ target = kingpin .Flag ("target" , "Scraping target" ).String ()
52
53
53
54
retryInitialWait = kingpin .Flag ("proxy.retry.initial-wait" , "Amount of time to wait after proxy failure" ).Default ("1s" ).Duration ()
54
55
retryMaxWait = kingpin .Flag ("proxy.retry.max-wait" , "Maximum amount of time to wait between proxy poll retries" ).Default ("5s" ).Duration ()
@@ -133,6 +134,14 @@ func (c *Coordinator) doScrape(request *http.Request, client *http.Client) {
133
134
return
134
135
}
135
136
137
+ if * target != "" {
138
+ if request .URL .Port () == "" {
139
+ request .URL .Host = * target
140
+ } else {
141
+ request .URL .Host = * target + ":" + request .URL .Port ()
142
+ }
143
+ }
144
+
136
145
scrapeResp , err := client .Do (request )
137
146
if err != nil {
138
147
msg := fmt .Sprintf ("failed to scrape %s" , request .URL .String ())
@@ -280,6 +289,10 @@ func main() {
280
289
}()
281
290
}
282
291
292
+ if * target != "" {
293
+ level .Info (coordinator .logger ).Log ("msg" , "Scraping target" , "target" , * target )
294
+ }
295
+
283
296
transport := & http.Transport {
284
297
Proxy : http .ProxyFromEnvironment ,
285
298
DialContext : (& net.Dialer {
You can’t perform that action at this time.
0 commit comments