You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by dl...@apache.org on 2026/05/26 15:55:26 UTC
(accumulo) branch main updated: Display information collection time on Monitor pages (#6385)
This is an automated email from the ASF dual-hosted git repository.
dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new 719cbcdbef Display information collection time on Monitor pages (#6385)
719cbcdbef is described below
commit 719cbcdbef8e4755e60bb73f557fa77acb0154fb
Author: Dave Marion <dl...@apache.org>
AuthorDate: Tue May 26 11:55:18 2026 -0400
Display information collection time on Monitor pages (#6385)
This change removes the timestamp from some REST API
responses because it was not being used and instead
displays the last fetch cycle time and duration at the
bottom of each page.
---
.../apache/accumulo/monitor/next/Endpoints.java | 10 ++++----
.../accumulo/monitor/next/InformationFetcher.java | 3 ++-
.../accumulo/monitor/next/SystemInformation.java | 28 ++++++++++++----------
.../next/deployment/DeploymentOverview.java | 11 ++++-----
.../accumulo/monitor/next/views/TableData.java | 2 +-
.../monitor/next/views/TableDataFactory.java | 9 ++++---
.../accumulo/monitor/resources/js/functions.js | 21 ++++++++++++++++
.../monitor/resources/js/server_process_common.js | 3 +--
.../apache/accumulo/monitor/templates/default.ftl | 5 ++++
9 files changed, 61 insertions(+), 31 deletions(-)
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/Endpoints.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/Endpoints.java
index 75b8ff9325..d3bbd20147 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/Endpoints.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/Endpoints.java
@@ -61,6 +61,7 @@ import org.apache.accumulo.monitor.next.SystemInformation.AlertPriority;
import org.apache.accumulo.monitor.next.SystemInformation.CompactionGroupSummary;
import org.apache.accumulo.monitor.next.SystemInformation.CompactionTableSummary;
import org.apache.accumulo.monitor.next.SystemInformation.FateTransaction;
+import org.apache.accumulo.monitor.next.SystemInformation.FetchCycleTimes;
import org.apache.accumulo.monitor.next.SystemInformation.RecoveryInformation;
import org.apache.accumulo.monitor.next.SystemInformation.TableSummary;
import org.apache.accumulo.monitor.next.SystemInformation.TimeOrderedRunningCompactionSet;
@@ -182,7 +183,7 @@ public class Endpoints {
public MonitorStatus getStatus() {
SystemInformation summary = monitor.getInformationFetcher().getSummaryForEndpoint();
return new MonitorStatus(summary.getManagerGoalState(), summary.getComponentStatuses(),
- summary.getTimestamp());
+ summary.getCollectionTiming().finishTime());
}
@GET
@@ -385,7 +386,8 @@ public class Endpoints {
@Description("Returns External Compactor process details")
public CompactorsSummary getExternalCompactors() {
var summary = monitor.getInformationFetcher().getSummaryForEndpoint();
- return new CompactorsSummary(summary.getCompactorServers(), summary.getTimestamp());
+ return new CompactorsSummary(summary.getCompactorServers(),
+ summary.getCollectionTiming().finishTime());
}
@GET
@@ -518,8 +520,8 @@ public class Endpoints {
@Path("lastUpdate")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns the timestamp of when the monitor information was last refreshed")
- public long getTimestamp() {
- return monitor.getInformationFetcher().getSummaryForEndpoint().getTimestamp();
+ public FetchCycleTimes getTimestamp() {
+ return monitor.getInformationFetcher().getSummaryForEndpoint().getCollectionTiming();
}
@GET
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/InformationFetcher.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/InformationFetcher.java
index dd5011b479..b606a738b8 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/InformationFetcher.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/InformationFetcher.java
@@ -739,6 +739,7 @@ public class InformationFetcher implements RemovalListener<ServerId,MetricRespon
newConnectionEvent.compareAndExchange(true, false);
LOG.info("Fetching information from servers");
+ long fetchCycleStart = System.currentTimeMillis();
final UpdateTasks futures = new UpdateTasks();
final SystemInformation summary = new SystemInformation(allMetrics, this.ctx);
@@ -873,7 +874,7 @@ public class InformationFetcher implements RemovalListener<ServerId,MetricRespon
lastRunTime = NanoTime.now();
retainedProblemServers.asMap().keySet().forEach(summary::retainProblemServer);
- summary.finish(failures, cancelled);
+ summary.finish(failures, cancelled, fetchCycleStart);
LOG.info("Finished fetching metrics from servers");
LOG.info(
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/SystemInformation.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/SystemInformation.java
index 698bf8cc90..49e586e5fb 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/SystemInformation.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/SystemInformation.java
@@ -469,6 +469,9 @@ public class SystemInformation {
long created, List<String> heldLocks, List<String> waitingLocks, LockRangeType lockRange) {
}
+ public record FetchCycleTimes(long durationMs, long finishTime) {
+ }
+
private static final Logger LOG = LoggerFactory.getLogger(SystemInformation.class);
private final DistributionStatisticConfig DSC =
@@ -539,14 +542,14 @@ public class SystemInformation {
private final List<FateTransaction> fateTransactions = new ArrayList<>();
- private final AtomicLong timestamp = new AtomicLong(0);
private final EnumMap<ServerId.Type,Status> componentStatuses =
new EnumMap<>(ServerId.Type.class);
private final EnumMap<TableDataFactory.TableName,Supplier<TableData>> serverMetricsView =
new EnumMap<>(TableDataFactory.TableName.class);
- private DeploymentOverview deploymentOverview = new DeploymentOverview(0L, List.of());
+ private DeploymentOverview deploymentOverview = new DeploymentOverview(List.of());
private String managerGoalState;
private final int rgLongRunningCompactionSize;
+ private FetchCycleTimes timing = null;
public SystemInformation(Cache<ServerId,MetricResponse> allMetrics, ServerContext ctx) {
this.allMetrics = allMetrics;
@@ -791,9 +794,9 @@ public class SystemInformation {
if (!qm.isEmpty()) {
// Create a ServersView object from the MetricResponse for each queue
- return TableDataFactory.forColumns(qm.keySet(), qm, timestamp.get(), cols);
+ return TableDataFactory.forColumns(qm.keySet(), qm, cols);
}
- return TableDataFactory.forColumns(Set.of(), Map.of(), timestamp.get(), cols);
+ return TableDataFactory.forColumns(Set.of(), Map.of(), cols);
}
public void processResponse(final ServerId server, final MetricResponse response,
@@ -1184,8 +1187,8 @@ public class SystemInformation {
}
- public void finish(final List<UpdateTaskFuture> failures,
- final List<UpdateTaskFuture> cancelled) {
+ public void finish(final List<UpdateTaskFuture> failures, final List<UpdateTaskFuture> cancelled,
+ long fetchCycleStart) {
// Update the deployment not-responded numbers based
// on metric fetch failures for this refresh.
metricProblemHosts.forEach(serverId -> {
@@ -1195,7 +1198,6 @@ public class SystemInformation {
computeAlerts(failures, cancelled);
- timestamp.set(System.currentTimeMillis());
componentStatuses.clear();
for (final ServerId.Type type : ServerId.Type.values()) {
if (type == ServerId.Type.MONITOR) {
@@ -1248,8 +1250,10 @@ public class SystemInformation {
break;
}
}
- deploymentOverview = DeploymentOverview.fromSummary(deployment, timestamp);
+ deploymentOverview = DeploymentOverview.fromSummary(deployment);
computeAlertCounts();
+ long fetchCycleFinish = System.currentTimeMillis();
+ timing = new FetchCycleTimes((fetchCycleFinish - fetchCycleStart), fetchCycleFinish);
}
public Set<String> getResourceGroups() {
@@ -1429,16 +1433,16 @@ public class SystemInformation {
return this.alertCounts;
}
- public long getTimestamp() {
- return this.timestamp.get();
+ public FetchCycleTimes getCollectionTiming() {
+ return this.timing;
}
/**
* Cache a ServersView for the given table and set of servers.
*/
private void cacheServerProcessView(TableDataFactory.TableName table, Set<ServerId> servers) {
- serverMetricsView.put(table, memoize(
- () -> TableDataFactory.forTable(table, servers, allMetrics.asMap(), timestamp.get())));
+ serverMetricsView.put(table,
+ memoize(() -> TableDataFactory.forTable(table, servers, allMetrics.asMap())));
}
public TableData getServerProcessView(TableDataFactory.TableName table) {
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/deployment/DeploymentOverview.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/deployment/DeploymentOverview.java
index 50375e27bb..cc4021c903 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/deployment/DeploymentOverview.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/deployment/DeploymentOverview.java
@@ -21,7 +21,6 @@ package org.apache.accumulo.monitor.next.deployment;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
import org.apache.accumulo.core.client.admin.servers.ServerId;
import org.apache.accumulo.core.data.ResourceGroupId;
@@ -30,7 +29,7 @@ import org.apache.accumulo.monitor.next.SystemInformation.ProcessSummary;
/**
* Data Transfer Object for the Monitor Deployment page.
*/
-public record DeploymentOverview(long lastUpdate, List<DeploymentRow> breakdown) {
+public record DeploymentOverview(List<DeploymentRow> breakdown) {
/**
* Data Transfer Object containing counts of total and responding servers for a given resource
@@ -40,10 +39,10 @@ public record DeploymentOverview(long lastUpdate, List<DeploymentRow> breakdown)
long responding) {
}
- public static DeploymentOverview fromSummary(
- Map<ResourceGroupId,Map<ServerId.Type,ProcessSummary>> deployment, AtomicLong lastUpdate) {
+ public static DeploymentOverview
+ fromSummary(Map<ResourceGroupId,Map<ServerId.Type,ProcessSummary>> deployment) {
if (deployment == null || deployment.isEmpty()) {
- return new DeploymentOverview(lastUpdate.get(), List.of());
+ return new DeploymentOverview(List.of());
}
var breakdown =
@@ -64,7 +63,7 @@ public record DeploymentOverview(long lastUpdate, List<DeploymentRow> breakdown)
});
}).toList();
- return new DeploymentOverview(lastUpdate.get(), breakdown);
+ return new DeploymentOverview(breakdown);
}
/**
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/views/TableData.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/views/TableData.java
index 7b08cf0b96..7789c55f0d 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/views/TableData.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/views/TableData.java
@@ -35,7 +35,7 @@ import java.util.Map;
* </pre>
*
*/
-public record TableData(List<Column> columns, List<Map<String,Object>> data, long timestamp) {
+public record TableData(List<Column> columns, List<Map<String,Object>> data) {
/**
* Definition of a column to be rendered in the UI
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/views/TableDataFactory.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/views/TableDataFactory.java
index e3eb7310f8..a16cb13063 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/views/TableDataFactory.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/views/TableDataFactory.java
@@ -129,8 +129,7 @@ public class TableDataFactory {
}
public static TableData forColumns(final Set<ServerId> servers,
- final Map<ServerId,MetricResponse> allMetrics, final long timestamp,
- List<ColumnFactory> requestedColumns) {
+ final Map<ServerId,MetricResponse> allMetrics, List<ColumnFactory> requestedColumns) {
List<Column> columns = requestedColumns.stream().map(ColumnFactory::getColumn).toList();
@@ -154,15 +153,15 @@ public class TableDataFactory {
data.add(row);
});
- return new TableData(columns, data, timestamp);
+ return new TableData(columns, data);
}
public static TableData forTable(final TableName table, final Set<ServerId> servers,
- final Map<ServerId,MetricResponse> allMetrics, final long timestamp) {
+ final Map<ServerId,MetricResponse> allMetrics) {
List<ColumnFactory> requestedColumns = columnsFor(table);
- return forColumns(servers, allMetrics, timestamp, requestedColumns);
+ return forColumns(servers, allMetrics, requestedColumns);
}
/**
diff --git a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/functions.js b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/functions.js
index 39cd8b28e4..416a14cd58 100644
--- a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/functions.js
+++ b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/functions.js
@@ -43,6 +43,7 @@ const ALERT_CATEGORIES = 'alertCategories';
const ALERTS = 'alerts';
const ALERT_COUNTS = 'alertCounts';
const RECOVERY = 'recovery';
+const LAST_UPDATE = 'lastUpdate';
// Override Length Menu options for dataTables
if ($.fn && $.fn.dataTable) {
@@ -87,9 +88,21 @@ TIMER = setInterval(function () {
if (localStorage.getItem(AUTO_REFRESH_KEY) === 'true') {
refresh();
refreshNavBar();
+ refreshLastUpdate();
}
}, 5000);
+
+function refreshLastUpdate() {
+ getLastUpdate().then(function () {
+ var timing = getStoredJson(LAST_UPDATE, {});
+ $('#lastUpdateDiv').empty();
+ var msg = $(document.createElement("span"));
+ msg.text('Data as of ' + dateFormat(timing.finishTime).replace(/ /g, ' ') +
+ '. Took ' + timeDuration(timing.durationMs).replace(/ /g, ' ') + ' to collect.');
+ $('#lastUpdateDiv').append(msg);
+ });
+}
/**
* Adds the suffix to the number, converts the number to one close to the base
*
@@ -840,6 +853,14 @@ function getRunningCompactionsByGroup() {
return getJSONForTable(REST_V2_PREFIX + '/compactions/running/group', RUNNING_COMPACTIONS_BY_GROUP);
}
+/**
+ * REST GET call for /lastUpdate,
+ * stores it on a sessionStorage variable
+ */
+function getLastUpdateTime() {
+ return getJSONForTable(REST_V2_PREFIX + '/lastUpdate', LAST_UPDATE);
+}
+
/**
* Returns true if the input is a valid regular expression, false otherwise.
diff --git a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/server_process_common.js b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/server_process_common.js
index ad32a6db94..c711f6e8db 100644
--- a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/server_process_common.js
+++ b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/server_process_common.js
@@ -47,8 +47,7 @@
* "description": "Description of Column B",
* "uiClass": ""
* }
- * ],
- * timestamp: long
+ * ]
* }
*
* The value for the 'columns' key is an array of column definitions. The value for the
diff --git a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/default.ftl b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/default.ftl
index 1ecc67652d..1e2ad1e5ef 100644
--- a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/default.ftl
+++ b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/default.ftl
@@ -64,6 +64,7 @@
*/
$(function() {
setupAutoRefresh();
+ refreshLastUpdate();
});
</script>
<#if js??>
@@ -86,8 +87,12 @@
<div id="main" class="container-fluid">
<#include "${template}">
+ <br />
+ <div id="lastUpdateDiv" class="center">
+ </div>
</div>
<#include "modals.ftl">
+
</body>
</html>