Search in sources :

Example 1 with ProblemType

use of org.apache.accumulo.server.problems.ProblemType in project accumulo by apache.

the class ProblemsResource method getSummary.

/**
 * Generates a list with the problem summary
 *
 * @return problem summary list
 */
@GET
@Path("summary")
public ProblemSummary getSummary() {
    ProblemSummary problems = new ProblemSummary();
    if (monitor.getProblemException() == null) {
        for (Entry<TableId, Map<ProblemType, Integer>> entry : monitor.getProblemSummary().entrySet()) {
            Integer readCount = null, writeCount = null, loadCount = null;
            for (ProblemType pt : ProblemType.values()) {
                Integer pcount = entry.getValue().get(pt);
                if (pt.equals(ProblemType.FILE_READ)) {
                    readCount = pcount;
                } else if (pt.equals(ProblemType.FILE_WRITE)) {
                    writeCount = pcount;
                } else if (pt.equals(ProblemType.TABLET_LOAD)) {
                    loadCount = pcount;
                }
            }
            String tableName = monitor.getContext().getPrintableTableInfoFromId(entry.getKey());
            problems.addProblemSummary(new ProblemSummaryInformation(tableName, entry.getKey(), readCount, writeCount, loadCount));
        }
    }
    return problems;
}
Also used : TableId(org.apache.accumulo.core.data.TableId) ProblemType(org.apache.accumulo.server.problems.ProblemType) Map(java.util.Map) Path(jakarta.ws.rs.Path) GET(jakarta.ws.rs.GET)

Aggregations

GET (jakarta.ws.rs.GET)1 Path (jakarta.ws.rs.Path)1 Map (java.util.Map)1 TableId (org.apache.accumulo.core.data.TableId)1 ProblemType (org.apache.accumulo.server.problems.ProblemType)1