New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vm_promscrape proxy_url use wrong Host header #2794
Comments
As workaround, try to use streamParse: true for this target.
|
The issue must be fixed in the commit f97355d . This commit will be included in the next release. In the meantime it is possible to build |
I will validate once back from holiday. |
@jtorkkel , if you run |
verified to work using in 1.79.0 single node version |
…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: - #1945 - #5425 - #2794 - #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 #5567 Overrides #4931
…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: - #1945 - #5425 - #2794 - #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 #5567 Overrides #4931
When vm use proxy_url the Host header contains proxy server host address, instead of target service host name.
curl and prometheus set target service address to Host header, which is apparently the right way.
proxy_url added this way
request from vm:
Request from prometheus and using "curl -x http://ap-tools.xxx.net:3128 http://ap-dock.oneadr.net:3333/metrics:"
proxy_url allow scraping metrics through proxy service. Needed to scrape metrics outside k8s or docker utilizing proxy installed inside the cluster as example.
Some proxies like NGINX are not handling VM request request correctly by default (or require complex config), prometheus request is easier to handle as host header is already correct. Some proxieslike squid can handle VM request, apparently it regenerate host header automatically.
To Reproduce
Add proxy_url and check outgoing Host header value
Steps to reproduce the behavior.
Expected behavior
target service Host header should be added to request
Logs
Check if any warnings or errors were logged by VictoriaMetrics components
or components in communication with VictoriaMetrics (e.g. Prometheus, Grafana).
Version
The line returned when passing
--version
command line flag to the binary. For example:Used command-line flags
--promscrape.config=prometheus.yml
The text was updated successfully, but these errors were encountered: