Skip to content
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

regression in vmagent 1.95.0: -dryRun no longer fails for invalid configuration under scrape_config_files #5508

Closed
lauri-paypay opened this issue Dec 21, 2023 · 4 comments
Assignees
Labels
bug Something isn't working vmagent

Comments

@lauri-paypay
Copy link

Describe the bug

Since #5153, vmagent -dryRun exits with status 0 even if the provided configuration is invalid. We use this in CI to check validity of our configuration before deploying.

To Reproduce

echo "asdf" > foo.yaml
echo "scrape_config_files: [foo.yaml]" > promscrape.yaml
docker run --rm -v $(pwd):/tmp victoriametrics/vmagent:v1.96.0-enterprise -eula -dryRun -promscrape.config=/tmp/promscrape.yaml
2023-12-21T08:28:44.248Z	info	VictoriaMetrics/lib/logger/flag.go:12	build version: vmagent-20231212-225303-tags-v1.96.0-enterprise-0-ga771bc255
2023-12-21T08:28:44.248Z	info	VictoriaMetrics/lib/logger/flag.go:13	command-line flags
2023-12-21T08:28:44.248Z	info	VictoriaMetrics/lib/logger/flag.go:20	  -dryRun="true"
2023-12-21T08:28:44.248Z	info	VictoriaMetrics/lib/logger/flag.go:20	  -eula="true"
2023-12-21T08:28:44.248Z	info	VictoriaMetrics/lib/logger/flag.go:20	  -promscrape.config="/tmp/promscrape.yaml"
2023-12-21T08:28:44.248Z	info	VictoriaMetrics/lib/license/copyrights.go:20	Copyright 2018-2023 VictoriaMetrics, Inc - All Rights Reserved. For any questions please contact info@victoriametrics.com
2023-12-21T08:28:44.253Z	error	VictoriaMetrics/lib/promscrape/config.go:466	skipping "/tmp/foo.yaml" at `scrape_config_files` because of failure to parse it: yaml: unmarshal errors:
  line 1: cannot unmarshal !!str `asdf` into []*promscrape.ScrapeConfig
2023-12-21T08:28:44.253Z	info	VictoriaMetrics/app/vmagent/main.go:121	all the configs are ok; exiting with 0 status code

Version

vmagent-20231212-225303-tags-v1.96.0-enterprise-0-ga771bc255

Logs

No response

Screenshots

No response

Used command-line flags

No response

Additional information

No response

@lauri-paypay lauri-paypay added the bug Something isn't working label Dec 21, 2023
@hagen1778
Copy link
Collaborator

hagen1778 commented Dec 21, 2023

Related to #4959, commit d5a599b

  • Skip unreachable or invalid files specified at scrape_config_files during vmagent startup, since these files may become valid later.
    Previously vmagent was exitting in this case.

@hagen1778 hagen1778 self-assigned this Dec 21, 2023
valyala added a commit that referenced this issue Jan 16, 2024
- Rename mustLoadScrapeConfigFiles() to loadScrapeConfigFiles(), since now it may return error.
- Split too long line with the error message into two lines in order to improve readability a bit.

Updates #5508
Updates #5560
@valyala
Copy link
Collaborator

valyala commented Jan 16, 2024

@lauri-paypay , vmagent should return error when it encounters invalid scrape_config_files starting from the commit 3ac44ba . The check for invalid scrape_config_files can be disabled by running vmagent with -promscrape.config.strictParse=false command-line flag.

This commit will be included in the next release. In the mean time you can build vmagent from this commit according to these docs and verify whether it works as intended.

valyala added a commit that referenced this issue Jan 16, 2024
- Rename mustLoadScrapeConfigFiles() to loadScrapeConfigFiles(), since now it may return error.
- Split too long line with the error message into two lines in order to improve readability a bit.

Updates #5508
Updates #5560
@lauri-paypay
Copy link
Author

@valyala thanks. I confirmed that the fixed behavior is what I expected.

@valyala
Copy link
Collaborator

valyala commented Jan 30, 2024

@lauri-paypay , thanks for the confirmation!

The bugfix has been included in v1.97.0 release. Closing the issue as fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vmagent
Projects
None yet
Development

No branches or pull requests

3 participants