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

Add helper function to list all dynamic config keys used in production #4891

Merged
merged 2 commits into from
Jul 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions common/dynamicconfig/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,30 @@ type (
}
)

// ListAllProductionKeys returns all key used in production
func ListAllProductionKeys() []Key {
result := make([]Key, 0, len(IntKeys)+len(BoolKeys)+len(FloatKeys)+len(StringKeys)+len(DurationKeys)+len(MapKeys))
for i := TestGetIntPropertyFilteredByTaskListInfoKey + 1; i < LastIntKey; i++ {
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about also exposing methods for each of these as well which hides this implementation detail of the Last key and similar?

ListIntConfigKeys() etc?

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 don't find a use case for listing keys by type now. I can add that later if I find a use case

result = append(result, i)
}
for i := TestGetBoolPropertyFilteredByTaskListInfoKey + 1; i < LastBoolKey; i++ {
result = append(result, i)
}
for i := TestGetFloat64PropertyKey + 1; i < LastFloatKey; i++ {
result = append(result, i)
}
for i := TestGetStringPropertyKey + 1; i < LastStringKey; i++ {
result = append(result, i)
}
for i := TestGetDurationPropertyFilteredByTaskListInfoKey + 1; i < LastDurationKey; i++ {
result = append(result, i)
}
for i := TestGetMapPropertyKey + 1; i < LastMapKey; i++ {
result = append(result, i)
}
return result
}

func GetKeyFromKeyName(keyName string) (Key, error) {
keyVal, ok := _keyNames[keyName]
if !ok {
Expand Down