use of com.alipay.common.tracer.core.appender.file.LoadTestAwareAppender in project sofa-rpc by sofastack.
the class AbstractRpcStatJsonReporter method print.
@Override
public void print(StatKey statKey, long[] values) {
if (this.isClosePrint.get()) {
// 关闭统计日志输出
return;
}
StatMapKey statMapKey = (StatMapKey) statKey;
buffer.reset();
buffer.appendBegin("time", Timestamp.currentTime());
buffer.append("stat.key", this.statKeySplit(statMapKey));
buffer.append("count", values[0]);
buffer.append("total.cost.milliseconds", values[1]);
buffer.append("success", statMapKey.getResult());
buffer.appendEnd();
try {
if (appender instanceof LoadTestAwareAppender) {
((LoadTestAwareAppender) appender).append(buffer.toString(), statKey.isLoadTest());
} else {
appender.append(buffer.toString());
}
// 这里强制刷一次
appender.flush();
} catch (Throwable t) {
SelfLog.error("统计日志<" + statTracerName + ">输出异常", t);
}
}
Aggregations