Authored by htoooth

fix

... ... @@ -102,8 +102,10 @@ module.exports = (req, res, next) => {
});
res.send();
logger.info('[client] handle OK [%s]', req.query.l);
} catch (e) {
logger.error('[client] not handle client info [%s]', e);
logger.error('[client] handle ERROR [%s]', e);
return next(e);
}
};
... ...
... ... @@ -10,32 +10,38 @@ const {
const server = {
async handle(data) {
let msgs = lineparse.parse(data);
try {
msgs.forEach((m) => {
if (!m.measurement) {
return;
}
let msgs = lineparse.parse(data);
switch (m.measurement) {
case 'web-server-duration': {
handleWebServerDuration(m);
break;
msgs.forEach((m) => {
if (!m.measurement) {
return;
}
case 'error-report': {
handleErrorReport(m);
break;
}
case 'process-info': {
handleProcessInfo(m);
break;
}
default: {
logger.error('not handle server info [%s]', JSON.stringify(m));
break;
switch (m.measurement) {
case 'web-server-duration': {
handleWebServerDuration(m);
break;
}
case 'error-report': {
handleErrorReport(m);
break;
}
case 'process-info': {
handleProcessInfo(m);
break;
}
default: {
logger.error('not handle server info [%s]', JSON.stringify(m));
break;
}
}
}
});
});
logger.info('[server] handle OK [%s]', data);
} catch (e) {
logger.error('[server] handle ERROR [%s]', e);
}
}
};
... ... @@ -45,4 +51,4 @@ module.exports = function(req, res, next) {
server.handle(data).then(() => {
res.status(204).json();
}).catch(next);
};
};
\ No newline at end of file
... ...