O'Reilly logo

TypeScript Microservices by Parth Ghiya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Keymetrics to monitor application exceptions and runtime problems 

Although PM2 does a pretty good job of keeping the server up and running, we need to monitor all unknown exceptions that occur or potential sources of memory leaks. PMX provides just the module for that. You can follow the example in chapter 9/pmx-utilitiesInitialize pmx as usual. Just whenever there is an error, notify pmx with the notify method:

pmx.notify(new Error("Unexpected Exception"));

This is enough to send out an error to keymetrics to give it information about application exceptions. You will receive email notifications, too.

PMX monitors constant usage of the service, too, in order to detect memory leaks, if any. Check the route /memory-leak, for example.

The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required