|
|
const _ = require('lodash');
|
|
|
|
|
|
function slowRouter(m) {
|
|
|
let uid = _.get(m, 'uid', '0');
|
|
|
|
|
|
return {
|
|
|
app: _.get(m.data, 'app', ''),
|
|
|
type: _.get(m.data, 'type', ''),
|
|
|
hostname: _.get(m.data, 'hostname', ''),
|
|
|
preqid: _.get(m.data, 'preqid', ''),
|
|
|
reqid: _.get(m.data, 'reqID', ''),
|
|
|
uid: _.parseInt(uid),
|
|
|
udid: _.get(m.data, 'udid', ''),
|
|
|
api: _.get(m.data, 'api', ''),
|
|
|
route: _.get(m.data, 'route', ''),
|
|
|
duration: _.get(m.data, 'duration', ''),
|
|
|
create_time: _.get(m.data, 'time', 0)
|
|
|
};
|
|
|
}
|
|
|
|
|
|
function errorRouter(m) {
|
|
|
let uid = _.get(m.data, 'uid', '0');
|
|
|
let line = _.get(m.data, 'line', '0');
|
|
|
let column = _.get(m.data, 'column', '0');
|
|
|
|
|
|
return {
|
|
|
app: _.get(m.data, 'app', ''),
|
|
|
api: _.get(m.data, 'api', ''),
|
|
|
type: _.get(m.data, 'type', ''),
|
|
|
hostname: _.get(m.data, 'hostname', ''),
|
|
|
preqid: _.get(m.data, 'preqid', ''),
|
|
|
reqid: _.get(m.data, 'reqID', ''),
|
|
|
uid: _.parseInt(uid),
|
|
|
udid: _.get(m.data, 'udid', ''),
|
|
|
route: _.get(m.data, 'path', ''),
|
|
|
url: _.get(m.data, 'url', ''),
|
|
|
ip: _.get(m.data, 'ip', ''),
|
|
|
code: _.parseInt(_.get(m.data, 'code', -1)),
|
|
|
line: _.parseInt(line),
|
|
|
column: _.parseInt(column),
|
|
|
script: _.get(m.data, 'script', ''),
|
|
|
message: _.get(m.data, 'message', ''),
|
|
|
stack: _.get(m.data, 'stack', ''),
|
|
|
useragent: _.get(m.data, 'useragent', ''),
|
|
|
create_time: _.get(m.data, 'time', 0)
|
|
|
};
|
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
|
slowRouter,
|
|
|
errorRouter
|
|
|
}; |
...
|
...
|
|