Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upConfig parser does not complain about overriden parts of configuration #1275
Comments
This was referenced Dec 28, 2015
This comment has been minimized.
This comment has been minimized.
|
Unfortunately, that is an issue of the YAML parser package. Detecting this in a clean way in Prometheus is not really an option. If no error is thrown, the YAML spec would actually require any subsequent occurrences to be discarded rather then the previous ones (http://yaml.org/spec/1.1/#id932806). I agree that it's annoying and an error message would be nice to have. But it's not enough of a problem to introduce silly hacks to the Prometheus code base to work around a bug in an upstream package (for which there's not alternative). |
RichiH
referenced this issue
Dec 28, 2015
Closed
YAML spec violation: Duplicate keys are silently ignored, and parser selects incorrect key #154
This comment has been minimized.
This comment has been minimized.
|
Closing as per IRC. Created go-yaml/yaml#154 instead. |
RichiH
closed this
Dec 28, 2015
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 24, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
RichiH commentedDec 28, 2015
While I readily agree that autogenerated config files should not have this problem, and that YAML works that way, especially in the trial phase, this can confuse users. Warning or, preferably, erroring out would be appreciated.
If you run with a configuration like:
the former
scrape_configsis silently discarded. While that's the obvious case, constructs likeare silently discarded as well.
So to summarize: Yes, I fat-fingered, but principle of least surprise would be to error out instead of silently carrying on.