use of org.apache.accumulo.core.tabletserver.thrift.ActionStats in project accumulo by apache.
the class TabletStatsKeeper method updateTime.
public void updateTime(Operation operation, long start, long count, boolean failed) {
try {
ActionStats data = map[operation.ordinal()];
if (failed) {
data.fail++;
data.status--;
} else {
double t = (System.currentTimeMillis() - start) / 1000.0;
data.status--;
data.num++;
data.elapsed += t;
data.sumDev += t * t;
if (data.elapsed < 0 || data.sumDev < 0 || data.queueSumDev < 0 || data.queueTime < 0)
resetTimes();
}
} catch (Exception E) {
resetTimes();
}
}
use of org.apache.accumulo.core.tabletserver.thrift.ActionStats in project accumulo by apache.
the class TabletStatsKeeper method resetTimes.
private void resetTimes() {
major = new ActionStats();
split = new ActionStats();
minor = new ActionStats();
}
use of org.apache.accumulo.core.tabletserver.thrift.ActionStats in project accumulo by apache.
the class TabletServerResource method getTserverDetails.
/**
* Generates details for the selected tserver
*
* @param tserverAddress
* TServer name
* @return TServer details
*/
@Path("{address}")
@GET
public TabletServerSummary getTserverDetails(@PathParam("address") @NotNull @Pattern(regexp = SERVER_REGEX) String tserverAddress) throws Exception {
boolean tserverExists = false;
for (TabletServerStatus ts : Monitor.getMmi().getTServerInfo()) {
if (tserverAddress.equals(ts.getName())) {
tserverExists = true;
break;
}
}
if (!tserverExists) {
return null;
}
double totalElapsedForAll = 0;
double splitStdDev = 0;
double minorStdDev = 0;
double minorQueueStdDev = 0;
double majorStdDev = 0;
double majorQueueStdDev = 0;
double currentMinorAvg = 0;
double currentMajorAvg = 0;
double currentMinorStdDev = 0;
double currentMajorStdDev = 0;
total = new TabletStats(null, new ActionStats(), new ActionStats(), new ActionStats(), 0, 0, 0, 0);
HostAndPort address = HostAndPort.fromString(tserverAddress);
historical = new TabletStats(null, new ActionStats(), new ActionStats(), new ActionStats(), 0, 0, 0, 0);
List<TabletStats> tsStats = new ArrayList<>();
try {
ClientContext context = Monitor.getContext();
TabletClientService.Client client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, context);
try {
for (String tableId : Monitor.getMmi().tableMap.keySet()) {
tsStats.addAll(client.getTabletStats(Tracer.traceInfo(), context.rpcCreds(), tableId));
}
historical = client.getHistoricalStats(Tracer.traceInfo(), context.rpcCreds());
} finally {
ThriftUtil.returnClient(client);
}
} catch (Exception e) {
return null;
}
List<CurrentOperations> currentOps = doCurrentOperations(tsStats);
if (total.minors.num != 0)
currentMinorAvg = (long) (total.minors.elapsed / total.minors.num);
if (total.minors.elapsed != 0 && total.minors.num != 0)
currentMinorStdDev = stddev(total.minors.elapsed, total.minors.num, total.minors.sumDev);
if (total.majors.num != 0)
currentMajorAvg = total.majors.elapsed / total.majors.num;
if (total.majors.elapsed != 0 && total.majors.num != 0 && total.majors.elapsed > total.majors.num)
currentMajorStdDev = stddev(total.majors.elapsed, total.majors.num, total.majors.sumDev);
ActionStatsUpdator.update(total.minors, historical.minors);
ActionStatsUpdator.update(total.majors, historical.majors);
totalElapsedForAll += total.majors.elapsed + historical.splits.elapsed + total.minors.elapsed;
minorStdDev = stddev(total.minors.elapsed, total.minors.num, total.minors.sumDev);
minorQueueStdDev = stddev(total.minors.queueTime, total.minors.num, total.minors.queueSumDev);
majorStdDev = stddev(total.majors.elapsed, total.majors.num, total.majors.sumDev);
majorQueueStdDev = stddev(total.majors.queueTime, total.majors.num, total.majors.queueSumDev);
splitStdDev = stddev(historical.splits.num, historical.splits.elapsed, historical.splits.sumDev);
TabletServerDetailInformation details = doDetails(address, tsStats.size());
List<AllTimeTabletResults> allTime = doAllTimeResults(majorQueueStdDev, minorQueueStdDev, totalElapsedForAll, splitStdDev, majorStdDev, minorStdDev);
CurrentTabletResults currentRes = doCurrentTabletResults(currentMinorAvg, currentMinorStdDev, currentMajorAvg, currentMajorStdDev);
TabletServerSummary tserverDetails = new TabletServerSummary(details, allTime, currentRes, currentOps);
return tserverDetails;
}
Aggregations