use of org.apache.servicecomb.foundation.metrics.publish.spectator.MeasurementNode in project incubator-servicecomb-java-chassis by apache.
the class PublishUtils method createPerfInfo.
public static PerfInfo createPerfInfo(MeasurementNode stageNode) {
PerfInfo perfInfo = new PerfInfo();
perfInfo.setTps((int) 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 incubator-servicecomb-java-chassis by apache.
the class PublishUtils method createOperationPerf.
public static OperationPerf createOperationPerf(String operation, MeasurementNode statusNode) {
OperationPerf operationPerf = new OperationPerf();
operationPerf.setOperation(operation);
for (MeasurementNode stageNode : statusNode.getChildren().values()) {
PerfInfo perfInfo = createPerfInfo(stageNode);
operationPerf.getStages().put(stageNode.getName(), perfInfo);
}
return operationPerf;
}
use of org.apache.servicecomb.foundation.metrics.publish.spectator.MeasurementNode in project incubator-servicecomb-java-chassis by apache.
the class Utils method createStageNode.
public static MeasurementNode createStageNode(String stage, double count, double totalTime, double max) {
Id id = registry.createId("id").withTag(Statistic.count);
Measurement countMeasurement = new Measurement(id.withTag(Statistic.count), 0, count);
Measurement totalTimeMeasurement = new Measurement(id.withTag(Statistic.totalTime), 0, totalTime);
Measurement maxMeasurement = new Measurement(id.withTag(Statistic.max), 0, max);
MeasurementNode stageNode = new MeasurementNode(stage, null);
stageNode.addChild(Statistic.count.name(), countMeasurement);
stageNode.addChild(Statistic.totalTime.name(), totalTimeMeasurement);
stageNode.addChild(Statistic.max.name(), maxMeasurement);
return stageNode;
}
use of org.apache.servicecomb.foundation.metrics.publish.spectator.MeasurementNode in project java-chassis by ServiceComb.
the class DefaultLogPublisher method printCpuLog.
private void printCpuLog(StringBuilder sb, MeasurementNode osNode) {
MeasurementNode cpuNode = osNode.findChild(OsMeter.OS_TYPE_ALL_CPU);
MeasurementNode processNode = osNode.findChild(OsMeter.OS_TYPE_PROCESS_CPU);
if (cpuNode == null || cpuNode.getMeasurements().isEmpty() || processNode == null || processNode.getMeasurements().isEmpty()) {
return;
}
double allRate = cpuNode.summary();
double processRate = processNode.summary();
appendLine(sb, " cpu:");
appendLine(sb, " all usage: %.2f%% all idle: %.2f%% process: %.2f%%", allRate * 100, (1 - allRate) * 100, processRate * 100);
}
use of org.apache.servicecomb.foundation.metrics.publish.spectator.MeasurementNode in project java-chassis by ServiceComb.
the class DefaultLogPublisher method printOsLog.
protected void printOsLog(MeasurementTree tree, StringBuilder sb) {
MeasurementNode osNode = tree.findChild(OsMeter.OS_NAME);
if (osNode == null || osNode.getMeasurements().isEmpty()) {
return;
}
appendLine(sb, "os:");
printCpuLog(sb, osNode);
printNetLog(sb, osNode);
}
Aggregations