Skip to content
Unverified Commit a256790e authored by Dominique's avatar Dominique Committed by GitHub
Browse files

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: default avatartarikgul <[email protected]>
parent 466aaea8
Pipeline #287642 passed with stages
in 38 minutes and 3 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment