File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ package collector
1010import (
1111 "crypto/tls"
1212 "fmt"
13+ "github.com/prometheus/common/version"
1314 "io"
1415 "net/http"
1516 "strconv"
@@ -31,6 +32,7 @@ type Exporter struct {
3132 customHeaders map [string ]string
3233 mutex sync.Mutex
3334 client * http.Client
35+ userAgent string
3436
3537 up * prometheus.Desc
3638 scrapeFailures prometheus.Counter
@@ -197,6 +199,7 @@ func NewExporter(logger log.Logger, config *Config) *Exporter {
197199 TLSClientConfig : & tls.Config {InsecureSkipVerify : config .Insecure },
198200 },
199201 },
202+ userAgent : fmt .Sprintf ("Prometheus-Apache-Exporter/%s" , version .Version ),
200203 }
201204}
202205
@@ -273,6 +276,7 @@ func (e *Exporter) updateScoreboard(scoreboard string) {
273276
274277func (e * Exporter ) collect (ch chan <- prometheus.Metric ) error {
275278 req , err := http .NewRequest ("GET" , e .URI , nil )
279+ req .Header .Set ("User-Agent" , e .userAgent )
276280 if e .hostOverride != "" {
277281 req .Host = e .hostOverride
278282 }
You can’t perform that action at this time.
0 commit comments