Currently, it'd take a lot of energy to switch to structurized logging and to build metrics out of that.
However, a simple drop-in way to have metrics based on log level, can be as follows:
If metricsCounter with logLevel label is provided to new Logger({ ..., metricsCounter }), it'll increment the counter on all logger.info(), logger.error(), etc. calls.
All that is needed is for application to use logger from @eng-automation/js and provide Prometheus metrics.
Currently, it'd take a lot of energy to switch to structurized logging and to build metrics out of that.
However, a simple drop-in way to have metrics based on log level, can be as follows:
If
metricsCounter
withlogLevel
label is provided tonew Logger({ ..., metricsCounter })
, it'll increment the counter on alllogger.info()
,logger.error()
, etc. calls.All that is needed is for application to use logger from
@eng-automation/js
and provide Prometheus metrics.