{"library":"menoetius","title":"Prometheus Node.js Middleware","description":"Menoetius is a Node.js middleware designed to automatically instrument web applications and expose Prometheus-compatible metrics. It enables developers to easily gather response duration metrics (summary and histogram types) and fundamental Node.js system metrics, all accessible via a configurable `/metrics` endpoint. The library supports integration with popular HTTP frameworks like `http`, `express`, `hapi`, and `restify`. However, the package is currently at a very early version (0.0.3), was likely published many years ago, and appears to be abandoned, with no discernible updates or active development. It relies on `prom-client` for metric collection, which has evolved significantly since Menoetius's last release. Due to its unmaintained status, it may lack compatibility with modern Node.js versions and up-to-date Prometheus client best practices, making it unsuitable for new projects.","language":"javascript","status":"abandoned","last_verified":"Thu Apr 23","install":{"commands":["npm install menoetius"],"cli":null},"imports":["const menoetius = require('menoetius');","menoetius.instrument(app);"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const express = require('express');\nconst http = require('http');\nconst menoetius = require('menoetius');\n\nconst app = express();\n\n// Instrument the Express application\nmenoetius.instrument(app, { url: '/metrics-data' });\n\napp.get('/', (req, res) => {\n  // Simulate some work\n  const delay = Math.random() * 200; // 0-200ms\n  setTimeout(() => {\n    res.status(200).send('Hello from Menoetius-instrumented Express!');\n  }, delay);\n});\n\napp.get('/slow', (req, res) => {\n  // Simulate a slower response\n  const delay = Math.random() * 1500 + 500; // 500-2000ms\n  setTimeout(() => {\n    res.status(200).send('This was a bit slower, check metrics!');\n  }, delay);\n});\n\napp.get('/error', (req, res) => {\n  // Simulate an error response\n  res.status(500).send('An internal server error occurred!');\n});\n\nconst PORT = 3000;\napp.listen(PORT, () => {\n  console.log(`Express server listening on port ${PORT}`);\n  console.log(`Metrics available at http://localhost:${PORT}/metrics-data`);\n  console.log('Try hitting /, /slow, and /error endpoints.');\n});","lang":"javascript","description":"Demonstrates how to integrate Menoetius with an Express.js application to automatically expose request duration and system metrics on a custom `/metrics-data` endpoint.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}