VictoriaMetrics/lib/promscrape
Aliaksandr Valialkin bc7cf4950b
lib/promscrape: use the standard net/http.Client instead of fasthttp.Client for scraping targets in non-streaming mode
While fasthttp.Client uses less CPU and RAM when scraping targets with small responses (up to 10K metrics),
it doesn't work well when scraping targets with big responses such as kube-state-metrics.
In this case it could use big amounts of additional memory comparing to net/http.Client,
since fasthttp.Client reads the full response in memory and then tries re-using the large buffer
for further scrapes.

Additionally, fasthttp.Client-based scraping had various issues with proxying, redirects
and scrape timeouts like the following ones:

- https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1945
- https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5425
- https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2794
- https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1017

This should help reducing memory usage for the case when target returns big response
and this response is scraped by fasthttp.Client at first before switching to stream parsing mode
for subsequent scrapes. Now the switch to stream parsing mode is performed on the first scrape
after reading the response body in memory and noticing that its size exceeds the value passed
to -promscrape.minResponseSizeForStreamParse command-line flag.
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5567

Overrides https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4931
2024-01-30 18:39:10 +02:00
..
discovery lib/promscrape/discovery/kubernetes: typo fix in the comment for ContainerStateTerminated struct 2024-01-24 15:06:46 +02:00
discoveryutils lib/promauth: follow-up for e16d3f5639 2023-10-25 23:19:37 +02:00
testdata lib/promscrape: disable support for service discovery and metrics scrape via http2 2023-07-06 16:03:37 -07:00
client.go lib/promscrape: use the standard net/http.Client instead of fasthttp.Client for scraping targets in non-streaming mode 2024-01-30 18:39:10 +02:00
config_test.go lib/promscrape: respect 0 value for series_limit param (#5663) 2024-01-23 13:09:14 +02:00
config_timing_test.go
config.go lib/promscrape: respect 0 value for series_limit param (#5663) 2024-01-23 13:09:14 +02:00
relabel_debug.go app/vmselect: small cleanup after 4f3f9950d0 2023-05-08 14:57:11 -07:00
scraper.go lib/promscrape: use the standard net/http.Client instead of fasthttp.Client for scraping targets in non-streaming mode 2024-01-30 18:39:10 +02:00
scrapework_test.go lib/promscrape: use the standard net/http.Client instead of fasthttp.Client for scraping targets in non-streaming mode 2024-01-30 18:39:10 +02:00
scrapework_timing_test.go lib/promscrape: use the standard net/http.Client instead of fasthttp.Client for scraping targets in non-streaming mode 2024-01-30 18:39:10 +02:00
scrapework.go lib/promscrape: use the standard net/http.Client instead of fasthttp.Client for scraping targets in non-streaming mode 2024-01-30 18:39:10 +02:00
statconn_test.go lib/promscrape: do not add a suggestion for enabling TCP6 in error message when the dial address is TCPv4 2023-10-25 17:57:56 -07:00
statconn.go lib/promscrape: use the standard net/http.Client instead of fasthttp.Client for scraping targets in non-streaming mode 2024-01-30 18:39:10 +02:00
targetstatus.go lib/promscrape: add a wraning when the /service-discovery page contains incomplete list of dropped targets 2023-12-08 19:03:51 +02:00
targetstatus.qtpl lib/promscrape: comsetic changes after e373bb84d5 2023-12-12 11:28:18 +01:00
targetstatus.qtpl.go lib/promscrape: comsetic changes after e373bb84d5 2023-12-12 11:28:18 +01:00