koa-prometheus-middleware
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

📟 koa-prometheus-middleware

This is a middleware for koa servers, that expose metrics for prometheus.

💻 Installation

Version 16.6.0 or newer of Node.js is required

npm install koa-prometheus-middleware

yarn add koa-prometheus-middleware

Example

// add global middleware
app.use(
  PrometheusMiddleware({
    ignorePaths: ["/metrics"],
  })
);

// add router
router.get("/metrics", async (ctx) => {
  ctx.set("Content-Type", Prometheus.register.contentType);
  return ctx.res.end(await Prometheus.register.metrics());
});

📜 Credits

💖 Thank you

You can support koa-prometheus-middleware by giving it a GitHub star.

Package Sidebar

Install

npm i koa-prometheus-middleware

Weekly Downloads

3

Version

1.0.4

License

Apache-2.0

Unpacked Size

35 kB

Total Files

21

Last publish

Collaborators

  • samarmeena