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
54
55
var (
@@ -121,6 +122,14 @@ func (c *Coordinator) doScrape(request *http.Request, client *http.Client) {
121
122
return
122
123
}
123
124
125
+ if * target != "" {
126
+ if request .URL .Port () == "" {
127
+ request .URL .Host = * target
128
+ } else {
129
+ request .URL .Host = * target + ":" + request .URL .Port ()
130
+ }
131
+ }
132
+
124
133
scrapeResp , err := client .Do (request )
125
134
if err != nil {
126
135
msg := fmt .Sprintf ("failed to scrape %s" , request .URL .String ())
@@ -285,6 +294,10 @@ func main() {
285
294
}()
286
295
}
287
296
297
+ if * target != "" {
298
+ level .Info (coordinator .logger ).Log ("msg" , "Scraping target" , "target" , * target )
299
+ }
300
+
288
301
transport := & http.Transport {
289
302
Proxy : http .ProxyFromEnvironment ,
290
303
DialContext : (& net.Dialer {
You can’t perform that action at this time.
0 commit comments