You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "dlmarion (via GitHub)" <gi...@apache.org> on 2026/04/28 15:51:53 UTC
[PR] Refactored ServersView class into several classes [accumulo]
dlmarion opened a new pull request, #6344:
URL: https://github.com/apache/accumulo/pull/6344
This change refactors the ServersView class into
several classes to make it easier to read and
understand. The ColumnFactory interface and
implementations, and the Status class, were moved
into their own files. The ServersView object
was renamed to TableData as it represents a
generic DTO object that is comprised of a
list of columns and the corresponding metric
data for those columns. The logic for creating
the TableData objects was moved into the new
TableDataFactory class.
Closes #6341
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Refactored ServersView class into several classes [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #6344:
URL: https://github.com/apache/accumulo/pull/6344#discussion_r3155714528
##########
server/monitor/src/main/java/org/apache/accumulo/monitor/next/views/TableDataFactory.java:
##########
@@ -154,26 +120,31 @@ public Object getRowData(ServerId sid, MetricResponse mr,
}
});
- public final List<Map<String,Object>> data = new ArrayList<>();
- public final List<Column> columns;
- public final long timestamp;
+ private record ServerMetricRow(ServerId server, MetricResponse response,
+ Map<String,List<FMetric>> metrics) {
+ }
- public ServersView(final Set<ServerId> servers, final long problemServerCount,
+ public static boolean hasMetricData(MetricResponse mr) {
+ return mr != null && mr.getMetrics() != null && !mr.getMetrics().isEmpty();
+ }
+
+ public static TableData forColumns(final Set<ServerId> servers,
final Map<ServerId,MetricResponse> allMetrics, final long timestamp,
- final List<ColumnFactory> requestedColumns) {
+ List<ColumnFactory> requestedColumns) {
+
+ List<Column> columns = requestedColumns.stream().map(ColumnFactory::getColumn).toList();
// Grab the current metrics for each server
List<ServerMetricRow> serverMetricRows = servers.stream().sorted().map(serverId -> {
MetricResponse metricResponse = allMetrics.get(serverId);
boolean hasMetricData = hasMetricData(metricResponse);
Map<String,List<FMetric>> serverMetrics =
- hasMetricData ? metricValuesByName(metricResponse) : Map.of();
+ hasMetricData ? TableDataFactory.metricValuesByName(metricResponse) : Map.of();
Review Comment:
Seems like `TableDataFactory.` could be dropped.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Refactored ServersView class into several classes [accumulo]
Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion merged PR #6344:
URL: https://github.com/apache/accumulo/pull/6344
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Refactored ServersView class into several classes [accumulo]
Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #6344:
URL: https://github.com/apache/accumulo/pull/6344#discussion_r3155847875
##########
server/monitor/src/main/java/org/apache/accumulo/monitor/next/views/TableDataFactory.java:
##########
@@ -154,26 +120,31 @@ public Object getRowData(ServerId sid, MetricResponse mr,
}
});
- public final List<Map<String,Object>> data = new ArrayList<>();
- public final List<Column> columns;
- public final long timestamp;
+ private record ServerMetricRow(ServerId server, MetricResponse response,
+ Map<String,List<FMetric>> metrics) {
+ }
- public ServersView(final Set<ServerId> servers, final long problemServerCount,
+ public static boolean hasMetricData(MetricResponse mr) {
+ return mr != null && mr.getMetrics() != null && !mr.getMetrics().isEmpty();
+ }
+
+ public static TableData forColumns(final Set<ServerId> servers,
final Map<ServerId,MetricResponse> allMetrics, final long timestamp,
- final List<ColumnFactory> requestedColumns) {
+ List<ColumnFactory> requestedColumns) {
+
+ List<Column> columns = requestedColumns.stream().map(ColumnFactory::getColumn).toList();
// Grab the current metrics for each server
List<ServerMetricRow> serverMetricRows = servers.stream().sorted().map(serverId -> {
MetricResponse metricResponse = allMetrics.get(serverId);
boolean hasMetricData = hasMetricData(metricResponse);
Map<String,List<FMetric>> serverMetrics =
- hasMetricData ? metricValuesByName(metricResponse) : Map.of();
+ hasMetricData ? TableDataFactory.metricValuesByName(metricResponse) : Map.of();
Review Comment:
Good catch, that was left over from some refactoring. Removed in 8326bf1
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org