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

Server flags categorization #1125

Merged
merged 5 commits into from
Feb 9, 2022
Merged

Server flags categorization #1125

merged 5 commits into from
Feb 9, 2022

Conversation

andyasp
Copy link
Contributor

@andyasp andyasp commented Feb 8, 2022

What this PR does:
Categorizes flags as advanced for server flags and the tenant federation flag.

The server flags were tricky because the struct fields couldn't be tagged directly. server.Config is in weaveworks/common, which also contained structs from prometheus/exporter-toolkit. Instead of replicating the structs, I introduced an override mechanism to contain flag classification issues and provide an easier pathway for anyone else dealing with this issue in the future.

Which issue(s) this PR fixes:
N/A

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@andyasp andyasp added the type/docs Improvements or additions to documentation label Feb 8, 2022
@andyasp
Copy link
Contributor Author

andyasp commented Feb 8, 2022

make doc isn't picking up the overrides, I'll have to look into how that works as well.

@andyasp andyasp marked this pull request as draft February 8, 2022 20:25
@andyasp andyasp marked this pull request as ready for review February 8, 2022 22:07
@Logiraptor Logiraptor self-assigned this Feb 8, 2022
Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You picked a smart solution, good job! I just left a comment about 1 categorization.

@@ -19,7 +19,7 @@ const (

type Config struct {
// Enabled switches on support for multi tenant query federation
Enabled bool `yaml:"enabled"`
Enabled bool `yaml:"enabled" category:"advanced"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be advanced, because this is a core (stable) feature. I left the same comment in a previous PR that was proposing to flag it as advanced.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the spreadsheet so hopefully it doesn't happen again.

Copy link
Member

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

"server.register-instrumentation": Advanced,
}

func GetOverride(fieldName string) (category Category, ok bool) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also include a check to verify that all options from overrides map were actually used? This is to avoid having obsolete flags here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that would be helpful and have been trying to think of the best way to do something like this. Maybe a usage_test.go? I'll try to see if I can make something work.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to merge this PR, since having this classification is very important. I would be glad if you could follow up with your test is a separate PR. An idea to test it is to check if all flags referenced here are included in cmd/mimir/help-all.txt.tmpl (maybe you have a smarter idea, otherwise you could fallback to this).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll be sure to do the test still in another PR, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened #1164 to make sure I don't forget about this.

@pracucci pracucci changed the title Server and tenant federation flag categorization Server flags categorization Feb 9, 2022
@pracucci pracucci merged commit a0caafa into main Feb 9, 2022
@pracucci pracucci deleted the aasp/server-flag-categorization branch February 9, 2022 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants