Authored by htoooth

fix

... ... @@ -17,18 +17,19 @@ function parseMessage(line) {
let [tags, fields, time] = [qs.parse(tokens[0], ',', '='), qs.parse(tokens[1], ',', '='), tokens[2]];
// 服务器路由
if (tags.path) {
let [, p] = tags.path.split(']');
p = routeDecode(p) || 'null';
tags.path = p;
tags.route = tags.path;
}
if (fields.uid && fields.uid === '"undefined"') {
fields.uid = '0';
}
// 具体请求路径
if (!tags.route) {
tags.route = 'null';
}
... ...
... ... @@ -71,7 +71,7 @@ function handleClientError(scope, item) {
const ipInfo = ipService.getIsp(scope.ip);
const row = Object.assign(msg2row.errorRouter(data), ipInfo, {ip: scope.ip});
logger.debug('[client] error info [%s]', JSON.stringify(row));
logger.info('[client] error info [%s]', JSON.stringify(row));
errorRouterSqlSender.addMessage(row);
}
... ... @@ -124,7 +124,7 @@ function handleClientFirst(scope, item) {
}
});
logger.debug('[client] slow route info [%s]', JSON.stringify(data));
logger.info('[client] slow route info [%s]', JSON.stringify(data));
if (duration > config.slowRoute.min && duration < config.slowRoute.max) {
slowRouterSqlSender.addMessage(msg2row.slowRouter(data));
... ... @@ -166,7 +166,7 @@ async function handleClientTiming(scope, item) {
_.merge(data, ipInfo);
logger.debug('[client] perf info [%s]', JSON.stringify(data));
logger.info('[client] perf info [%s]', JSON.stringify(data));
perfReportSqlSender.addMessage(data);
}
... ...
... ... @@ -32,7 +32,8 @@ function errorRouter(m) {
reqid: _.get(m, 'fields.reqID', '').replace(/"/g, ''),
uid: _.parseInt(uid),
udid: _.get(m, 'fields.udid', '').replace(/"/g, ''),
route: _.get(m, 'tags.route', ''),
route: _.get(m, 'tags.path', ''),
url: _.get(m.get('tags.route'), ''),
code: _.parseInt(_.get(m, 'tags.code', '0')),
line: _.parseInt(line),
column: _.parseInt(column),
... ...
... ... @@ -33,7 +33,7 @@ function handleWebServerDuration(m) {
return;
}
logger.debug('[api] info [%s]', JSON.stringify(m));
logger.debug('[api] route info [%s]', JSON.stringify(m));
apiInfluxSender.addMessage({
tags: {
... ... @@ -92,16 +92,16 @@ function handleErrorReport(m) {
const type = _.get(m, 'tags.type', '');
if (type === 'api') {
logger.debug('[api] error info [%s]', JSON.stringify(m));
logger.info('[api] error info [%s]', JSON.stringify(m));
} else {
logger.debug('[server] error info [%s]', JSON.stringify(m));
logger.info('[server] error info [%s]', JSON.stringify(m));
}
errorSqlSender.addMessage(msg2row.errorRouter(m));
}
function handleProcessInfo(m) {
logger.debug('[process] info [%s]', JSON.stringify(m));
logger.info('[process] info [%s]', JSON.stringify(m));
m.measurement = 'process-info';
... ...
... ... @@ -19,3 +19,5 @@ ALTER TABLE error_report ADD country varchar(100);
ALTER TABLE error_report ADD region varchar(100);
ALTER TABLE error_report ADD city varchar(100);
ALTER TABLE error_report ADD isp varchar(100);
ALTER TABLE error_report ADD url varchar(200);
... ...