Created
December 14, 2022 14:45
-
-
Save polarnik/99bd54cf9108ca9098b2d3ed33887b9c to your computer and use it in GitHub Desktop.
Summary for k6
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
public class Summary { | |
public HashMap<String, HashMap<String, Object>> metrics; | |
public Summary readSummary(String path) throws IOException { | |
Gson gson = new GsonBuilder().setExclusionStrategies(new MyExclusionStrategy()).create(); | |
try(FileReader f = new FileReader(path)) { | |
Summary summary = gson.fromJson(f, Summary.class); | |
return summary; | |
} catch (IOException e) {throw e;} | |
} | |
class MyExclusionStrategy implements ExclusionStrategy { | |
public boolean shouldSkipField(FieldAttributes f) { | |
List<String> names = new ArrayList<String>(); | |
names.add("thresholds"); | |
return names.contains(f.getName()); | |
} | |
@Override public boolean shouldSkipClass(Class<?> aClass) {return false;} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment