Authored by 陈峰

增加来源

... ... @@ -19,6 +19,7 @@ module.exports = (req, res, next) => {
logger.error('query l is undefined');
return res.send();
}
const app = req.query.s || 'unknown';
try {
const report = queryParse.parse(req.query.l);
... ... @@ -28,10 +29,9 @@ module.exports = (req, res, next) => {
return res.send();
}
report.forEach(item => {
const referer = url.parse(req.get('referer') || item.pt || '');
let data = {
tags: {
app: referer.hostname,
app,
reqID: item.rid,
uid: item.u,
udid: item.ud,
... ... @@ -74,15 +74,19 @@ module.exports = (req, res, next) => {
});
} else {
if (durationType[item.tp]) {
influxSender.addMessage(_.merge(data, {
measurement: 'web-duration',
tags: {
type: durationType[item.tp]
},
fields: {
duration: _.parseInt(item.t)
}
}));
const duration = _.parseInt(item.t);
if (duration < 1000 * 60 * 10) {
influxSender.addMessage(_.merge(data, {
measurement: 'web-duration',
tags: {
type: durationType[item.tp]
},
fields: {
duration: duration
}
}));
}
}
}
});
... ...