-
Notifications
You must be signed in to change notification settings - Fork 642
Implement configuration parameter categorization #840
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
Conversation
258a5e8
to
697d1a8
Compare
697d1a8
to
aa38e00
Compare
I like the idea of categorizing the flags into basic, advanced and experimental, that should help to not overwhelm first-time users with options. If I understand the current solution correctly then |
I would tend to agree with @replay. I think even only having two help flags might be sufficient:
As a new user you won't be exposed to the variety of flags we have today, but when you are advanced you can always use Wdyt? |
@replay @simonswine I would be OK with both of your suggestions. @replay WDYT of what @simonswine suggests? I think I tend towards sympathizing with @simonswine's thinking, i.e. that one can easily grep through all options. |
I agree, I think that the two options |
@replay OK, I guess we're leaning towards changing to PR to implement the above scheme :) I'll just wait a bit to see what others say. |
f301f0a
to
dd341e6
Compare
I've implemented Also now prepending experimental flags with Thanks for the feedback, everyone! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
[not necessarily for this PR but I would be glad if you could consider it] I think my main concern is that there's no testing and we could break it without noticing it. Also seeing the impact of future changes may not be trivial. I'm wondering if we could adopt an approach like the auto-generated config: store the rendered version of it in the repo and have a check like check-doc
in CI which ensures every PR changing config updates it too. We could build mimir and run both mimir -help
and mimir -help-all
storing their output in 2 respective files. When review any PR affecting config changes (or any change to the usage) we'll see the rendered files changed too.
@pracucci I can add tests, I just wanted to gather feedback first. Your suggestion regarding checking for help output regressions sounds like the Chromium testing strategy (regression testing based on reference text files) :D |
7157391
to
0bbd263
Compare
Working on adding tests today. |
aff1318
to
e87c41c
Compare
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
Co-authored-by: Mauro Stettler <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
Signed-off-by: Arve Knudsen <[email protected]>
e87c41c
to
83b4e96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job, LGTM! It looks a good starting point to me. I would be happy to merge this PR as is and then start working on classifying flags in follow up PRs.
Signed-off-by: Arve Knudsen <[email protected]>
47cfa05
to
27633e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, good job!
I really like the new test which compares the generated help against one that has been committed to the repo, this will make it easy to visualize how a change in the code affects the generated output.
I would be happy to merge this PR as is and then start working on classifying flags in follow up PRs
I agree. But I wonder if we should try to define criteria based on which we decide which flags should be marked as advanced or experimental and commit that criteria to the docs? For example in docs/sources/contributing/design-patterns-and-conventions.md
. I think without clear criteria there will almost certainly be inconsistency in the categorization, by defining the criteria early we can prevent such inconsistency.
How about:
Advanced:
A flag which is only required to tune Mimir for very specific scenarios, it should never be necessary to use an advanced flag to configure a Mimir cluster which stores less than 1M series and which uses a public object store like S3 or GCS.
Experimental:
A feature of which the Mimir team doesn't know or can reasonably assume that it has been used in any production environment for at least 3 months, and which isn't listed as Experimental in:
## Experimental features |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving this, but hope you'll consider the changes I've suggested before merge.
@@ -95,24 +97,32 @@ func main() { | |||
flag.IntVar(&blockProfileRate, "debug.block-profile-rate", 0, "Fraction of goroutine blocking events that are reported in the blocking profile. 1 to include every blocking event in the profile, 0 to disable.") | |||
flag.BoolVar(&printVersion, "version", false, "Print application version and exit.") | |||
flag.BoolVar(&printModules, "modules", false, "List available values that can be used as target.") | |||
flag.BoolVar(&printHelp, "help", false, "Print basic help.") | |||
flag.BoolVar(&printHelp, "h", false, "Print basic help.") | |||
flag.BoolVar(&printHelpAll, "help-all", false, "Print help including also advanced and experimental flags.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what to suggest. Configuration options are not the same as flags. Are they parameters? Knobs? Parameters is used elsewhere in user help output, so maybe do that here as well.
flag.BoolVar(&printHelpAll, "help-all", false, "Print help including also advanced and experimental flags.") | |
flag.BoolVar(&printHelpAll, "help-all", false, "Print help, also including advanced and experimental flags.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KMiller-Grafana I use the term flags consequently as regards the CLI, since that's what they are in this context. They correspond to configuration parameters, but are concretely flags in this user interface.
For example, -help
, -h
and -help-all
are all flags.
I haven't double checked if we're consequent in the CLI terminology elsewhere though, that's the most important thing.
flag.CommandLine.SetOutput(os.Stdout) | ||
usage() | ||
if err := flag.CommandLine.Parse(os.Args[1:]); err != nil { | ||
fmt.Fprintln(flag.CommandLine.Output(), "Run with -help to get list of available parameters") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this same substitution in the other lines that read the same?
fmt.Fprintln(flag.CommandLine.Output(), "Run with -help to get list of available parameters") | |
fmt.Fprintln(flag.CommandLine.Output(), "Run with -help to get a list of available parameters.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KMiller-Grafana this is actually carried over from old code. If we're to change it, I think it's best considered in its own PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KMiller-Grafana after reading this more closely, I think the current wording ("Run with -help to get list of available parameters") is the right one, since it's not just a list, but a certain list (the list of basic parameters). Changing it would make it more ambiguous to me at least, since it makes it sound as if there's some doubt as to what list would be produced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made my suggestion to make the phrase grammatically correct.
@aknuds1 My opinion: shoveling this off into another PR just created technical debt that no one will ever get to or implement. I'm currently your expert when it comes to documentation of anything related to Mimir configuration. I'm also your UI person for this effort. Please, since you've argued against what I know is an improvement, make the changes in another PR yourself, and don't lose the task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KMiller-Grafana I already made another PR, which has been merged in the meantime.
💯 agree. I know @09jvilla and team already did some work (I reviewed a classification proposal just yesterday) but I also missed a bit the rationale behind some classification. Given we're going public, I definitely agree on documenting the rationale in this doc so that we have a guideline to enforce it over time. Going to merge this PR since the classification criteria doesn't block the foundation work done here. |
Sorry! I totally missed the comment before merging. @aknuds1 can you address it in a follow up PR, please? |
@pracucci will do. |
What this PR does:
Implement configuration parameter categorization, via struct field tags. The tag key "category" is used to signal category, which should be one of the following:
If the key isn't supplied,
basic
will be assumed (i.e., it's the default).Two new flags are introduced, printing advanced and experimental help respectively:
-help-advanced
help-experimental
Which issue(s) this PR fixes:
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
Help output
-help
(note that-compactor.block-ranges
is hidden)TODOs