-
Notifications
You must be signed in to change notification settings - Fork 683
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
PlayStatusPlugin method computeApplicationStatus throws ClassCastException #1436
Comments
The text format of "play status" is fine, so I think it will work if we do the same for the JSON format. ===================================================================
diff --git a/framework/src/play/plugins/PlayStatusPlugin.java b/framework/src/play/plugins/PlayStatusPlugin.java
--- a/framework/src/play/plugins/PlayStatusPlugin.java (revision 7bd07799819b33373f0a0e517061ebcd8fa18411)
+++ b/framework/src/play/plugins/PlayStatusPlugin.java (date 1683015670469)
@@ -225,20 +225,24 @@
{
JsonArray monitors = new JsonArray();
try {
- Object[][] data = Misc.sort(MonitorFactory.getRootMonitor().getBasicData(), 3, "desc");
- for (Object[] row : data) {
- if (((Double) row[1]) > 0) {
+ List<Monitor> ms = new ArrayList<>(asList(MonitorFactory.getRootMonitor().getMonitors()));
+ ms.sort((m1, m2) -> Double.compare(m2.getTotal(), m1.getTotal()));
+ for (Monitor m : ms) {
+ if (m.getHits() > 0) {
JsonObject o = new JsonObject();
- o.addProperty("name", row[0].toString());
- o.addProperty("hits", (Double) row[1]);
- o.addProperty("avg", (Double) row[2]);
- o.addProperty("min", (Double) row[6]);
- o.addProperty("max", (Double) row[7]);
+ o.addProperty("name", m.getLabel());
+ o.addProperty("hits", m.getHits());
+ o.addProperty("avg", m.getAvg());
+ o.addProperty("min", m.getAvg());
+ o.addProperty("max", m.getMax());
monitors.add(o);
}
}
+
} catch (Exception e) {
- e.printStackTrace();
+ JsonObject o = new JsonObject();
+ o.addProperty("exception",e.getMessage());
+ monitors.add(o);
}
status.add("monitors", monitors);
}
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi.
I noticed that PlayStatusPlugin throws an ClassCastException when the input json=true.
Steps to reproduce:
String playStatus = new PlayStatusPlugin().computeApplicationStatus(true);
Anyone else get this error?
It works fine if input to method is false.
Play Version (1.7.1 )
Operating System (Windows 11)
JDK
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment Temurin-11.0.12+7 (build 11.0.12+7)
OpenJDK 64-Bit Server VM Temurin-11.0.12+7 (build 11.0.12+7, mixed mode)
The text was updated successfully, but these errors were encountered: