feat: add prometheus `metrics` endpoint in dedicated server & port (#1232)
* feat: add prometheus `metrics` endpoint in dedicated server & port
- add separate express instance and port for prometheus metrics
- expose the default prometheus metrics
- add a custom metric of type `counter` that increments in every http error
* fix lint errors by using an IIFE & adding void operator
- remove the `return` keyword
- add an IIFE inside the callback
- add the `void` operator
* update dep prom-client
* add prometheus flags & fix for process.kill
- add a prometheus flag that runs the prometheus server & enables the metrics endpoint
- add a prometheus-port flag so that the user can choose a custom port to run the metrics endpoint
- change the code in killAll so that there is no `Object is possibly undefined` error
* code refactor, help page & README
- add prometheus options and description under help flag
- add `metricsApp` and increased `httpErrorCounter` only if prometheus flag is true
- move logger and register inside functions
- docs: add a section for prometheus in the README
* remove jest unnecessary flags
---------
Co-authored-by: tarikgul <[email protected]>
Please register or sign in to comment