Skip to content

Commit

Permalink
Add helper function to list all dynamic config keys used in production (
Browse files Browse the repository at this point in the history
uber#4891)

Co-authored-by: David Porter <david.porter@uber.com>
  • Loading branch information
Shaddoll and davidporter-id-au authored Jul 5, 2022
1 parent 663a041 commit 9d45241
Showing 1 changed file with 24 additions and 0 deletions.
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++ {
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

0 comments on commit 9d45241

Please sign in to comment.