feat: add alert for jambonz parsing falure (#148)

* feat: add alert for jambonz parsing falure

* fix: review comment

* fix: update time-series version
This commit is contained in:
xquanluu
2022-08-16 17:39:07 +07:00
committed by GitHub
parent 7199db5edb
commit 5b6f7dd3ee
5 changed files with 139 additions and 9 deletions

View File

@@ -19,6 +19,10 @@ module.exports = function(srf, logger) {
lookupAppByRealm,
lookupAppByTeamsTenant
} = srf.locals.dbHelpers;
const {
writeAlerts,
AlertType
} = srf.locals;
const {lookupAccountDetails} = dbUtils(logger, srf);
function initLocals(req, res, next) {
@@ -311,6 +315,12 @@ module.exports = function(srf, logger) {
} catch (err) {
span?.setAttributes({webhookStatus: err.statusCode});
span?.end();
writeAlerts({
account_sid: req.locals.account_sid,
target_sid: req.locals.callSid,
alert_type: AlertType.INVALID_APP_PAYLOAD,
message: `${err?.message}`.trim()
}).catch((err) => this.logger.info({err}, 'Error generating alert for parsing application'));
logger.info({err}, `Error retrieving or parsing application: ${err?.message}`);
res.send(480, {headers: {'X-Reason': err?.message || 'unknown'}});
app.requestor.close();