Skip to content

Commit de8274c

Browse files
committed
COMPASS-2563: Dont send metrics if instance failed
In the case of where an instance load failed, Compass would still try to send metrics on the deployment without checking if the information was there. This would cause the metrics send to fail with the vague 'Cannot read property length of null' error. This fixes that, and allows the error to bubble up and be displayed nicely to the user.
1 parent 4c48eb9 commit de8274c

File tree

1 file changed

+1
-1
lines changed
  • src/internal-plugins/metrics/lib

1 file changed

+1
-1
lines changed

src/internal-plugins/metrics/lib/rules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = [
2121
store: 'App.InstanceStore',
2222
resource: 'Deployment',
2323
action: 'detected',
24-
condition: () => true,
24+
condition: (state) => (state.instance.databases !== null),
2525
metadata: (state) => ({
2626
'databases count': state.instance.databases.length,
2727
'namespaces count': state.instance.collections.length,

0 commit comments

Comments
 (0)