With the current implementation Typescript will not compile in the following example as metricsMiddleware is not refined as a property in the main function output.
With the current typescript definition there's no access to certain objects that are already defined in the index.js file.
Why is this needed
I'm trying to expose the metrics in a different port (and express app) for conventions in the company and as best practice. This PR allows define the metric for an express and expose the metrics in another one.
I.E:
const metricsRequestMiddleware = prometheus({...config, ...{
includePath: true,
includeMethod: true,
autoregister: false,
promClient: {
collectDefaultMetrics: {},
},
}});
http.use(metricsRequestMiddleware);
monitor.use(metricsRequestMiddleware.metricsMiddleware);
const server: Server = await http.listen(port, () => {
this.logger.info(`🚀 Server is running in http://localhost:${port}`);
});
const monitor: Server = await monitor.listen(9800, () => {
this.logger.info(`🚀 Monitor is running in http://localhost:9800/metrics`);
});
Problem
With the current implementation Typescript will not compile in the following example as
metricsMiddleware
is not refined as a property in themain
function output.With the current typescript definition there's no access to certain objects that are already defined in the index.js file.
Why is this needed
I'm trying to expose the metrics in a different port (and express app) for conventions in the company and as best practice. This PR allows define the metric for an express and expose the metrics in another one. I.E:
Thanks