重构路由监控

This commit is contained in:
tanghc
2020-11-01 07:57:49 +08:00
parent 287dba9c89
commit ca6021a67c
2 changed files with 10 additions and 6 deletions

View File

@@ -223,16 +223,17 @@ CREATE TABLE `monitor_info` (
`total_request_count` bigint(20) NOT NULL DEFAULT '0' COMMENT '总调用次数', `total_request_count` bigint(20) NOT NULL DEFAULT '0' COMMENT '总调用次数',
`success_count` bigint(20) NOT NULL DEFAULT '0' COMMENT '成功次数', `success_count` bigint(20) NOT NULL DEFAULT '0' COMMENT '成功次数',
`error_count` bigint(20) NOT NULL DEFAULT '0' COMMENT '失败次数(业务主动抛出的异常算作成功,如参数校验,未知的错误算失败)', `error_count` bigint(20) NOT NULL DEFAULT '0' COMMENT '失败次数(业务主动抛出的异常算作成功,如参数校验,未知的错误算失败)',
`gmt_create` DATETIME DEFAULT NULL, `gmt_create` datetime DEFAULT DEFAULT NULL,
`gmt_modified` DATETIME DEFAULT NULL, `gmt_modified` datetime DEFAULT DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `uk_routeid` (`route_id`) USING BTREE, UNIQUE KEY `uk_routeid` (`route_id`,`instance_id`) USING BTREE,
KEY `idex_name` (`name`) USING BTREE KEY `idex_name` (`name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='接口监控信息'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='接口监控信息';
CREATE TABLE `monitor_info_error` ( CREATE TABLE `monitor_info_error` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`error_id` varchar(64) NOT NULL DEFAULT '' COMMENT '错误id,md5Hex(instanceId + routeId + errorMsg)', `error_id` varchar(64) NOT NULL DEFAULT '' COMMENT '错误id,md5Hex(instanceId + routeId + errorMsg)',
`instance_id` varchar(128) NOT NULL DEFAULT '' COMMENT '实例id',
`route_id` varchar(128) NOT NULL DEFAULT '', `route_id` varchar(128) NOT NULL DEFAULT '',
`error_msg` text NOT NULL, `error_msg` text NOT NULL,
`error_status` int(11) NOT NULL DEFAULT '0' COMMENT 'http status非200错误', `error_status` int(11) NOT NULL DEFAULT '0' COMMENT 'http status非200错误',
@@ -241,7 +242,7 @@ CREATE TABLE `monitor_info_error` (
`gmt_create` DATETIME DEFAULT NULL, `gmt_create` DATETIME DEFAULT NULL,
`gmt_modified` DATETIME DEFAULT NULL, `gmt_modified` DATETIME DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `uk_erririd` (`error_id`) USING BTREE, UNIQUE KEY `uk_errorid` (`error_id`) USING BTREE,
KEY `idx_routeid` (`route_id`) USING BTREE KEY `idx_routeid` (`route_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@@ -228,13 +228,16 @@ CREATE TABLE `monitor_info` (
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP, `gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `uk_routeid` (`route_id`) USING BTREE, UNIQUE KEY `uk_routeid` (`route_id`,`instance_id`) USING BTREE,
KEY `idex_name` (`name`) USING BTREE KEY `idex_name` (`name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='接口监控信息'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='接口监控信息';
CREATE TABLE `monitor_info_error` ( CREATE TABLE `monitor_info_error` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`error_id` varchar(64) NOT NULL DEFAULT '' COMMENT '错误id,md5Hex(instanceId + routeId + errorMsg)', `error_id` varchar(64) NOT NULL DEFAULT '' COMMENT '错误id,md5Hex(instanceId + routeId + errorMsg)',
`instance_id` varchar(128) NOT NULL DEFAULT '' COMMENT '实例id',
`route_id` varchar(128) NOT NULL DEFAULT '', `route_id` varchar(128) NOT NULL DEFAULT '',
`error_msg` text NOT NULL, `error_msg` text NOT NULL,
`error_status` int(11) NOT NULL DEFAULT '0' COMMENT 'http status非200错误', `error_status` int(11) NOT NULL DEFAULT '0' COMMENT 'http status非200错误',
@@ -243,7 +246,7 @@ CREATE TABLE `monitor_info_error` (
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP, `gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `uk_erririd` (`error_id`) USING BTREE, UNIQUE KEY `uk_errorid` (`error_id`) USING BTREE,
KEY `idx_routeid` (`route_id`) USING BTREE KEY `idx_routeid` (`route_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;