Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand All @@ -46,6 +48,7 @@
import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.metrics.flatbuffers.FMetric;
import org.apache.accumulo.core.process.thrift.MetricResponse;
import org.apache.accumulo.core.rpc.clients.ManagerClient;
import org.apache.accumulo.core.util.compaction.RunningCompactionInfo;
import org.apache.accumulo.monitor.Monitor;
import org.apache.accumulo.monitor.next.InformationFetcher.InstanceSummary;
Expand All @@ -55,6 +58,7 @@
import org.apache.accumulo.monitor.next.ec.CompactorsSummary;
import org.apache.accumulo.monitor.next.ec.CoordinatorSummary;
import org.apache.accumulo.monitor.next.sservers.ScanServerView;
import org.apache.accumulo.server.manager.FateLocations;

import io.micrometer.core.instrument.Meter.Id;
import io.micrometer.core.instrument.cumulative.CumulativeDistributionSummary;
Expand Down Expand Up @@ -168,6 +172,30 @@ public List<FMetric> getManagerMetrics() {
return List.of();
}

@GET
@Path("manager/responsibilities")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns each managers responsibilities")
public Map<String,List<String>> getManagerResponsibilities() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting this here, instead of in SystemInformation, will hit ZooKeeper every time this endpoint is hit, so every page refresh for every browser showing the Monitor. The model that we have been using so far is to store the information we want to display in the SystemInformation object, which will provide a consistent response for a point in time until the object is refreshed. This would make this endpoint real-time vs point-in-time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can look into moving it into SystemInformation when I circle back to this after #6278 is merged.

var fateLocs = new FateLocations(monitor.getContext());
Map<String,List<String>> responsibilities = new HashMap<>();
fateLocs.getLocations().forEach((addr, partitions) -> {
partitions.forEach(partition -> {
responsibilities.computeIfAbsent(addr.toString(), a -> new ArrayList<>())
.add(partition.toString());
});
});

var primary = ManagerClient.getPrimaryManagerLocation(monitor.getContext());
if (primary != null) {
responsibilities.computeIfAbsent(primary, a -> new ArrayList<>())
.addAll(List.of("TABLET_MANAGEMENT", "BALANCING", "CLIENT_RPC", "TSERVER_MONITORING",
"CLUSTER_MAINTENANCE", "COMPACTION_COORDINATION"));
}

return responsibilities;
}

@GET
@Path("gc")
@Produces(MediaType.APPLICATION_JSON)
Expand Down