2 Commits

Author SHA1 Message Date
b93c7f68fb Merge branch 'master' of https://git.fascinated.cc/MinecraftUtilities/Backend
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m35s
2024-04-18 12:41:38 +01:00
d9ebbfe99e update metrics websocket json response 2024-04-18 12:37:46 +01:00

View File

@ -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);
}