polka-prometheus-middleware

polka middleware to prometheus

Usage no npm install needed!

<script type="module">
  import polkaPrometheusMiddleware from 'https://cdn.skypack.dev/polka-prometheus-middleware';
</script>

README

polka-prometheus-middleware

polka middleware to prometheus


const promMid = require('polka-prometheus-middleware')

const app  = promMid({
    metricsPath: '/metrics',
    collectDefaultMetrics: true,
    requestDurationBuckets: [0.1, 0.5, 1, 1.5]
})

app
    .get('/users/:id', (req, res) => {
        console.log(`~> Hello, ${req.hello}`);
        res.end(`User: ${req.params.id}`);
    })
    .listen(3000, err => {
        if (err) throw err;
        console.log(`> Running on localhost:3000`);
    });