use of org.apache.servicecomb.foundation.metrics.publish.spectator.MeasurementNode in project java-chassis by ServiceComb.
the class PublishModelFactory method generateOperationPerfGroups.
protected OperationPerfGroups generateOperationPerfGroups(MeasurementTree tree, String invocationTypeName) {
MeasurementNode node = tree.findChild(MeterInvocationConst.INVOCATION_NAME, invocationTypeName);
if (node == null) {
return null;
}
OperationPerfGroups groups = new OperationPerfGroups();
// group by transport
for (MeasurementNode transportNode : node.getChildren().values()) {
// group by operation
for (MeasurementNode operationNode : transportNode.getChildren().values()) {
// group by status
for (MeasurementNode statusNode : operationNode.getChildren().values()) {
PublishUtils.addOperationPerfGroups(groups, transportNode.getName(), operationNode.getName(), statusNode);
}
}
}
return groups;
}
use of org.apache.servicecomb.foundation.metrics.publish.spectator.MeasurementNode in project java-chassis by ServiceComb.
the class PublishUtils method createPerfInfo.
public static PerfInfo createPerfInfo(MeasurementNode stageNode) {
PerfInfo perfInfo = new PerfInfo();
perfInfo.setTps(stageNode.findChild(Statistic.count.name()).summary());
perfInfo.setMsTotalTime(stageNode.findChild(Statistic.totalTime.name()).summary() * 1000);
// when UT with DefaultRegistry, there is no max value
MeasurementNode maxNode = stageNode.findChild(Statistic.max.name());
if (maxNode != null) {
perfInfo.setMsMaxLatency(maxNode.summary() * 1000);
}
return perfInfo;
}
use of org.apache.servicecomb.foundation.metrics.publish.spectator.MeasurementNode in project java-chassis by ServiceComb.
the class DefaultLogPublisher method printNetLog.
private void printNetLog(StringBuilder sb, MeasurementNode osNode) {
MeasurementNode netNode = osNode.findChild(OsMeter.OS_TYPE_NET);
if (netNode == null || netNode.getMeasurements().isEmpty()) {
return;
}
appendLine(sb, " net:");
appendLine(sb, " send(Bps) recv(Bps) send(pps) recv(pps) interface");
StringBuilder tmpSb = new StringBuilder();
for (MeasurementNode interfaceNode : netNode.getChildren().values()) {
double sendRate = interfaceNode.findChild(NetMeter.TAG_SEND.value()).summary();
double sendPacketsRate = interfaceNode.findChild(NetMeter.TAG_PACKETS_SEND.value()).summary();
double receiveRate = interfaceNode.findChild(NetMeter.TAG_RECEIVE.value()).summary();
double receivePacketsRate = interfaceNode.findChild(NetMeter.TAG_PACKETS_RECEIVE.value()).summary();
if (sendRate == 0 && receiveRate == 0 && receivePacketsRate == 0 && sendPacketsRate == 0) {
continue;
}
appendLine(tmpSb, " %-12s %-12s %-12s %-12s %s", NetUtils.humanReadableBytes((long) sendRate), NetUtils.humanReadableBytes((long) receiveRate), NetUtils.humanReadableBytes((long) sendPacketsRate), NetUtils.humanReadableBytes((long) receivePacketsRate), interfaceNode.getName());
}
if (tmpSb.length() != 0) {
sb.append(tmpSb.toString());
}
}
Aggregations