-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Change configuration package to influxdata/config #5401
Conversation
b1ce6f8
to
840714d
Compare
This has now been rebased on top of the renaming work |
Needs a rebase. |
840714d
to
6c91328
Compare
@timraymond @jwilder I rebased :) I need this to move forward for the Kapacitor changes. |
Getting these errors which seem unrelated:
Any idea what is up? |
@nathanielc I think your rebase didn't pick up a fix for that (#5860). That is was reported in #5854 which seems to be caused by builds with |
@jwilder Thanks another rebase fixed it. |
Just tried this with a few configs and it causes the server to abort startup with errors whereas current code does not. |
Some examples:
But I don't have a raft timeout configured in my config so I'm not quite sure why this is failing now. With the current config libs, it starts up without error. Here it is reporting an error on a config option that I don't think is valid anymore, but previously that option would be ignored. This will likely prevent upgrades from running smoothly as the config format options change periodically and I'm sure there are old/unused options in many configs out there.
|
@jwilder Yes, old configs should be logged but not error out the parsing. I'll see what I can do about that. |
@timraymond Digging in the error is triggered from within the Unmarshaling code in our fork of naiona/toml. I see a few paths forward...
In either case we are making breaking changes to our fork. I am not sure about the state of our fork and if we are trying to stay close to upstream etc. |
Possible solution influxdata/toml#4 |
1874e76
to
a2f56eb
Compare
We are unifying the way that we handle configuration across the products into the influxdata/config package. This provides the same API as BurntSushi/toml package used previously, but uses influxdata/toml under the hood (which is a fork of naoina/toml). The underlying toml parser has been changed because Telegraf uses specific features of this parser that cannot be easily replicated with the BurntSushi parser. Furthermore, our fork of naoina/toml provides support for maps and pointers within structs and toml documentation facilities[1]. [1] This is accessible by adding a "doc" struct tag with a comment describing a particular field of a config struct. When marshalling that struct as TOML, the "doc" struct tag will be placed appropriately to document that field in the resultant TOML output.
@jwilder @timraymond I think this is now ready to go. Extra configs are now logged and then skipped. I did have to modify some code that is going to get removed soon but it was necessary in order to get a complete test in. |
@jwilder @timraymond @rossmcdonald I found too many bugs in the https://github.com/naoina/toml version. Looking at the code it will take significant rewrite to get it to behave the way we expect. For now I am going to abandon this PR. :( We will need to revisit the influxdb/config package later and probably start with the BurntSushi option and move forward on it since it has been a reliable implementation so far. |
@nathanielc is it safe to close this out? |
@toddboom Yes, let's close it out. We can open a new PR when/if the time comes as it will be significantly different than this one. |
We are unifying the way that we handle configuration across the products into
the influxdata/config package. This provides the same API as the
BurntSushi/toml package used previously, but uses influxdata/toml under the
hood (which is a fork of naoina/toml). The underlying toml parser has been
changed because Telegraf uses specific features of this parser that cannot be
easily replicated with the BurntSushi parser. Our fork of naoina/toml provides
support for maps and pointers within structs and toml documentation[1]
facilities, which the original does not, at present time (pull requests have
been submitted with no response with no response from the maintainer).
[1] This is accessible by adding a “doc” struct tag with a comment describing a
particular field of a config struct. When marshalling that struct as TOML, the
“doc” struct tag will be placed appropriately to
document that field in the resultant TOML output.