mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/promscrape/client: make User-Agent consistent between fasthttp and native client (#4886)
User agent was not set for native client which resulted in using one provided by Golang.
See: https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4884
Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
(cherry picked from commit 6788704152
)
This commit is contained in:
parent
33bf28e1bd
commit
1242460fa6
1 changed files with 2 additions and 0 deletions
|
@ -201,6 +201,8 @@ func (c *client) GetStreamReader() (*streamReader, error) {
|
|||
// Set X-Prometheus-Scrape-Timeout-Seconds like Prometheus does, since it is used by some exporters such as PushProx.
|
||||
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1179#issuecomment-813117162
|
||||
req.Header.Set("X-Prometheus-Scrape-Timeout-Seconds", c.scrapeTimeoutSecondsStr)
|
||||
// Set same useragent as fasthttp.HostClient at c.hc uses for scraping
|
||||
req.Header.Set("User-Agent", "vm_promscrape")
|
||||
c.setHeaders(req)
|
||||
c.setProxyHeaders(req)
|
||||
scrapeRequests.Inc()
|
||||
|
|
Loading…
Reference in a new issue