DomGarguilo commented on code in PR #6165:
URL: https://github.com/apache/accumulo/pull/6165#discussion_r2880257245
##########
server/monitor/src/main/java/org/apache/accumulo/monitor/next/Endpoints.java:
##########
@@ -268,11 +270,29 @@ public Map<Id,CumulativeDistributionSummary>
getCompactorAllMetricSummary() {
@GET
@Path("sservers/summary")
@Produces(MediaType.APPLICATION_JSON)
- @Description("Returns an aggregate view of the metric responses for all
ScanServers")
+ @Description("Returns an aggregate raw metric summary for all ScanServers")
public Map<Id,CumulativeDistributionSummary> getScanServerAllMetricSummary()
{
return
monitor.getInformationFetcher().getSummaryForEndpoint().getSServerAllMetricSummary();
}
+ @GET
+ @Path("sservers/view")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Description("Returns a UI-ready view model for the Scan Server status page")
+ public ScanServerView getScanServerPageView() {
+ var summary = monitor.getInformationFetcher().getSummaryForEndpoint();
+ Set<ServerId> scanServers =
+
summary.getResourceGroups().stream().map(summary::getSServerResourceGroupServers)
+
.filter(Objects::nonNull).flatMap(Set::stream).collect(Collectors.toSet());
+ int problemScanServerCount = (int) summary.getProblemHosts().stream()
+ .filter(serverId -> serverId.getType() ==
ServerId.Type.SCAN_SERVER).count();
+ long nowMs = System.currentTimeMillis();
+ Collection<MetricResponse> responses =
+
monitor.getInformationFetcher().getAllMetrics().getAllPresent(scanServers).values();
+ return ScanServerView.fromMetrics(responses, scanServers.size(),
problemScanServerCount, nowMs,
+ summary.getTimestamp());
Review Comment:
> If you moved the computation into the SystemInformation class, then you
would have access to the `rgSServerMetrics` object which already stores the
scan server metrics by resource group, and you would only need to compute the
view once, in the SystemInformation.finish method.
good idea. done in 056c7f9
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]