use of org.apache.servicecomb.core.invocation.InvocationStageTrace in project java-chassis by ServiceComb.
the class DurationSecondItemTest method initStrBuilder.
@Before
public void initStrBuilder() {
finishEvent = Mockito.mock(InvocationFinishEvent.class);
invocation = Mockito.mock(Invocation.class);
invocationStageTrace = Mockito.mock(InvocationStageTrace.class);
when(finishEvent.getInvocation()).thenReturn(invocation);
when(invocation.getInvocationStageTrace()).thenReturn(invocationStageTrace);
when(invocationStageTrace.getStartSend()).thenReturn(1000_000L);
accessLogEvent = new ServerAccessLogEvent();
accessLogEvent.setMilliStartTime(1L);
strBuilder = new StringBuilder();
}
use of org.apache.servicecomb.core.invocation.InvocationStageTrace in project java-chassis by ServiceComb.
the class TestInvocationFinishEvent method construct.
@Test
public void construct(@Mocked Invocation invocation, @Mocked Response response) {
InvocationStageTrace stageTrace = new InvocationStageTrace(invocation);
long time = 123;
new MockUp<System>() {
@Mock
long nanoTime() {
return time;
}
};
new Expectations() {
{
invocation.getInvocationStageTrace();
result = stageTrace;
}
};
stageTrace.finish();
event = new InvocationFinishEvent(invocation, response);
Assert.assertEquals(time, event.getNanoCurrent());
Assert.assertSame(invocation, event.getInvocation());
Assert.assertSame(response, event.getResponse());
}
use of org.apache.servicecomb.core.invocation.InvocationStageTrace in project java-chassis by ServiceComb.
the class ProducerInvocationMeter method onInvocationFinish.
@Override
public void onInvocationFinish(InvocationFinishEvent event) {
super.onInvocationFinish(event);
InvocationStageTrace invocationStageTrace = event.getInvocation().getInvocationStageTrace();
executorQueueTimer.record((long) invocationStageTrace.calcThreadPoolQueueTime());
executionTimer.record((long) invocationStageTrace.calcBusinessTime());
serverFiltersRequestTimer.record((long) invocationStageTrace.calcServerFiltersRequestTime());
serverFiltersResponseTimer.record((long) invocationStageTrace.calcServerFiltersResponseTime());
sendResponseTimer.record((long) invocationStageTrace.calcSendResponseTime());
}
use of org.apache.servicecomb.core.invocation.InvocationStageTrace in project java-chassis by ServiceComb.
the class AbstractInvocationMeter method onInvocationFinish.
public void onInvocationFinish(InvocationFinishEvent event) {
lastUpdated = registry.clock().wallTime();
InvocationStageTrace stageTrace = event.getInvocation().getInvocationStageTrace();
latencyDistributionMeter.record((long) stageTrace.calcTotalTime());
totalTimer.record((long) stageTrace.calcTotalTime());
handlersRequestTimer.record((long) stageTrace.calcHandlersRequestTime());
handlersResponseTimer.record((long) stageTrace.calcHandlersResponseTime());
prepareTimer.record((long) stageTrace.calcInvocationPrepareTime());
}
use of org.apache.servicecomb.core.invocation.InvocationStageTrace in project java-chassis by ServiceComb.
the class ConsumerInvocationMeter method onInvocationFinish.
@Override
public void onInvocationFinish(InvocationFinishEvent event) {
super.onInvocationFinish(event);
InvocationStageTrace invocationStageTrace = event.getInvocation().getInvocationStageTrace();
clientFiltersRequestTimer.record((long) invocationStageTrace.calcClientFiltersRequestTime());
consumerSendRequestTimer.record((long) invocationStageTrace.calcSendRequestTime());
consumerGetConnectionTimer.record((long) invocationStageTrace.calcGetConnectionTime());
consumerWriteToBufTimer.record((long) invocationStageTrace.calcWriteToBufferTime());
consumerWaitResponseTimer.record((long) invocationStageTrace.calcReceiveResponseTime());
consumerWakeConsumerTimer.record((long) invocationStageTrace.calcWakeConsumer());
clientFiltersResponseTimer.record((long) invocationStageTrace.calcClientFiltersResponseTime());
}
Aggregations