mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-10 15:14:09 +00:00
app/vmagent: follow-up after 6788704152
https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4884 Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
parent
3f33f9ce6f
commit
6489dc387c
2 changed files with 7 additions and 4 deletions
|
@ -26,6 +26,7 @@ The following `tip` changes can be tested by building VictoriaMetrics components
|
|||
|
||||
|
||||
* BUGFIX: [vmalert](https://docs.victoriametrics.com/vmalert.html): correctly re-use HTTP request object on `EOF` retries when querying the configured datasource. Previously, there was a small chance that query retry wouldn't succeed.
|
||||
* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): consistently set UserAgent header to `vm_promscrape` during scraping with enabled or disabled `promscrape.streamParse`. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4884) for details.
|
||||
|
||||
## [v1.93.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.93.1)
|
||||
|
||||
|
|
|
@ -79,6 +79,8 @@ func concatTwoStrings(x, y string) string {
|
|||
return s
|
||||
}
|
||||
|
||||
const scrapeUserAgent = "vm_promscrape"
|
||||
|
||||
func newClient(ctx context.Context, sw *ScrapeWork) *client {
|
||||
var u fasthttp.URI
|
||||
u.Update(sw.ScrapeURL)
|
||||
|
@ -120,8 +122,9 @@ func newClient(ctx context.Context, sw *ScrapeWork) *client {
|
|||
logger.Fatalf("cannot create dial func: %s", err)
|
||||
}
|
||||
hc := &fasthttp.HostClient{
|
||||
Addr: dialAddr,
|
||||
Name: "vm_promscrape",
|
||||
Addr: dialAddr,
|
||||
// Name used in User-Agent request header
|
||||
Name: scrapeUserAgent,
|
||||
Dial: dialFunc,
|
||||
IsTLS: isTLS,
|
||||
TLSConfig: tlsCfg,
|
||||
|
@ -201,8 +204,7 @@ 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")
|
||||
req.Header.Set("User-Agent", scrapeUserAgent)
|
||||
c.setHeaders(req)
|
||||
c.setProxyHeaders(req)
|
||||
scrapeRequests.Inc()
|
||||
|
|
Loading…
Reference in a new issue