Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions server/monitor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down Expand Up @@ -246,26 +242,6 @@
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>metrics-javascript</id>
<goals>
<goal>java</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
<mainClass>org.apache.accumulo.monitor.next.views.ColumnJsGen</mainClass>
<classpathScope>compile</classpathScope>
<arguments>
<argument>${project.build.directory}/classes/org/apache/accumulo/monitor/resources/js/columns.js</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import jakarta.inject.Inject;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.ws.rs.BadRequestException;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.MatrixParam;
import jakarta.ws.rs.NotFoundException;
Expand Down Expand Up @@ -66,11 +67,6 @@ public class Endpoints {
*/
private static final String GROUP_PARAM_KEY = "group";

/**
* A {@code String} constant representing the supplied server type in path parameter.
*/
private static final String SERVER_TYPE_KEY = "serverType";

/**
* A {@code String} constant representing the supplied tableId in path parameter.
*/
Expand Down Expand Up @@ -254,13 +250,15 @@ public Map<Id,CumulativeDistributionSummary> getScanServerAllMetricSummary() {
@GET
@Path("servers/view")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns a UI-ready view model for server processes. Add ';serverType=<ServerId.Type>' to URL")
public ServersView getServerProcessView(@MatrixParam(SERVER_TYPE_KEY) ServerId.Type serverType) {
@Description("Returns a UI-ready table model for server process pages. Add ';table=<ServersView.ServerTable>' to URL")
public ServersView getServerProcessView(@MatrixParam("table") ServersView.ServerTable table) {
if (table == null) {
throw new BadRequestException("A 'table' parameter is required");
}
ServersView view =
monitor.getInformationFetcher().getSummaryForEndpoint().getServerProcessView(serverType);
monitor.getInformationFetcher().getSummaryForEndpoint().getServerProcessView(table);
if (view == null) {
throw new NotFoundException(
"ServersView object for server type " + serverType.name() + " not found");
throw new NotFoundException("ServersView object for table " + table.name() + " not found");
}
return view;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ public Stream<RunningCompactionInfo> stream() {
private final Set<String> configuredCompactionResourceGroups = ConcurrentHashMap.newKeySet();

private final AtomicLong timestamp = new AtomicLong(0);
private EnumMap<ServerId.Type,Supplier<ServersView>> serverMetricsView =
new EnumMap<>(ServerId.Type.class);
private final EnumMap<ServersView.ServerTable,Supplier<ServersView>> serverMetricsView =
new EnumMap<>(ServersView.ServerTable.class);
private DeploymentOverview deploymentOverview = new DeploymentOverview(0L, List.of());
private final int rgLongRunningCompactionSize;

Expand Down Expand Up @@ -658,28 +658,28 @@ public void finish() {
switch (type) {
case COMPACTOR:
compactors.values().forEach(servers::addAll);
serverMetricsView.put(type, memoize(
() -> new ServersView(servers, problemHostCount, allMetrics, timestamp.get())));
cacheServerProcessView(ServersView.ServerTable.COMPACTORS, servers, problemHostCount);
break;
case GARBAGE_COLLECTOR:
servers.add(gc.get());
serverMetricsView.put(type, memoize(
() -> new ServersView(servers, problemHostCount, allMetrics, timestamp.get())));
cacheServerProcessView(ServersView.ServerTable.GC_SUMMARY, servers, problemHostCount);
cacheServerProcessView(ServersView.ServerTable.GC_FILES, servers, problemHostCount);
cacheServerProcessView(ServersView.ServerTable.GC_WALS, servers, problemHostCount);
break;
case MANAGER:
servers.addAll(managers);
serverMetricsView.put(type, memoize(
() -> new ServersView(servers, problemHostCount, allMetrics, timestamp.get())));
cacheServerProcessView(ServersView.ServerTable.MANAGERS, servers, problemHostCount);
cacheServerProcessView(ServersView.ServerTable.MANAGER_FATE, servers, problemHostCount);
cacheServerProcessView(ServersView.ServerTable.MANAGER_COMPACTIONS, servers,
problemHostCount);
break;
case SCAN_SERVER:
sservers.values().forEach(servers::addAll);
serverMetricsView.put(type, memoize(
() -> new ServersView(servers, problemHostCount, allMetrics, timestamp.get())));
cacheServerProcessView(ServersView.ServerTable.SCAN_SERVERS, servers, problemHostCount);
break;
case TABLET_SERVER:
tservers.values().forEach(servers::addAll);
serverMetricsView.put(type, memoize(
() -> new ServersView(servers, problemHostCount, allMetrics, timestamp.get())));
cacheServerProcessView(ServersView.ServerTable.TABLET_SERVERS, servers, problemHostCount);
break;
case MONITOR:
default:
Expand Down Expand Up @@ -776,8 +776,17 @@ public long getTimestamp() {
return this.timestamp.get();
}

public ServersView getServerProcessView(ServerId.Type type) {
Supplier<ServersView> view = this.serverMetricsView.get(type);
/**
* Cache a ServersView for the given table and set of servers.
*/
private void cacheServerProcessView(ServersView.ServerTable table, Set<ServerId> servers,
long problemHostCount) {
serverMetricsView.put(table, memoize(() -> new ServersView(servers, problemHostCount,
allMetrics, timestamp.get(), ServersView.columnsFor(table))));
}

public ServersView getServerProcessView(ServersView.ServerTable table) {
Supplier<ServersView> view = this.serverMetricsView.get(table);
if (view != null) {
return view.get();
}
Expand Down

This file was deleted.

Loading