-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing documentation on combination of autoregister false and metricsApp #103
Comments
Also confused here, not sure if we just pass |
Looks like an app instance. My solution that worked: export function metrics(): express.Express {
const metricsAppInstance = express();
// do stuff if you like
return metricsAppInstance
}
// The Express app is exported so that it can be used by serverless Functions.
export function app(metricsAppInstance: express.Express): express.Express {
const server = express();
...
// Prometheus Setup
server.use(
'*',
promBundle({
buckets: [0.10, 5, 15, 50, 100, 200, 300, 400, 500],
includeMethod: true,
includePath: true,
customLabels: {
app: 'angular-express-ssr'
},
autoregister: false,
metricsPath: '/metrics',
metricsApp: metricsAppInstance,
promClient: {
collectDefaultMetrics: {}
},
})
);
...
return server;
}
function run(): void {
const port = config.get('server.port') || 4000;
const metricsPort = config.get('metrics.port') || 4001;
const metricsServer = metrics();
// Start up the Node server
const server = app(metricsServer);
metricsServer.listen(metricsPort, ()=>{
console.log(`Node Express Prometheus Exporter listening on http://localhost:${metricsPort}`);
})
server.listen(port, () => {
console.log(`Node Express server listening on http://localhost:${port}`);
});
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey! In #101 there were additional options added, but they're missing examples. I am unsure how I should use combination of
autoregister
andmetricsApp
. I could use the suggestions in #25 , but I'd rather use the options presented in the #101 PR.The text was updated successfully, but these errors were encountered: