}
public Pair<Integer, String> buildNodeState(String domain, Index index) {
String type = index.getName();
String realType = formatType(type);
DomainConfig config = queryNodeConfig(realType, domain);
int errorCode = OK;
StringBuilder sb = new StringBuilder();
if (config != null) {
double avg = index.getAvg();
long error = index.getErrorCount();
sb.append(type).append(GraphConstrant.DELIMITER);
if (index.getTotalCount() > 0 && !type.equalsIgnoreCase("Exception")) {
sb.append(buildDes(TOTAL_STR, String.valueOf(index.getTotalCount())));
}
if (avg >= config.getErrorResponseTime()) {
errorCode = ERROR;
sb.append(buildErrorDes(AVG_STR, m_df.format(avg), MILLISECOND));
} else if (avg >= config.getWarningResponseTime()) {
errorCode = WARN;
sb.append(buildWarningDes(AVG_STR, m_df.format(avg), MILLISECOND));
} else {
if (!type.equalsIgnoreCase("Exception")) {
sb.append(buildDes(AVG_STR, m_df.format(avg), MILLISECOND));
}
}
if (error >= config.getErrorThreshold()) {
errorCode = ERROR;
sb.append(buildErrorDes(ERROR_STR, String.valueOf(error)));
} else if (error >= config.getWarningThreshold()) {
errorCode = WARN;
sb.append(buildWarningDes(ERROR_STR, String.valueOf(error)));
} else if (error > 0) {
sb.append(buildDes(ERROR_STR, String.valueOf(error)));
}