use of com.alibaba.dubbo.common.status.Status.Level in project dubbo by alibaba.
the class Status method execute.
public void execute(Map<String, Object> context) throws Exception {
//FIXME cache监控存在性能问题 汇总页面去掉
Map<String, com.alibaba.dubbo.common.status.Status> statuses = StatusManager.getInstance().getStatusList(new String[] { "cache" });
com.alibaba.dubbo.common.status.Status status = StatusManager.getInstance().getStatusSummary(statuses);
Level level = status.getLevel();
if (!com.alibaba.dubbo.common.status.Status.Level.OK.equals(level)) {
context.put("message", level + new SimpleDateFormat(" [yyyy-MM-dd HH:mm:ss] ").format(new Date()) + filterOK(status.getMessage()));
} else {
context.put("message", level.toString());
}
PrintWriter writer = response.getWriter();
writer.print(context.get("message").toString());
writer.flush();
}
use of com.alibaba.dubbo.common.status.Status.Level in project dubbo by alibaba.
the class StatusUtils method getSummaryStatus.
public static Status getSummaryStatus(Map<String, Status> statuses) {
Level level = Level.OK;
StringBuilder msg = new StringBuilder();
for (Map.Entry<String, Status> entry : statuses.entrySet()) {
String key = entry.getKey();
Status status = entry.getValue();
Level l = status.getLevel();
if (Level.ERROR.equals(l)) {
level = Level.ERROR;
if (msg.length() > 0) {
msg.append(",");
}
msg.append(key);
} else if (Level.WARN.equals(l)) {
if (!Level.ERROR.equals(level)) {
level = Level.WARN;
}
if (msg.length() > 0) {
msg.append(",");
}
msg.append(key);
}
}
return new Status(level, msg.toString());
}
use of com.alibaba.dubbo.common.status.Status.Level in project dubbo by alibaba.
the class StatusManager method getSummaryStatus.
public static Status getSummaryStatus(Map<String, Status> statuses) {
Level level = Level.OK;
StringBuilder msg = new StringBuilder();
for (Map.Entry<String, Status> entry : statuses.entrySet()) {
String key = entry.getKey();
Status status = entry.getValue();
Level l = status.getLevel();
if (Level.ERROR.equals(l)) {
level = Level.ERROR;
if (msg.length() > 0) {
msg.append(",");
}
msg.append(key);
} else if (Level.WARN.equals(l)) {
if (!Level.ERROR.equals(level)) {
level = Level.WARN;
}
if (msg.length() > 0) {
msg.append(",");
}
msg.append(key);
}
}
return new Status(level, msg.toString());
}
Aggregations