dlmarion commented on code in PR #6429:
URL: https://github.com/apache/accumulo/pull/6429#discussion_r3423350804
##########
server/monitor/src/main/java/org/apache/accumulo/monitor/next/SystemInformation.java:
##########
@@ -1639,6 +1641,15 @@ public TableData
getServerProcessView(TableDataFactory.TableName table) {
return null;
}
+ public MetricResponse getServerMetricResponse(ServerId.Type type, String
resourceGroup,
+ String serverAddress) {
+ return allMetrics.asMap().entrySet().stream().filter(e ->
e.getKey().getType() == type)
+ .filter(e -> resourceGroup == null || resourceGroup.isBlank()
+ || e.getKey().getResourceGroup().canonical().equals(resourceGroup))
+ .filter(e ->
e.getKey().toHostPortString().equals(serverAddress)).map(Entry::getValue)
+ .findFirst().orElse(null);
Review Comment:
Can you create a ServerId from the input parameters and get the
corresponding value from the `allMetrics` cache instead of evaluating each
entry multiple times?
##########
server/monitor/src/main/java/org/apache/accumulo/monitor/next/views/TableDataFactory.java:
##########
@@ -157,6 +176,44 @@ public static TableData forColumns(final Set<ServerId>
servers,
}
+ public static TableData forServer(final MetricResponse metricResponse) {
+ if (!hasMetricData(metricResponse)) {
+ return new TableData(SERVER_DETAIL_COLUMNS, List.of());
+ }
+
+ List<Map<String,Object>> data = new ArrayList<>();
+ for (var binary : metricResponse.getMetrics()) {
+ var metric = FMetric.getRootAsFMetric(binary);
Review Comment:
There is another method on FMetric which will reduce object allocation. For
example:
```
FMetric fm = new FMetric();
for (final ByteBuffer binary : response.getMetrics()) {
fm = FMetric.getRootAsFMetric(binary, fm);
...
```
--
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]