Closed gandazgul closed 10 months ago
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch express-prom-bundle@6.6.0 for the project I'm working on.
express-prom-bundle@6.6.0
When specifying a prefix through options.promClient.collectDefaultMetrics.prefix, all metrics are prefixed except for up. This fixes that.
Here is the diff that solved my problem:
diff --git a/node_modules/express-prom-bundle/src/index.js b/node_modules/express-prom-bundle/src/index.js index 0c96dfb..55005d7 100644 --- a/node_modules/express-prom-bundle/src/index.js +++ b/node_modules/express-prom-bundle/src/index.js @@ -132,8 +132,9 @@ function main(opts) { }; if (opts.includeUp !== false) { + const prefix = opts.promClient?.collectDefaultMetrics?.prefix || ''; metrics.up = new promClient.Gauge({ - name: 'up', + name: `${prefix}up`, help: '1 = up, 0 = not up', registers: [opts.promRegistry] });
This issue body was partially generated by patch-package.
Happy to submit a PR if this is desired.
Any chance we get that merged? :)
Merged manually. Thanks for contributing. This was released in v7.0.0
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
express-prom-bundle@6.6.0
for the project I'm working on.When specifying a prefix through options.promClient.collectDefaultMetrics.prefix, all metrics are prefixed except for up. This fixes that.
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.