File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 4949 tlsCert = kingpin .Flag ("tls.cert" , "<cert> Client certificate file" ).String ()
5050 tlsKey = kingpin .Flag ("tls.key" , "<key> Private key file" ).String ()
5151 metricsAddr = kingpin .Flag ("metrics-addr" , "Serve Prometheus metrics at this address" ).Default (":9369" ).String ()
52+ target = kingpin .Flag ("target" , "Scraping target" ).String ()
5253
5354 retryInitialWait = kingpin .Flag ("proxy.retry.initial-wait" , "Amount of time to wait after proxy failure" ).Default ("1s" ).Duration ()
5455 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) {
133134 return
134135 }
135136
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+
136145 scrapeResp , err := client .Do (request )
137146 if err != nil {
138147 msg := fmt .Sprintf ("failed to scrape %s" , request .URL .String ())
@@ -280,6 +289,10 @@ func main() {
280289 }()
281290 }
282291
292+ if * target != "" {
293+ level .Info (coordinator .logger ).Log ("msg" , "Scraping target" , "target" , * target )
294+ }
295+
283296 transport := & http.Transport {
284297 Proxy : http .ProxyFromEnvironment ,
285298 DialContext : (& net.Dialer {
You can’t perform that action at this time.
0 commit comments