-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into local_address
Signed-off-by: pcrao <[email protected]>
- Loading branch information
Showing
6 changed files
with
42 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
mobile/library/java/io/envoyproxy/envoymobile/utilities/StatsUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.envoyproxy.envoymobile.utilities; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Class for utilities around Envoy stats. | ||
*/ | ||
public class StatsUtils { | ||
|
||
/** | ||
* Takes in a stats string from engine.dumpStats() and parses it into individual map entries. | ||
* @param statsString, the string from dumpStats | ||
* @return a map of stats entries, e.g. "runtime.load_success", "1" | ||
*/ | ||
public static Map<String, String> statsToList(String statsString) { | ||
Map<String, String> stats = new HashMap<>(); | ||
|
||
for (String line : statsString.split("\n")) { | ||
String[] keyValue = line.split(": "); | ||
if (keyValue.length != 2) { | ||
System.out.println("Unexpected stats token"); | ||
continue; | ||
} | ||
stats.put(keyValue[0], keyValue[1]); | ||
} | ||
return stats; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters