Search in sources :

Example 11 with OperationPerfGroup

use of org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerfGroup in project incubator-servicecomb-java-chassis by apache.

the class DefaultLogPublisher method printConsumerLog.

protected void printConsumerLog(DefaultPublishModel model, StringBuilder sb) {
    OperationPerfGroups consumerPerf = model.getConsumer().getOperationPerfGroups();
    if (consumerPerf == null) {
        return;
    }
    sb.append("" + "consumer:\n" + " simple:\n" + "  status      tps      latency            ").append(latencyDistributionHeader).append("operation\n");
    StringBuilder detailsBuilder = new StringBuilder();
    // print sample
    for (Map<String, OperationPerfGroup> statusMap : consumerPerf.getGroups().values()) {
        for (OperationPerfGroup perfGroup : statusMap.values()) {
            // append sample
            sb.append(printSamplePerf(perfGroup));
            // append details
            detailsBuilder.append(printConsumerDetailsPerf(perfGroup));
        }
    }
    sb.append(" details:\n").append(detailsBuilder);
}
Also used : OperationPerfGroups(org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerfGroups) OperationPerfGroup(org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerfGroup)

Example 12 with OperationPerfGroup

use of org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerfGroup in project incubator-servicecomb-java-chassis by apache.

the class DefaultLogPublisher method printProducerLog.

protected void printProducerLog(DefaultPublishModel model, StringBuilder sb) {
    OperationPerfGroups producerPerf = model.getProducer().getOperationPerfGroups();
    if (producerPerf == null) {
        return;
    }
    sb.append("" + "producer:\n" + " simple:\n" + "  status      tps      latency            ").append(latencyDistributionHeader).append("operation\n");
    // use detailsBuilder, we can traverse the map only once
    StringBuilder detailsBuilder = new StringBuilder();
    // print sample
    for (Map<String, OperationPerfGroup> statusMap : producerPerf.getGroups().values()) {
        for (OperationPerfGroup perfGroup : statusMap.values()) {
            // append sample
            sb.append(printSamplePerf(perfGroup));
            // append details
            detailsBuilder.append(printProducerDetailsPerf(perfGroup));
        }
    }
    // print details
    sb.append(" details:\n").append(detailsBuilder);
}
Also used : OperationPerfGroups(org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerfGroups) OperationPerfGroup(org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerfGroup)

Example 13 with OperationPerfGroup

use of org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerfGroup in project incubator-servicecomb-java-chassis by apache.

the class DefaultLogPublisher method printEdgeLog.

protected void printEdgeLog(DefaultPublishModel model, StringBuilder sb) {
    OperationPerfGroups edgePerf = model.getEdge().getOperationPerfGroups();
    if (edgePerf == null) {
        return;
    }
    sb.append("" + "edge:\n" + " simple:\n" + "  status      tps      latency            ").append(latencyDistributionHeader).append("operation\n");
    StringBuilder detailsBuilder = new StringBuilder();
    // print sample
    for (Map<String, OperationPerfGroup> statusMap : edgePerf.getGroups().values()) {
        for (OperationPerfGroup perfGroup : statusMap.values()) {
            // append sample
            sb.append(printSamplePerf(perfGroup));
            // append details
            detailsBuilder.append(printEdgeDetailsPerf(perfGroup));
        }
    }
    sb.append(" details:\n").append(detailsBuilder);
}
Also used : OperationPerfGroups(org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerfGroups) OperationPerfGroup(org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerfGroup)

Example 14 with OperationPerfGroup

use of org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerfGroup in project incubator-servicecomb-java-chassis by apache.

the class PublishUtils method addOperationPerfGroups.

public static void addOperationPerfGroups(OperationPerfGroups operationPerfGroups, String transport, String operation, MeasurementNode statusNode) {
    Map<String, OperationPerfGroup> statusMap = operationPerfGroups.getGroups().computeIfAbsent(transport, tn -> new HashMap<>());
    OperationPerfGroup group = statusMap.computeIfAbsent(statusNode.getName(), status -> new OperationPerfGroup(transport, status));
    OperationPerf operationPerf = createOperationPerf(operation, statusNode);
    group.addOperationPerf(operationPerf);
}
Also used : OperationPerf(org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerf) OperationPerfGroup(org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerfGroup)

Aggregations

OperationPerfGroup (org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerfGroup)14 OperationPerfGroups (org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerfGroups)11 OperationPerf (org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerf)6 PerfInfo (org.apache.servicecomb.metrics.core.publish.model.invocation.PerfInfo)5 Test (org.junit.Test)5 EventBus (com.google.common.eventbus.EventBus)3 Collections (java.util.Collections)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 Status (javax.ws.rs.core.Response.Status)3 Expectations (mockit.Expectations)3 Mock (mockit.Mock)3 MockUp (mockit.MockUp)3 Mocked (mockit.Mocked)3 LoggingEvent (org.apache.log4j.spi.LoggingEvent)3 Const (org.apache.servicecomb.core.Const)3 MetricsBootstrapConfig (org.apache.servicecomb.foundation.metrics.MetricsBootstrapConfig)3 PolledEvent (org.apache.servicecomb.foundation.metrics.PolledEvent)3 ArchaiusUtils (org.apache.servicecomb.foundation.test.scaffolding.config.ArchaiusUtils)3 LogCollector (org.apache.servicecomb.foundation.test.scaffolding.log.LogCollector)3