Merge branch 'refs/heads/feature/REQ-2090' into 1.3.1-SNAPSHOT
This commit is contained in:
commit
9539ae6083
@ -2,12 +2,12 @@ DROP TABLE IF EXISTS `EXT_AX_API_LOG`;
|
||||
CREATE TABLE IF NOT EXISTS EXT_AX_API_LOG
|
||||
(
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`trace_id` varchar(100) NOT NULL DEFAULT '' COMMENT '唯一标识',
|
||||
`trace_id` varchar(100) NOT NULL DEFAULT '' COMMENT '唯一标识',
|
||||
`api_url` varchar(2000) NOT NULL DEFAULT '' COMMENT '请求 API',
|
||||
`request_body` text NOT NULL COMMENT '请求参数',
|
||||
`response_body` text NOT NULL COMMENT '响应参数',
|
||||
`take_time` decimal(5, 2) NOT NULL COMMENT '执行耗时',
|
||||
`type` varchar(10) NOT NULL DEFAULT '' COMMENT '函数类型',
|
||||
`take_time` decimal(5, 2) NOT NULL COMMENT '执行耗时',
|
||||
`type` varchar(10) NOT NULL DEFAULT '' COMMENT '函数类型',
|
||||
`create_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`is_delete` bigint NOT NULL DEFAULT '0' COMMENT '是否删除',
|
||||
|
||||
@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.azxo.framework.common.constatns.Constants.CTX_LOG_ID_MDC;
|
||||
|
||||
@ -50,23 +51,24 @@ public class ErrorReportAspect {
|
||||
*/
|
||||
@Around("@within(org.springframework.web.bind.annotation.RestController) || @within(org.springframework.stereotype.Service)")
|
||||
public Object doControllerAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
getTargetAnnotation(joinPoint);
|
||||
|
||||
Signature signature = joinPoint.getSignature();
|
||||
|
||||
StopWatch watch = new StopWatch("running controller time");
|
||||
watch.start(signature.toShortString());
|
||||
Object result = joinPoint.proceed();
|
||||
watch.stop();
|
||||
log.info("StopWatch '" + watch.getLastTaskName() + "': running time = " + watch.getTotalTimeSeconds() + " s");
|
||||
|
||||
ApiLogEvent event = new ApiLogEvent(MDC.get(CTX_LOG_ID_MDC),
|
||||
signature.toShortString(),
|
||||
joinPoint.getArgs(),
|
||||
result,
|
||||
watch.getTotalTimeSeconds(),
|
||||
getType(joinPoint));
|
||||
if (!Objects.equals(signature.toShortString(), "ExtAxApiLogServiceImpl.insert(..)")) {
|
||||
ApiLogEvent event = new ApiLogEvent(MDC.get(CTX_LOG_ID_MDC),
|
||||
signature.toShortString(),
|
||||
joinPoint.getArgs(),
|
||||
result,
|
||||
watch.getTotalTimeSeconds(),
|
||||
getType(joinPoint));
|
||||
|
||||
applicationEventPublisher.publishEvent(event);
|
||||
applicationEventPublisher.publishEvent(event);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user