upgrade prom-client to v6, add options: includeMethod, includePath, keepDefaultMetrics, bump 1.2.0

This commit is contained in:
Konstantin Pogorelov
2016-11-26 21:00:58 +01:00
parent 3675c516a9
commit 08d98b450c
9 changed files with 153 additions and 43 deletions

View File

@@ -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"
));