update metrics websocket json response

This commit is contained in:
Lee 2024-04-18 12:37:46 +01:00
parent 0228f7205d
commit d9ebbfe99e

@ -42,13 +42,11 @@ public class MetricsWebSocketHandler extends TextWebSocketHandler {
*/
private void sendMetrics(WebSocketSession session) {
try {
WebsocketMetrics metrics = new WebsocketMetrics(Map.of(
session.sendMessage(new TextMessage(Main.GSON.toJson(Map.of(
"totalRequests", metricService.getMetric(TotalRequestsMetric.class).getValue(),
"totalServerLookups", metricService.getMetric(TotalServerLookupsMetric.class).getValue(),
"totalPlayerLookups", metricService.getMetric(TotalPlayerLookupsMetric.class).getValue()
));
session.sendMessage(new TextMessage(Main.GSON.toJson(metrics)));
))));
} catch (Exception e) {
log.error("An error occurred while sending metrics to the client", e);
}