From 6bd84559332e175357b41a391ac10c4a1516f12c Mon Sep 17 00:00:00 2001 From: Guus der Kinderen Date: Mon, 25 Nov 2024 21:22:26 +0100 Subject: [PATCH] Update Database Query Statistics page Mostly converts the page from scriptlet to JSTL. Makes the tables that contain SQL wider Other minor CSS tweaks. --- .../main/resources/openfire_i18n.properties | 2 +- .../resources/openfire_i18n_cs_CZ.properties | 1 - .../resources/openfire_i18n_de.properties | 1 - .../resources/openfire_i18n_es.properties | 1 - .../resources/openfire_i18n_fa_IR.properties | 1 - .../resources/openfire_i18n_he.properties | 1 - .../resources/openfire_i18n_ja_JP.properties | 1 - .../resources/openfire_i18n_nl.properties | 38 +- .../resources/openfire_i18n_pl_PL.properties | 1 - .../resources/openfire_i18n_pt_BR.properties | 1 - .../resources/openfire_i18n_pt_PT.properties | 1 - .../resources/openfire_i18n_ru_RU.properties | 1 - .../resources/openfire_i18n_sk.properties | 1 - .../resources/openfire_i18n_uk_UA.properties | 1 - .../resources/openfire_i18n_zh_CN.properties | 1 - .../database/ProfiledConnectionEntry.java | 34 + .../src/main/webapp/server-db-stats.jsp | 664 ++++++++++-------- 17 files changed, 415 insertions(+), 336 deletions(-) diff --git a/i18n/src/main/resources/openfire_i18n.properties b/i18n/src/main/resources/openfire_i18n.properties index 782d19d530..3db5d87a1a 100644 --- a/i18n/src/main/resources/openfire_i18n.properties +++ b/i18n/src/main/resources/openfire_i18n.properties @@ -1218,10 +1218,10 @@ server.db_stats.enabled=Enabled server.db_stats.disabled=Disabled server.db_stats.update=Update server.db_stats.refresh=Refresh +server.db_stats.refresh_now=Refresh Now server.db_stats.none=none server.db_stats.settings=Query Statistics Settings server.db_stats.seconds=seconds -server.db_stats.set=Set server.db_stats.clear_stats=Clear All Stats server.db_stats.select_stats=SELECT Query Statistics server.db_stats.insert_stats=INSERT Query Statistics diff --git a/i18n/src/main/resources/openfire_i18n_cs_CZ.properties b/i18n/src/main/resources/openfire_i18n_cs_CZ.properties index d81d3b8cf4..2a9d43db79 100644 --- a/i18n/src/main/resources/openfire_i18n_cs_CZ.properties +++ b/i18n/src/main/resources/openfire_i18n_cs_CZ.properties @@ -862,7 +862,6 @@ server.db_stats.refresh=Občerstvit server.db_stats.none=žádná server.db_stats.settings=Nastavení statistiky dotazů server.db_stats.seconds=sekundy -server.db_stats.set=Nastavit server.db_stats.clear_stats=Vymazat všechny statistiky server.db_stats.select_stats=Statistika SELECT dotazů server.db_stats.insert_stats=Statistika INSERT dotazů diff --git a/i18n/src/main/resources/openfire_i18n_de.properties b/i18n/src/main/resources/openfire_i18n_de.properties index b50fa42347..2894f5435a 100644 --- a/i18n/src/main/resources/openfire_i18n_de.properties +++ b/i18n/src/main/resources/openfire_i18n_de.properties @@ -1113,7 +1113,6 @@ server.db_stats.query=Anfrage server.db_stats.refresh=Aktualisieren server.db_stats.seconds=Sekunden server.db_stats.select_stats=SELECT Anfragestatistiken -server.db_stats.set=Festlegen server.db_stats.settings=Anfragestatistik-Einstellungen server.db_stats.status=Anfragestatistik-Status server.db_stats.time=Gesamtzeit diff --git a/i18n/src/main/resources/openfire_i18n_es.properties b/i18n/src/main/resources/openfire_i18n_es.properties index afd9cadbb9..a0d20ca932 100644 --- a/i18n/src/main/resources/openfire_i18n_es.properties +++ b/i18n/src/main/resources/openfire_i18n_es.properties @@ -1089,7 +1089,6 @@ server.db_stats.refresh=Refrescar server.db_stats.none=nunca server.db_stats.settings=Configuración de Estadísticas de Consultas server.db_stats.seconds=segundos -server.db_stats.set=Setear server.db_stats.clear_stats=Resetear Estadísticas server.db_stats.select_stats=Estadísticas de SELECT server.db_stats.insert_stats=Estadísticas de INSERT diff --git a/i18n/src/main/resources/openfire_i18n_fa_IR.properties b/i18n/src/main/resources/openfire_i18n_fa_IR.properties index 087420dcd3..00de10e1dc 100644 --- a/i18n/src/main/resources/openfire_i18n_fa_IR.properties +++ b/i18n/src/main/resources/openfire_i18n_fa_IR.properties @@ -1078,7 +1078,6 @@ server.db_stats.refresh=بارگذاری مجدد server.db_stats.none=هیچ server.db_stats.settings=تنظیمات آمار کوئری server.db_stats.seconds=ثانیه -server.db_stats.set=تنظیم server.db_stats.clear_stats=پاک کردن تمام آمار server.db_stats.select_stats=آمار کوئری SELECT server.db_stats.insert_stats=آمار کوئری INSERT diff --git a/i18n/src/main/resources/openfire_i18n_he.properties b/i18n/src/main/resources/openfire_i18n_he.properties index 117529b4d4..df150e936a 100644 --- a/i18n/src/main/resources/openfire_i18n_he.properties +++ b/i18n/src/main/resources/openfire_i18n_he.properties @@ -1076,7 +1076,6 @@ server.db_stats.refresh=רענן server.db_stats.none=none server.db_stats.settings=Query Statistics Settings server.db_stats.seconds=שניות -server.db_stats.set=Set server.db_stats.clear_stats=טהר את כל הסטטיסטיקה server.db_stats.select_stats=SELECT Query Statistics server.db_stats.insert_stats=INSERT Query Statistics diff --git a/i18n/src/main/resources/openfire_i18n_ja_JP.properties b/i18n/src/main/resources/openfire_i18n_ja_JP.properties index e79eb73529..f96a5b818b 100644 --- a/i18n/src/main/resources/openfire_i18n_ja_JP.properties +++ b/i18n/src/main/resources/openfire_i18n_ja_JP.properties @@ -859,7 +859,6 @@ server.db_stats.refresh=リフレッシュ server.db_stats.none=なし server.db_stats.settings=クエリー統計設定 server.db_stats.seconds=秒 -server.db_stats.set=セット server.db_stats.clear_stats=全統計のクリアー server.db_stats.select_stats=SELECTクエリー統計 server.db_stats.insert_stats=INSERTクエリー統計 diff --git a/i18n/src/main/resources/openfire_i18n_nl.properties b/i18n/src/main/resources/openfire_i18n_nl.properties index 0e25ad5b53..92ac446cf7 100644 --- a/i18n/src/main/resources/openfire_i18n_nl.properties +++ b/i18n/src/main/resources/openfire_i18n_nl.properties @@ -1067,32 +1067,32 @@ server.db.test_timeout=Test Timeout: server.db.connection_mean_borrow_time=Average time waited: server.db.connection_max_borrow_time=Max time waited: -server.db_stats.title=Database Query Statistics +server.db_stats.title=Database Query Statistieken server.db_stats.description=Enable database query statistics to trace all database queries made. This can be useful to debug issues and monitor database performance. However, it's not recommended that you leave query statistics permanently running, as they will cause performance to degrade slightly. server.db_stats.status=Query Statistics Status server.db_stats.enabled=Ingeschakeld server.db_stats.disabled=Uitgeschakeld server.db_stats.update=Update -server.db_stats.refresh=Refresh -server.db_stats.none=none -server.db_stats.settings=Query Statistics Settings -server.db_stats.seconds=seconds -server.db_stats.set=Set +server.db_stats.refresh=Ververs +server.db_stats.refresh_now=Ververs Nu +server.db_stats.none=geen +server.db_stats.settings=Query Statistics Configuratie +server.db_stats.seconds=seconden server.db_stats.clear_stats=Clear All Stats -server.db_stats.select_stats=SELECT Query Statistics -server.db_stats.insert_stats=INSERT Query Statistics -server.db_stats.update_stats=UPDATE Query Statistics -server.db_stats.delete_stats=DELETE Query Statistics -server.db_stats.operations=Total # of operations -server.db_stats.total_time=Total time for all operations (ms) -server.db_stats.avg_rate=Average time for each operation (ms) -server.db_stats.total_rate=Operations per second -server.db_stats.queries=Most common SQL queries +server.db_stats.select_stats=SELECT Query Statistieken +server.db_stats.insert_stats=INSERT Query Statistieken +server.db_stats.update_stats=UPDATE Query Statistieken +server.db_stats.delete_stats=DELETE Query Statistieken +server.db_stats.operations=Totaal # operaties +server.db_stats.total_time=Totale tijd voor alle operaties (ms) +server.db_stats.avg_rate=Gemiddelde time voor een operatie (ms) +server.db_stats.total_rate=Operaties per seconde +server.db_stats.queries=Meestgebruikte SQL queries server.db_stats.query=Query -server.db_stats.count=Count -server.db_stats.time=Total Time -server.db_stats.average_time=Avg. Time -server.db_stats.no_queries=No queries +server.db_stats.count=Aantal +server.db_stats.time=Totaal Tijd +server.db_stats.average_time=Gem. Tijd +server.db_stats.no_queries=Geen queries # diff --git a/i18n/src/main/resources/openfire_i18n_pl_PL.properties b/i18n/src/main/resources/openfire_i18n_pl_PL.properties index c6b6215eee..c2f203e517 100644 --- a/i18n/src/main/resources/openfire_i18n_pl_PL.properties +++ b/i18n/src/main/resources/openfire_i18n_pl_PL.properties @@ -2150,7 +2150,6 @@ server.db_stats.query=Query server.db_stats.refresh=Refresh server.db_stats.seconds=seconds server.db_stats.select_stats=SELECT Query Statistics -server.db_stats.set=Set server.db_stats.settings=Query Statistics Settings server.db_stats.status=Query Statistics Status server.db_stats.time=Total Time diff --git a/i18n/src/main/resources/openfire_i18n_pt_BR.properties b/i18n/src/main/resources/openfire_i18n_pt_BR.properties index d53fd76a61..3818dae1d3 100644 --- a/i18n/src/main/resources/openfire_i18n_pt_BR.properties +++ b/i18n/src/main/resources/openfire_i18n_pt_BR.properties @@ -859,7 +859,6 @@ server.db_stats.refresh=Atualizar server.db_stats.none=nenhum server.db_stats.settings=Configurações das Estatísticas de Consulta server.db_stats.seconds=segundos -server.db_stats.set=Definir server.db_stats.clear_stats=Limpar todas as estatísticas server.db_stats.select_stats=Estatística de Consulta SELECT server.db_stats.insert_stats=Estatística de Consulta INSERT diff --git a/i18n/src/main/resources/openfire_i18n_pt_PT.properties b/i18n/src/main/resources/openfire_i18n_pt_PT.properties index 4c978eee34..c8dbb3d713 100644 --- a/i18n/src/main/resources/openfire_i18n_pt_PT.properties +++ b/i18n/src/main/resources/openfire_i18n_pt_PT.properties @@ -953,7 +953,6 @@ server.db_stats.refresh=Atualizar server.db_stats.none=Nenhum server.db_stats.settings=Configurações das Estatísticas de Consulta server.db_stats.seconds=segundos -server.db_stats.set=Definir server.db_stats.clear_stats=Limpar todas as estatísticas server.db_stats.select_stats=Estatística de Consulta SELECT server.db_stats.insert_stats=Estatística de Consulta INSERT diff --git a/i18n/src/main/resources/openfire_i18n_ru_RU.properties b/i18n/src/main/resources/openfire_i18n_ru_RU.properties index 70066a9d4f..d2040195d0 100644 --- a/i18n/src/main/resources/openfire_i18n_ru_RU.properties +++ b/i18n/src/main/resources/openfire_i18n_ru_RU.properties @@ -1035,7 +1035,6 @@ server.db_stats.refresh=Обновлять server.db_stats.none=никогда server.db_stats.settings=Настройки статистики запросов server.db_stats.seconds=секунд -server.db_stats.set=Задать server.db_stats.clear_stats=Очистить всю статистику server.db_stats.select_stats=SELECT статистика запросов server.db_stats.insert_stats=INSERT статистика запросов diff --git a/i18n/src/main/resources/openfire_i18n_sk.properties b/i18n/src/main/resources/openfire_i18n_sk.properties index cf889973e0..402ec94341 100644 --- a/i18n/src/main/resources/openfire_i18n_sk.properties +++ b/i18n/src/main/resources/openfire_i18n_sk.properties @@ -837,7 +837,6 @@ server.db_stats.refresh=Obnoviť server.db_stats.none=žiadne server.db_stats.settings=Nastavenia štatistiky požiadaviek server.db_stats.seconds=sekúnd -server.db_stats.set=Nastavenie server.db_stats.clear_stats=Vyčistiť všetky štatistiky server.db_stats.select_stats=Štatistika požiadaviek SELECT server.db_stats.insert_stats=Štatistika požiadaviek INSERT diff --git a/i18n/src/main/resources/openfire_i18n_uk_UA.properties b/i18n/src/main/resources/openfire_i18n_uk_UA.properties index 68b4168eec..b9ae0dbcce 100644 --- a/i18n/src/main/resources/openfire_i18n_uk_UA.properties +++ b/i18n/src/main/resources/openfire_i18n_uk_UA.properties @@ -1076,7 +1076,6 @@ server.db_stats.refresh=Оновити server.db_stats.none=жодного server.db_stats.settings=Налаштування статистики запиту server.db_stats.seconds=секунд -server.db_stats.set=Встановити server.db_stats.clear_stats=Очистити всю статистику server.db_stats.select_stats=ОБЕРІТЬ статистику запиту server.db_stats.insert_stats=ВСТАВИТИ статистику запиту diff --git a/i18n/src/main/resources/openfire_i18n_zh_CN.properties b/i18n/src/main/resources/openfire_i18n_zh_CN.properties index 9205662a59..fc52b6a120 100644 --- a/i18n/src/main/resources/openfire_i18n_zh_CN.properties +++ b/i18n/src/main/resources/openfire_i18n_zh_CN.properties @@ -1113,7 +1113,6 @@ server.db_stats.refresh=刷新 server.db_stats.none=没有 server.db_stats.settings=查询统计数据设置 server.db_stats.seconds=秒 -server.db_stats.set=设置 server.db_stats.clear_stats=清除所有统计数据 server.db_stats.select_stats=选择查询统计数据 server.db_stats.insert_stats=插入查询统计数据 diff --git a/xmppserver/src/main/java/org/jivesoftware/database/ProfiledConnectionEntry.java b/xmppserver/src/main/java/org/jivesoftware/database/ProfiledConnectionEntry.java index a0f4deffd5..746dd042fb 100644 --- a/xmppserver/src/main/java/org/jivesoftware/database/ProfiledConnectionEntry.java +++ b/xmppserver/src/main/java/org/jivesoftware/database/ProfiledConnectionEntry.java @@ -44,4 +44,38 @@ public ProfiledConnectionEntry(String sql) { count = 0; totalTime = Duration.ZERO; } + + public String getSql() + { + return sql; + } + + public void setSql(String sql) + { + this.sql = sql; + } + + public int getCount() + { + return count; + } + + public void setCount(int count) + { + this.count = count; + } + + public Duration getTotalTime() + { + return totalTime; + } + + public void setTotalTime(Duration totalTime) + { + this.totalTime = totalTime; + } + + public Duration getAverageTime() { + return this.totalTime.dividedBy(count); + } } diff --git a/xmppserver/src/main/webapp/server-db-stats.jsp b/xmppserver/src/main/webapp/server-db-stats.jsp index 04f69bde66..33d42d1fb4 100644 --- a/xmppserver/src/main/webapp/server-db-stats.jsp +++ b/xmppserver/src/main/webapp/server-db-stats.jsp @@ -1,7 +1,7 @@ <%@ page contentType="text/html; charset=UTF-8" %> <%-- - - - Copyright (C) 2004-2008 Jive Software, 2016-2022 Ignite Realtime Foundation. All rights reserved. + - Copyright (C) 2004-2008 Jive Software, 2016-2024 Ignite Realtime Foundation. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ --%> <%@ page import="java.text.*" - errorPage="error.jsp" + errorPage="error.jsp" %> <%@ page import="org.jivesoftware.database.DbConnectionManager"%> <%@ page import="org.jivesoftware.util.JiveGlobals"%> @@ -30,6 +30,7 @@ <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> +<%@ taglib uri="admin" prefix="admin" %> <% webManager.init(request, response, session, application, out ); %> @@ -82,367 +83,424 @@ } } - boolean showQueryStats = DbConnectionManager.isProfilingEnabled(); - // Number intFormat for pretty printing of large number values and decimals: NumberFormat intFormat = NumberFormat.getInstance(JiveGlobals.getLocale()); DecimalFormat decFormat = new DecimalFormat("#,##0.00"); + + pageContext.setAttribute("refresh", refresh); + pageContext.setAttribute("profilingEnabled", DbConnectionManager.isProfilingEnabled()); + pageContext.setAttribute("selectList", ProfiledConnection.getSortedQueries(ProfiledConnection.Type.select, doSortByTime)); + pageContext.setAttribute("insertList", ProfiledConnection.getSortedQueries(ProfiledConnection.Type.insert, doSortByTime)); + pageContext.setAttribute("updateList", ProfiledConnection.getSortedQueries(ProfiledConnection.Type.update, doSortByTime)); + pageContext.setAttribute("deleteList", ProfiledConnection.getSortedQueries(ProfiledConnection.Type.delete, doSortByTime)); %> - - <fmt:message key="server.db_stats.title" /> - + + <fmt:message key="server.db_stats.title" /> + <% // Enable refreshing if specified if (refresh >= 10) { %> - + <% } %> +

- +

- - -
-

- -
- - - - - - - -
- > - - - > - - - "> -
-
+

-<% if (showQueryStats) { %> +
+ + + + + + + +
+ + + + + + + "> +
+
+ +

- - + - - - - - - + <% } %> + + + + + + +
- : -
+ : + - - "> - | - "> - | - "> -
| + "> + | + "> +
- + - - + - - + - +