mirror of
https://github.com/BreizhHardware/express-prom-bundle.git
synced 2026-01-18 16:27:28 +01:00
added whie-black-listing, http counter is a histogram now
This commit is contained in:
28
advanced-example.js
Normal file
28
advanced-example.js
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
const express = require("express"),
|
||||
app = express(),
|
||||
promBundle = require("express-prom-bundle"),
|
||||
promClient = require("prom-client");
|
||||
|
||||
const bundle = promBundle({
|
||||
prefix: "demo_app:something:",
|
||||
blacklist: [/up/]
|
||||
});
|
||||
|
||||
app.use(bundle);
|
||||
|
||||
let c1 = new bundle.promClient.Counter("c1", "c1 help");
|
||||
c1.inc(10);
|
||||
|
||||
let c2 = bundle.factory.newCounter("c2", "c2 help");
|
||||
c2.inc(20);
|
||||
|
||||
app.get("/foo", (req, res) => {
|
||||
setTimeout(() => {
|
||||
res.send("foo response");
|
||||
}, 500);
|
||||
});
|
||||
app.get("/bar", (req, res) => res.send("bar response"));
|
||||
|
||||
app.listen(3001);
|
||||
Reference in New Issue
Block a user