Error Reporting
Brand Level Error Report : Google Sheet Report, contains error counts for the last 45 days and will be updated every day, also different for brand-files and ocs.
Error Logs To Slack Channel : Slack Channel for Error Logs, top 50 (if exist) unique error messages will be sent in this channel every day, different for brand-files and ocs.
Prerequiste: Error Handling (Please refer to this doc to understand what status codes represents)
Brand Level Error Report
- Motivation: To improve observability of trends for count of errors in OCS & Brand Files separately.
- Updates everyday the error count for both OCS (status > 5000) & Brand Files (status < 5000).
- Note that errors with status = 5000 will not appear in this report.
- Differentiates between both kind of errors based upon status codes, read what status codes represent here.
- There are two worksheets for OCS & Brand Files, both the worksheets will have two columns for each brand, one for raw error count, and another for unique error count.
- The raw error count is as the name suggest the total number of times error was thrown.
- The unique/distinct error count is the unique error messages that were thrown.
- In case the raw and distinct errors of a brand does not appear together, you can just pick the column and move them together.
- There is a format which the header names must follow as they are the unique identifiers for each columns. Explained in the Note below:
Note:
Headers must follow this exact format, any other format column will not recieve error counts:
const BRAND_NAME = process.env.BRAND_NAME;
const ENV = process.env.CS_ENV;
BRAND_NAME + '-' + ENV + '-' + 'raw' // For raw error count
BRAND_NAME + '-' + ENV + '-' + 'distinct' // For unique number of errors
// example:
'vodafone-dev-raw'
'vodafone-dev-distinct'
Error Logs To Slack Channel
- Motivation: To have the top error logs relevant to your team easily accessible through slack.
- Error Messages for OCS and Brand Files are sent in different messages.
- Sends top 50 (if exist) unique error messages to slack with it's count, status code. Errors are sorted in descending order based upon their frequency of occurrence.
- If you have passed anything like metadata, or want to see other information regarding error, search for it on ELK with the exact error name.
Important
- If you are getting status = 5000, that means error was thrown in the wrong format.
- This should be fixed immediately! as we have no way of differentiating whether it was from brand-files or ocs, so it would appear in both the error messages.
// Examples of wrong format
// Anything else than name 'Logger' or 'Brand' is passed for logging.
let err = { name: 'ANYTHING ELSE THAN LOGGER OR BRAND', message: 'Some Log' };โ
handleAppError({ err, metadata, scope: 'agentKpi' });โ
let err = { name: 'Logger', message: 'Some Log' };โ
handleAppError({ err, metadata, scope: 'FunctionName' });โ
let err = { name: 'Brand', message: 'Some Log' };โ
handleAppError({ err, metadata, scope: 'FunctionName' });โ
// Anything other than Error Object is thrown
throw "Wrong Format"; โ
throw new Error("Correct Format"); โ
How to enable this reporting on your brand?
- Make sure elastic logger is enabled for OCS of that brand first.
- Both these reports can be enabled by adding key errorLogsReporting=true in scheduler.
- Make sure that appToken="xoxb-3389493979-1443540987988-3ne0CGYQpwR3kESXMqVopZZS" is already present on OCS, so that OCS can send messages to slack.
- Add header names for both raw and distinct, both in OCS & Brand Files Sheet by yourself.
Note
Header Names will automatically appear in new column, but it is recommended to add the header names yourself because their isn't guarantee in what order they appear.