diff --git a/java_tools/proxy_server/src/main/java/com/rusefi/server/Backend.java b/java_tools/proxy_server/src/main/java/com/rusefi/server/Backend.java index ac7e1e7827..89a6e22727 100644 --- a/java_tools/proxy_server/src/main/java/com/rusefi/server/Backend.java +++ b/java_tools/proxy_server/src/main/java/com/rusefi/server/Backend.java @@ -13,6 +13,7 @@ import org.takes.Take; import org.takes.facets.fork.FkRegex; import org.takes.facets.fork.TkFork; import org.takes.http.FtBasic; +import org.takes.rs.RsHtml; import org.takes.rs.RsJson; import javax.json.Json; @@ -21,6 +22,7 @@ import javax.json.JsonObject; import java.io.IOException; import java.net.Socket; import java.util.*; +import java.util.concurrent.atomic.AtomicLong; import java.util.function.Function; public class Backend { @@ -42,6 +44,7 @@ public class Backend { // private final int clientTimeout; private final UserDetailsResolver userDetailsResolver; private final Logger logger; + public final static AtomicLong totalSessions = new AtomicLong(); public Backend(UserDetailsResolver userDetailsResolver, int httpPort, Logger logger) { // this.clientTimeout = clientTimeout; @@ -56,7 +59,11 @@ public class Backend { new TkFork(showOnlineUsers, Monitoring.showStatistics, new FkRegex(VERSION_PATH, BACKEND_VERSION), - new FkRegex("/", "rusEFI Online") + new FkRegex("/", new RsHtml("\n" + + "rusEFI Online\n" + + "
\n" + + "Status\n" + + "\n")) ), httpPort ).start(() -> isClosed); logger.info("Shutting down backend on port " + httpPort); @@ -85,6 +92,7 @@ public class Backend { return new Runnable() { @Override public void run() { + totalSessions.incrementAndGet(); // connection from authenticator app which proxies for Tuner Studio IoStream applicationClientStream = null; try { @@ -136,6 +144,7 @@ public class Backend { return new Runnable() { @Override public void run() { + totalSessions.incrementAndGet(); ControllerConnectionState controllerConnectionState = new ControllerConnectionState(controllerSocket, logger, getUserDetailsResolver()); try { controllerConnectionState.requestControllerInfo(); diff --git a/java_tools/proxy_server/src/main/java/com/rusefi/server/Monitoring.java b/java_tools/proxy_server/src/main/java/com/rusefi/server/Monitoring.java index 2b4c07b970..14b618c175 100644 --- a/java_tools/proxy_server/src/main/java/com/rusefi/server/Monitoring.java +++ b/java_tools/proxy_server/src/main/java/com/rusefi/server/Monitoring.java @@ -27,6 +27,8 @@ public class Monitoring { builder.add("CPU_Load", operatingSystemMXBean.getSystemLoadAverage()); builder.add("free_ram", formatSize(Runtime.getRuntime().freeMemory())); builder.add("max_ram", formatSize(Runtime.getRuntime().maxMemory())); + builder.add("threads", Thread.getAllStackTraces().size()); + builder.add("sessions", Backend.totalSessions.get()); return new RsJson(builder.build()); } diff --git a/java_tools/ts_plugin/build.xml b/java_tools/ts_plugin/build.xml index e242797c34..7fcd73ddd1 100644 --- a/java_tools/ts_plugin/build.xml +++ b/java_tools/ts_plugin/build.xml @@ -13,13 +13,14 @@ + diff --git a/java_tools/ts_plugin_launcher/.idea/modules.xml b/java_tools/ts_plugin_launcher/.idea/modules.xml index af6e89fb9e..1c3c28fbb8 100644 --- a/java_tools/ts_plugin_launcher/.idea/modules.xml +++ b/java_tools/ts_plugin_launcher/.idea/modules.xml @@ -4,6 +4,7 @@ +