mirror of
https://github.com/BreizhHardware/express-prom-bundle.git
synced 2026-01-18 16:27:28 +01:00
upgrade prom-client to v6, add options: includeMethod, includePath, keepDefaultMetrics, bump 1.2.0
This commit is contained in:
@@ -7,7 +7,10 @@ const promBundle = require("express-prom-bundle");
|
||||
const bundle = promBundle({
|
||||
prefix: "demo_app:something:",
|
||||
blacklist: [/up/],
|
||||
buckets: [0.1, 0.4, 0.7]
|
||||
buckets: [0.1, 0.4, 0.7],
|
||||
includeMethod: true,
|
||||
includePath: true,
|
||||
keepDefaultMetrics: false
|
||||
});
|
||||
|
||||
app.use(bundle);
|
||||
@@ -20,19 +23,23 @@ c1.inc(10);
|
||||
const c2 = bundle.factory.newCounter("c2", "c2 help");
|
||||
c2.inc(20);
|
||||
|
||||
app.get("/foo", (req, res) => {
|
||||
app.get("/foo/:id", (req, res) => {
|
||||
setTimeout(() => {
|
||||
res.send("foo response\n");
|
||||
}, 500);
|
||||
});
|
||||
app.delete("/foo/:id", (req, res) => {
|
||||
setTimeout(() => {
|
||||
res.send("foo deleted\n");
|
||||
}, 300);
|
||||
});
|
||||
app.get("/bar", (req, res) => res.send("bar response\n"));
|
||||
|
||||
app.listen(3000, () => console.log("listening on 3000")); // eslint-disable-line
|
||||
|
||||
/*
|
||||
test in shell console:
|
||||
|
||||
curl localhost:3000/foo
|
||||
curl localhost:3000/bar
|
||||
curl localhost:3000/metrics
|
||||
*/
|
||||
app.listen(3000, () => console.info( // eslint-disable-line
|
||||
"listening on 3000\n"
|
||||
+ "test in shell console\n\n"
|
||||
+ "curl localhost:3000/foo/1234\n"
|
||||
+ "curl -X DELETE localhost:3000/foo/5432\n"
|
||||
+ "curl localhost:3000/bar\n"
|
||||
+ "curl localhost:3000/metrics\n"
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user