add promClient option for smuggling collectDefaultMetrics, upgrade prom-client to ~10.2.2, version 3.3.0

This commit is contained in:
Konstantin Pogorelov
2018-01-23 16:43:38 +01:00
parent c8996a7730
commit 06f55c9ab8
6 changed files with 47 additions and 9 deletions

View File

@@ -10,13 +10,18 @@ const bundle = promBundle({
includeMethod: true,
includePath: true,
customLabels: {year: null},
transformLabels: labels => Object.assign(labels, {year: new Date().getFullYear()})
transformLabels: labels => Object.assign(labels, {year: new Date().getFullYear()}),
promClient: {
collectDefaultMetrics: {
timeout: 1000
}
}
});
app.use(bundle);
// native prom-client metric (no prefix)
const c1 = new bundle.promClient.Counter('c1', 'c1 help');
const c1 = new bundle.promClient.Counter({name: 'c1', help: 'c1 help'});
c1.inc(10);
app.get('/foo/:id', (req, res) => {