newrelic / nr1-status-pages

NR1 Status Pages allows you to collect and display the statuses of key dependencies in one place.
https://github.com/newrelic/nr1-status-pages/discussions
Apache License 2.0
37 stars 22 forks source link

NRQL severity attribute should be handled gracefully #89

Closed aminoz007 closed 4 years ago

aminoz007 commented 4 years ago

If EventStatus returned by the NRQL query is not equal to "None", "Critical" or "Warning" the app will crash.

Description

If EventStatus is equal to "SUCCESS" or "FAILED", the app will crash. This should be handled gracefully. Two options are possible here (option 2 is preferable): 1- Any EventStatus should be transformed into "None" if EventStatus coming from the query not in:

const NRQLSeverityToKnown = {
  None: 'none',
  Critical: 'critical',
  Warning: 'minor'
};

(snippet above from nrql.js).

2- Do not hardcode the severity object but ask the user what Critical is equal to ("FAILED" for example), what None=Ok is equal to ("SUCCESS" for example) and what Warning is equal to (all should be optional, if nothing is entered then use "None" always). In addition, we have to implement option one above to prevent any crash if the user specify something that is not equal to the EventStatus coming from the query.

Steps to Reproduce

Create a NRQL status page using this query: FROM SyntheticCheck SELECT monitorName as EventName, result as EventStatus, timestamp as EventTimeStamp limit 5 The query will return this table:

Screen Shot 2020-07-22 at 11 53 32 PM

the application will crash because of this error "cannot read property 'tolowercase' of undefined"

nr-opensource-bot commented 4 years ago

:tada: This issue has been resolved in version 1.0.2 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: