use of org.apache.servicecomb.core.invocation.InvocationStageTrace in project java-chassis by ServiceComb.
the class DurationMillisecondItemTest 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(0L);
when(invocationStageTrace.getFinish()).thenReturn(1000_000L);
accessLogEvent = new ServerAccessLogEvent();
accessLogEvent.setMilliStartTime(1L);
accessLogEvent.setMilliEndTime(2L);
strBuilder = new StringBuilder();
}
use of org.apache.servicecomb.core.invocation.InvocationStageTrace in project java-chassis by ServiceComb.
the class ScheduleFilter method runInExecutor.
protected CompletableFuture<Response> runInExecutor(Invocation invocation, FilterNode next) {
invocation.onExecuteStart();
try {
InvocationStageTrace trace = invocation.getInvocationStageTrace();
trace.startServerFiltersRequest();
invocation.onStartHandlersRequest();
checkInQueueTimeout(invocation);
return next.onFilter(invocation).whenComplete((response, throwable) -> whenComplete(invocation));
} finally {
invocation.onExecuteFinish();
}
}
use of org.apache.servicecomb.core.invocation.InvocationStageTrace in project java-chassis by ServiceComb.
the class SlowInvocationLogger method logSlowProducer.
private void logSlowProducer(Invocation invocation, Response response, OperationConfig operationConfig) {
RestOperationMeta restOperationMeta = invocation.getOperationMeta().getExtData(RestConst.SWAGGER_REST_OPERATION);
InvocationStageTrace stageTrace = invocation.getInvocationStageTrace();
invocation.getTraceIdLogger().warn(LOGGER, "" + "slow({} ms) invocation, {}:\n" + " http method: {}\n" + " url : {}\n" + " client : {}\n" + " status code: {}\n" + " total : {} ms\n" + " prepare : {} ms\n" + " threadPoolQueue : {} ms\n" + " server filters request : {} ms\n" + " handlers request : {} ms\n" + " business execute : {} ms\n" + " handlers response : {} ms\n" + " server filters response: {} ms\n" + " send response : {} ms", operationConfig.getMsSlowInvocation(), invocation.getInvocationQualifiedName(), restOperationMeta.getHttpMethod(), restOperationMeta.getAbsolutePath(), collectClientAddress(invocation), response.getStatusCode(), formatTime(stageTrace.calcTotalTime()), formatTime(stageTrace.calcInvocationPrepareTime()), formatTime(stageTrace.calcThreadPoolQueueTime()), formatTime(stageTrace.calcServerFiltersRequestTime()), formatTime(stageTrace.calcHandlersRequestTime()), formatTime(stageTrace.calcBusinessTime()), formatTime(stageTrace.calcHandlersResponseTime()), formatTime(stageTrace.calcServerFiltersResponseTime()), formatTime(stageTrace.calcSendResponseTime()));
}
use of org.apache.servicecomb.core.invocation.InvocationStageTrace in project java-chassis by ServiceComb.
the class SlowInvocationLogger method logSlowEdge.
private void logSlowEdge(Invocation invocation, Response response, OperationConfig operationConfig) {
RestOperationMeta restOperationMeta = invocation.getOperationMeta().getExtData(RestConst.SWAGGER_REST_OPERATION);
InvocationStageTrace stageTrace = invocation.getInvocationStageTrace();
invocation.getTraceIdLogger().warn(LOGGER, "" + "slow({} ms) invocation, {}:\n" + " http method: {}\n" + " url : {}\n" + " server : {}\n" + " status code: {}\n" + " total : {} ms\n" + " prepare : {} ms\n" + " threadPoolQueue : {} ms\n" + " server filters request : {} ms\n" + " handlers request : {} ms\n" + " client filters request : {} ms\n" + " send request : {} ms\n" + " get connection : {} ms\n" + " write to buf : {} ms\n" + " wait response : {} ms\n" + " wake consumer : {} ms\n" + " client filters response: {} ms\n" + " handlers response : {} ms\n" + " server filters response: {} ms\n" + " send response : {} ms", operationConfig.getMsSlowInvocation(), invocation.getInvocationQualifiedName(), restOperationMeta.getHttpMethod(), restOperationMeta.getAbsolutePath(), collectTargetAddress(invocation), response.getStatusCode(), formatTime(stageTrace.calcTotalTime()), formatTime(stageTrace.calcInvocationPrepareTime()), formatTime(stageTrace.calcThreadPoolQueueTime()), formatTime(stageTrace.calcServerFiltersRequestTime()), formatTime(stageTrace.calcHandlersRequestTime()), formatTime(stageTrace.calcClientFiltersRequestTime()), formatTime(stageTrace.calcSendRequestTime()), formatTime(stageTrace.calcGetConnectionTime()), formatTime(stageTrace.calcWriteToBufferTime()), formatTime(stageTrace.calcReceiveResponseTime()), formatTime(stageTrace.calcWakeConsumer()), formatTime(stageTrace.calcClientFiltersResponseTime()), formatTime(stageTrace.calcHandlersResponseTime()), formatTime(stageTrace.calcServerFiltersResponseTime()), formatTime(stageTrace.calcSendResponseTime()));
}
use of org.apache.servicecomb.core.invocation.InvocationStageTrace in project java-chassis by ServiceComb.
the class SlowInvocationLogger method logSlowConsumer.
private void logSlowConsumer(Invocation invocation, Response response, OperationConfig operationConfig) {
RestOperationMeta restOperationMeta = invocation.getOperationMeta().getExtData(RestConst.SWAGGER_REST_OPERATION);
InvocationStageTrace stageTrace = invocation.getInvocationStageTrace();
invocation.getTraceIdLogger().warn(LOGGER, "" + "slow({} ms) invocation, {}:\n" + " http method: {}\n" + " url : {}\n" + " server : {}\n" + " status code: {}\n" + " total : {} ms\n" + " prepare : {} ms\n" + " handlers request : {} ms\n" + " client filters request : {} ms\n" + " send request : {} ms\n" + " get connection : {} ms\n" + " write to buf : {} ms\n" + " wait response : {} ms\n" + " wake consumer : {} ms\n" + " client filters response: {} ms\n" + " handlers response : {} ms", operationConfig.getMsSlowInvocation(), invocation.getInvocationQualifiedName(), restOperationMeta.getHttpMethod(), restOperationMeta.getAbsolutePath(), collectTargetAddress(invocation), response.getStatusCode(), formatTime(stageTrace.calcTotalTime()), formatTime(stageTrace.calcInvocationPrepareTime()), formatTime(stageTrace.calcHandlersRequestTime()), formatTime(stageTrace.calcClientFiltersRequestTime()), formatTime(stageTrace.calcSendRequestTime()), formatTime(stageTrace.calcGetConnectionTime()), formatTime(stageTrace.calcWriteToBufferTime()), formatTime(stageTrace.calcReceiveResponseTime()), formatTime(stageTrace.calcWakeConsumer()), formatTime(stageTrace.calcClientFiltersResponseTime()), formatTime(stageTrace.calcHandlersResponseTime()));
}
Aggregations