Actualiser index.js
All checks were successful
the-tip-top-backend/pipeline/head This commit looks good
All checks were successful
the-tip-top-backend/pipeline/head This commit looks good
This commit is contained in:
parent
082cc270d3
commit
992b3d6814
4
index.js
4
index.js
|
|
@ -7,16 +7,12 @@ dotenv.config();
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = process.env.PORT || 4000;
|
const port = process.env.PORT || 4000;
|
||||||
|
|
||||||
// Middleware JSON
|
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
|
|
||||||
// --- 🔹 Partie Prometheus ---
|
// --- 🔹 Partie Prometheus ---
|
||||||
const register = new client.Registry();
|
const register = new client.Registry();
|
||||||
|
|
||||||
// Collecte par défaut (CPU, mémoire, etc.)
|
|
||||||
client.collectDefaultMetrics({ register });
|
client.collectDefaultMetrics({ register });
|
||||||
|
|
||||||
// Route /metrics pour Prometheus
|
|
||||||
app.get("/metrics", async (req, res) => {
|
app.get("/metrics", async (req, res) => {
|
||||||
res.set("Content-Type", register.contentType);
|
res.set("Content-Type", register.contentType);
|
||||||
res.end(await register.metrics());
|
res.end(await register.metrics());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user