@matsumana/winston-transport-prometheus
v2.0.0
Published
A winston metrics transport using Prometheus
Downloads
379
Readme
winston transport for Prometheus
Exported metrics
| name | metrics type | label | | -------------------- | ------------ | ----- | | winston_events_total | counter | level |
e.g.
# HELP winston_events_total Number of logging events that made it to the logs
# TYPE winston_events_total counter
winston_events_total{level="info"} 3
Usage
winston-transport-prometheus can be used in the same way as the winston's standard transports.
*Please refer to the examples directory for more details
e.g.
import winston from 'winston';
import { PrometheusTransport } from '@matsumana/winston-transport-prometheus';
const logger = winston.createLogger({
level: 'info',
format: winston.format.simple(),
transports: [new winston.transports.Console(), new PrometheusTransport()],
});
PrometheusTransport's options as follows.
const myRegister = new Registry();
const prometheusTransport = new PrometheusTransport({ register: myRegister });
const logger = winston.createLogger({
level: 'info',
format: winston.format.simple(),
transports: [new winston.transports.Console(), prometheusTransport],
});
How to run the commands for test and build
fix source files using prettier and eslint
$ yarn fix
run lint using prettier and eslint
$ yarn lint
run tests
$ yarn test
build
$ yarn build