Search in sources :

Example 1 with OperationConfig

use of org.apache.servicecomb.core.definition.OperationConfig in project java-chassis by ServiceComb.

the class SlowInvocationLogger method onInvocationFinish.

@Subscribe
@AllowConcurrentEvents
public void onInvocationFinish(InvocationFinishEvent event) {
    Invocation invocation = event.getInvocation();
    OperationConfig operationConfig = invocation.getOperationMeta().getConfig();
    if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationStageTrace().calcTotalTime() < operationConfig.getNanoSlowInvocation()) {
        return;
    }
    if (!invocation.isConsumer()) {
        logSlowProducer(invocation, event.getResponse(), operationConfig);
        return;
    }
    if (invocation.isEdge()) {
        logSlowEdge(invocation, event.getResponse(), operationConfig);
        return;
    }
    logSlowConsumer(invocation, event.getResponse(), operationConfig);
}
Also used : Invocation(org.apache.servicecomb.core.Invocation) OperationConfig(org.apache.servicecomb.core.definition.OperationConfig) AllowConcurrentEvents(com.google.common.eventbus.AllowConcurrentEvents) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

AllowConcurrentEvents (com.google.common.eventbus.AllowConcurrentEvents)1 Subscribe (com.google.common.eventbus.Subscribe)1 Invocation (org.apache.servicecomb.core.Invocation)1 OperationConfig (org.apache.servicecomb.core.definition.OperationConfig)1