VictoriaMetrics: vmagent doesn't follow redirects without stream_parse
Describe the bug vmagent doesn’t follow redirects without setting stream_parse: true for details see slack thread: https://victoriametrics.slack.com/archives/CGZF1H6L9/p1639404018163100
Expected behavior it should follow redirects in a way that is similar to prometheus
VM agent config
global:
scrape_interval: 1m0s
scrape_configs:
- job_name: emr
follow_redirects: true
relabel_configs:
- source_labels: [__meta_ec2_private_ip]
target_label: __metrics_path__
replacement: /bi-emr-reverse-logs/$1:4040/metrics/executors/prometheus/
- source_labels: [__meta_ec2_tag_Name]
target_label: instance
- target_label: __address__
replacement: bo.XX.com
ec2_sd_configs:
- region: us-east-1
access_key: XXX
secret_key: <secret>
filters:
- name: tag:aws:elasticmapreduce:instance-group-role
values:
- MASTER
- name: tag:Name
values:
- airflow-shared-persistent-emr-6.3.0
Version tried v1.7.0 and v1.68.0 and latest docker version
**Logs**
`unexpected status code returned when scraping "http://bo.XXX.com:80/bi-emr-reverse-logs/10.207.109.205:4040/metrics/executors/prometheus/": 301; expecting 200; response body: "<html>\r\n<head><title>301 Moved Permanently</title></head>\r\n<body>\r\n<center><h1>301 Moved Permanently</h1></center>\r\n<hr><center>openresty/1.19.3.1</center>\r\n</body>\r\n</html>\r\n"`
**Workaround**
the issue was resolved by adding stream_parse: true
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 21 (2 by maintainers)
Commits related to this issue
- lib/promscrape: allow up to 5 redirects when scraping a target by default See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1945 — committed to VictoriaMetrics/VictoriaMetrics by valyala 5 years ago
- lib/promscrape: allow up to 5 redirects when scraping a target by default See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1945 — committed to VictoriaMetrics/VictoriaMetrics by valyala 5 years ago
- Enable stream parse for vault to fix redirect following See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1945 — committed to MatthewJohn/vault-nomad-consul-terraform by MatthewJohn 3 years ago
- lib/promscrape/client: replace fasthttp.HostClient with fasthttp.Client This will allow to handle redirect easily as fasthttp.Client creates new fasthttp.HostClient on demand and caches created insta... — committed to VictoriaMetrics/VictoriaMetrics by zekker6 3 years ago
- 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 res... — committed to VictoriaMetrics/VictoriaMetrics by valyala 3 years ago
- 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 res... — committed to VictoriaMetrics/VictoriaMetrics by valyala 3 years ago
- docs/CHANGELOG.md: document the bugfix addressed by the commit bc7cf4950b5ff1072a33fe58c6bae1184d01068b Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1945 — committed to VictoriaMetrics/VictoriaMetrics by valyala 3 years ago
- docs/CHANGELOG.md: document the bugfix addressed by the commit bc7cf4950b5ff1072a33fe58c6bae1184d01068b Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1945 — committed to VictoriaMetrics/VictoriaMetrics by valyala 3 years ago
- docs/CHANGELOG.md: refer to the related pull request for the bugfix for https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1945 — committed to VictoriaMetrics/VictoriaMetrics by valyala 3 years ago
- docs/CHANGELOG.md: refer to the related pull request for the bugfix for https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1945 — committed to VictoriaMetrics/VictoriaMetrics by valyala 3 years ago
vmagentshould properly follow redirects at scrape targets when stream parsing mode is disabled starting from v1.97.0. Closing the issue as fixed.