feat: always get keys in order

Ranging over maps is unordered in golang, so we need to use the correct data structure if we need the output in an ordered way.
This commit is contained in:
Jose Diaz-Gonzalez committed 2019-04-08 11:31:34 -04:00
1 parent 8d23556831
commit c5717510ee
1 file changed
+8 -8
+8 -8
View File
@@ -120,16 +120,16 @@ func reportRequestType(appName string, processType string, requestType string) (
} }
common.LogInfo2Quiet(message) common.LogInfo2Quiet(message)
resources := map[string]bool{ resources := []string{
"cpu": true, "cpu",
"memory": true, "memory",
"memory-swap": true, "memory-swap",
"network": true, "network",
"network-ingress": true, "network-ingress",
"network-egress": true, "network-egress",
} }
for key := range resources { for _, key := range resources {
property := propertyKey(processType, requestType, key) property := propertyKey(processType, requestType, key)
value := common.PropertyGet("resource", appName, property) value := common.PropertyGet("resource", appName, property)
common.LogVerbose(fmt.Sprintf("%v: %v", key, value)) common.LogVerbose(fmt.Sprintf("%v: %v", key, value))