Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@

import org.apache.accumulo.core.compaction.thrift.TExternalCompaction;
import org.apache.accumulo.core.data.TabletId;
import org.apache.accumulo.core.metrics.flatbuffers.FMetric;
import org.apache.accumulo.core.process.thrift.MetricResponse;
import org.apache.accumulo.core.tabletserver.thrift.TExternalCompactionJob;
import org.apache.accumulo.monitor.next.serializers.CumulativeDistributionSummarySerializer;
import org.apache.accumulo.monitor.next.serializers.FMetricSerializer;
import org.apache.accumulo.monitor.next.serializers.IdSerializer;
import org.apache.accumulo.monitor.next.serializers.MetricResponseSerializer;
import org.apache.accumulo.monitor.next.serializers.TabletIdSerializer;
import org.apache.accumulo.monitor.next.serializers.ThriftSerializer;

Expand All @@ -39,7 +34,6 @@
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;

import io.micrometer.core.instrument.Meter.Id;
import io.micrometer.core.instrument.cumulative.CumulativeDistributionSummary;

@Provider
public class CustomObjectMapper implements ContextResolver<ObjectMapper> {
Expand All @@ -51,12 +45,8 @@ public CustomObjectMapper() {
mapper = new ObjectMapper();
SimpleModule module = new SimpleModule();
module.addKeySerializer(Id.class, new IdSerializer());
module.addSerializer(FMetric.class, new FMetricSerializer());
module.addSerializer(MetricResponse.class, new MetricResponseSerializer());
module.addSerializer(TExternalCompaction.class, new ThriftSerializer());
module.addSerializer(TExternalCompactionJob.class, new ThriftSerializer());
module.addSerializer(CumulativeDistributionSummary.class,
new CumulativeDistributionSummarySerializer());
module.addSerializer(TabletId.class, new TabletIdSerializer());
mapper.registerModule(module);
mapper.registerModule(new Jdk8Module());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
Expand All @@ -51,8 +50,6 @@
import org.apache.accumulo.core.client.admin.TabletInformation;
import org.apache.accumulo.core.client.admin.servers.ServerId;
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.util.compaction.RunningCompactionInfo;
import org.apache.accumulo.monitor.Monitor;
import org.apache.accumulo.monitor.next.InformationFetcher.InstanceSummary;
Expand All @@ -68,20 +65,12 @@
import org.apache.accumulo.monitor.next.SystemInformation.TableSummary;
import org.apache.accumulo.monitor.next.SystemInformation.TimeOrderedRunningCompactionSet;
import org.apache.accumulo.monitor.next.deployment.DeploymentOverview;
import org.apache.accumulo.monitor.next.ec.CompactorsSummary;
import org.apache.accumulo.monitor.next.views.Status;
import org.apache.accumulo.monitor.next.views.TableData;
import org.apache.accumulo.monitor.next.views.TableDataFactory;

import io.micrometer.core.instrument.Meter.Id;
import io.micrometer.core.instrument.cumulative.CumulativeDistributionSummary;

@Path("/")
public class Endpoints {
/**
* A {@code String} constant representing the supplied resource group in path parameter.
*/
private static final String GROUP_PARAM_KEY = "group";

/**
* A {@code String} constant representing the supplied tableId in path parameter.
Expand All @@ -101,14 +90,6 @@ public record MonitorStatus(String managerGoalState, Map<ServerId.Type,Status> c
long timestamp) {
}

private void validateResourceGroup(String resourceGroup) {
if (monitor.getInformationFetcher().getSummaryForEndpoint().getResourceGroups()
.contains(resourceGroup)) {
return;
}
throw new NotFoundException("Resource Group " + resourceGroup + " not found");
}

@GET
@Path("endpoints")
@Produces(MediaType.APPLICATION_JSON)
Expand Down Expand Up @@ -149,35 +130,6 @@ public Set<String> getResourceGroups() {
return monitor.getInformationFetcher().getSummaryForEndpoint().getResourceGroups();
}

@GET
@Path("problems")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns a list of the servers that are potentially down")
public Collection<ServerId> getProblemHosts() {
return monitor.getInformationFetcher().getSummaryForEndpoint().getProblemHosts();
}

@GET
@Path("metrics")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns the metric responses for all servers")
public Collection<MetricResponse> getAll() {
return monitor.getInformationFetcher().getAllMetrics().asMap().values();
}

@GET
@Path("gc")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns the metric response for the Garbage Collector")
public MetricResponse getGarbageCollector() {
final ServerId s =
monitor.getInformationFetcher().getSummaryForEndpoint().getGarbageCollector();
if (s == null) {
throw new NotFoundException("Garbage Collector not found");
}
return monitor.getInformationFetcher().getAllMetrics().asMap().get(s);
}

@GET
@Path("status")
@Produces(MediaType.APPLICATION_JSON)
Expand Down Expand Up @@ -209,44 +161,6 @@ public InstanceOverview getInstanceOverview() {
return monitor.getInformationFetcher().getSummaryForEndpoint().getInstanceOverview();
}

@GET
@Path("compactors/detail/{" + GROUP_PARAM_KEY + "}")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns the metric responses for the Compactors in the supplied resource group")
public Collection<MetricResponse>
getCompactors(@PathParam(GROUP_PARAM_KEY) String resourceGroup) {
validateResourceGroup(resourceGroup);
final Set<ServerId> servers = monitor.getInformationFetcher().getSummaryForEndpoint()
.getCompactorResourceGroupServers(resourceGroup);
if (servers == null) {
return List.of();
}
return monitor.getInformationFetcher().getAllMetrics().getAllPresent(servers).values();
}

@GET
@Path("compactors/summary/{" + GROUP_PARAM_KEY + "}")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns an aggregate view of the metric responses for the Compactors in the supplied resource group")
public Map<Id,CumulativeDistributionSummary>
getCompactorResourceGroupMetricSummary(@PathParam(GROUP_PARAM_KEY) String resourceGroup) {
validateResourceGroup(resourceGroup);
final Map<Id,CumulativeDistributionSummary> metrics = monitor.getInformationFetcher()
.getSummaryForEndpoint().getCompactorResourceGroupMetricSummary(resourceGroup);
if (metrics == null) {
return Map.of();
}
return metrics;
}

@GET
@Path("compactors/summary")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns an aggregate view of the metric responses for all Compactors")
public Map<Id,CumulativeDistributionSummary> getCompactorAllMetricSummary() {
return monitor.getInformationFetcher().getSummaryForEndpoint().getCompactorAllMetricSummary();
}

@GET
@Path("scans")
@Produces(MediaType.APPLICATION_JSON)
Expand All @@ -255,44 +169,6 @@ public Set<Scan> getScans() {
return monitor.getInformationFetcher().getSummaryForEndpoint().getActiveScans();
}

@GET
@Path("sservers/detail/{" + GROUP_PARAM_KEY + "}")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns raw metric responses for the ScanServers in the supplied resource group")
public Collection<MetricResponse>
getScanServers(@PathParam(GROUP_PARAM_KEY) String resourceGroup) {
validateResourceGroup(resourceGroup);
final Set<ServerId> servers = monitor.getInformationFetcher().getSummaryForEndpoint()
.getSServerResourceGroupServers(resourceGroup);
if (servers == null) {
return List.of();
}
return monitor.getInformationFetcher().getAllMetrics().getAllPresent(servers).values();
}

@GET
@Path("sservers/summary/{" + GROUP_PARAM_KEY + "}")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns an aggregate raw metric summary for the ScanServers in the supplied resource group (diagnostic endpoint)")
public Map<Id,CumulativeDistributionSummary>
getScanServerResourceGroupMetricSummary(@PathParam(GROUP_PARAM_KEY) String resourceGroup) {
validateResourceGroup(resourceGroup);
final Map<Id,CumulativeDistributionSummary> metrics = monitor.getInformationFetcher()
.getSummaryForEndpoint().getSServerResourceGroupMetricSummary(resourceGroup);
if (metrics == null) {
return Map.of();
}
return metrics;
}

@GET
@Path("sservers/summary")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns an aggregate raw metric summary for all ScanServers (diagnostic endpoint)")
public Map<Id,CumulativeDistributionSummary> getScanServerAllMetricSummary() {
return monitor.getInformationFetcher().getSummaryForEndpoint().getSServerAllMetricSummary();
}

@GET
@Path("servers/view")
@Produces(MediaType.APPLICATION_JSON)
Expand All @@ -309,52 +185,6 @@ public TableData getServerProcessView(@MatrixParam("table") TableDataFactory.Tab
return view;
}

@GET
@Path("tservers/detail/{" + GROUP_PARAM_KEY + "}")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns the metric responses for the TabletServers in the supplied resource group")
public Collection<MetricResponse>
getTabletServers(@PathParam(GROUP_PARAM_KEY) String resourceGroup) {
validateResourceGroup(resourceGroup);
final Set<ServerId> servers = monitor.getInformationFetcher().getSummaryForEndpoint()
.getTServerResourceGroupServers(resourceGroup);
if (servers == null) {
return List.of();
}
return monitor.getInformationFetcher().getAllMetrics().getAllPresent(servers).values();
}

@GET
@Path("tservers/summary/{" + GROUP_PARAM_KEY + "}")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns an aggregate view of the metric responses for the TabletServers in the supplied resource group")
public Map<Id,CumulativeDistributionSummary>
getTabletServerResourceGroupMetricSummary(@PathParam(GROUP_PARAM_KEY) String resourceGroup) {
validateResourceGroup(resourceGroup);
final Map<Id,CumulativeDistributionSummary> metrics = monitor.getInformationFetcher()
.getSummaryForEndpoint().getTServerResourceGroupMetricSummary(resourceGroup);
if (metrics == null) {
return Map.of();
}
return metrics;
}

@GET
@Path("tservers/summary")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns an aggregate view of the metric responses for all TabletServers")
public Map<Id,CumulativeDistributionSummary> getTabletServerAllMetricSummary() {
return monitor.getInformationFetcher().getSummaryForEndpoint().getTServerAllMetricSummary();
}

@GET
@Path("compactions/summary")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns the metrics for all compaction queues")
public Map<String,List<FMetric>> getCompactionMetricSummary() {
return monitor.getInformationFetcher().getSummaryForEndpoint().getCompactionMetricSummary();
}

@GET
@Path("compactions/running")
@Produces(MediaType.APPLICATION_JSON)
Expand Down Expand Up @@ -383,31 +213,6 @@ public List<CompactionTableSummary> getRunningCompactionsPerTable() {
return monitor.getInformationFetcher().getSummaryForEndpoint().getRunningCompactionsPerTable();
}

@GET
@Path("compactions/running/{" + GROUP_PARAM_KEY + "}")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns all long running major compactions for the resource group")
public List<RunningCompactionInfo>
getCompactions(@PathParam(GROUP_PARAM_KEY) String resourceGroup) {
validateResourceGroup(resourceGroup);
TimeOrderedRunningCompactionSet longRunning = monitor.getInformationFetcher()
.getSummaryForEndpoint().getTopRunningCompactions().get(resourceGroup);
if (longRunning == null) {
return List.of();
}
return longRunning.stream().collect(Collectors.toList());
}

@GET
@Path("ec/compactors")
@Produces(MediaType.APPLICATION_JSON)
@Description("Returns External Compactor process details")
public CompactorsSummary getExternalCompactors() {
var summary = monitor.getInformationFetcher().getSummaryForEndpoint();
return new CompactorsSummary(summary.getCompactorServers(),
summary.getCollectionTiming().finishTime());
}

@GET
@Path("fate")
@Produces(MediaType.APPLICATION_JSON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -828,11 +828,7 @@ public void run() {
if (type == Type.MONITOR) {
continue;
}
Set<ServerId> servers = this.ctx.instanceOperations().getServers(type);
if (type == Type.COMPACTOR) {
summary.processExternalCompactionInventory(servers);
}
for (ServerId server : servers) {
for (ServerId server : this.ctx.instanceOperations().getServers(type)) {
MetricFetcher mf = new MetricFetcher(this.ctx, server, summary);
Future<?> mff = this.pool.submit(mf);
futures.add(new UpdateTaskFuture(mff, mf));
Expand Down Expand Up @@ -959,15 +955,9 @@ public void run() {
LOG.info(
"All: {}, Managers: {}, Garbage Collector: {}, Compactors: {}, Scan Servers: {}, Tablet Servers: {}",
allMetrics.estimatedSize(), summary.getManagers().size(),
summary.getGarbageCollector() != null,
summary.getCompactorAllMetricSummary().isEmpty() ? 0
: summary.getCompactorAllMetricSummary().entrySet().iterator().next().getValue()
.count(),
summary.getSServerAllMetricSummary().isEmpty() ? 0
: summary.getSServerAllMetricSummary().entrySet().iterator().next().getValue()
.count(),
summary.getTServerAllMetricSummary().isEmpty() ? 0 : summary.getTServerAllMetricSummary()
.entrySet().iterator().next().getValue().count());
summary.getGarbageCollector() != null, summary.getActiveServers(Type.COMPACTOR).size(),
summary.getActiveServers(Type.SCAN_SERVER).size(),
summary.getActiveServers(Type.TABLET_SERVER).size());

SystemInformation oldSummary = summaryRef.getAndSet(summary);
if (oldSummary != null) {
Expand Down
Loading