Open arnaudruffin opened 5 years ago
I have the same problem. I think this line is wrong:
// /types/index.d.ts
declare function express_prom_bundle(opts: express_prom_bundle.Opts): RequestHandler;
It should be something like:
declare function express_prom_bundle(opts: express_prom_bundle.Opts):
{
metrics: ...
metricsMiddleware: RequestHandler,
promClient: ...
}
Maybe @raszi can put a bit of light on this? I would be happy to help with a PR
That is not the correct way to use the library AFAIK:
import * as promBundle from 'express-prom-bundle'
const metricsMiddleware = promBundle({...});
expressApp.route("/metrics").get(function (req, res) {
return metricsMiddleware(req, res);
});
Or more simply as the documentation says:
import * as promBundle from 'express-prom-bundle'
const metricsMiddleware = promBundle({...});
expressApp.use(metricsMiddleware);
Hi
I am attaching metrics programatically in TypeScript. This used to work fine with a previous version (5.0.2) but with recent updates I now have a TypeScript error:
error TS2339: Property 'metricsMiddleware' does not exist on type 'RequestHandler'.
Here is how I used to do it in 5.0.2:
Here is how I try to do it now (with the error TS2339):
This is only a typing issue and does not prevent my server from running correctly.