-
Notifications
You must be signed in to change notification settings - Fork 10
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
Support performance logging #32
Comments
@jrassa @abemac @tzfx @ymao1 @twhittington @mlhummon @reblace - I'd love to hear your thoughts (and others!) on how we can best achieve this with the node-rest-starter. Some options I'm seeing are: Implementation:
Storage:
Retrieval:
My initial thoughts are in favor of configurable Express.js hooks with options to:
[1] https://www.lunchbadger.com/blog/tracking-the-performance-of-express-js-routes-and-middleware/ |
I played around with using Elastic APM when it first came out and it seemed promising. I think they've added a lot of features since then and it was pretty straightforward to get it set up. |
I cast resurrection on this thread! 🧙 💀 ➡️ 😐 🆗 I did a quick test with Elastic APM and it seems like a great idea. The whole ELK stack seems to be very straightforward to containerize and deploy, and elastic publishes a node agent that integrates flawlessly with express: https://github.com/deviantony/docker-elk Instructions for this project boil down to this:
That's it. On the node side, it's as simple as this:
/* ./src/metrics.js */
'use strict';
const start = () => require('elastic-apm-node').start({
// Override service name from package.json
// Allowed characters: a-z, A-Z, 0-9, -, _, and space
serviceName: 'some-service',
// Use if APM Server requires a token
secretToken: '',
// Set custom APM Server URL (default: http://localhost:8200)
serverUrl: 'http://localhost:8200'
});
module.exports = start; /* ./src/startup.js */
'use strict';
const
q = require('q'),
logger = require('./lib/bunyan').logger,
express = require('./lib/express'),
mongoose = require('./lib/mongoose'),
startMetrics = require('./metrics');
module.exports = function () {
logger.info('Starting initialization of Node.js server');
startMetrics();
// Initialize mongoose
return mongoose.connect()
// ...snip... And it's done. The application will instantly start vomitting all sorts of fun metrics into ES. API for capturing bespoke metrics for other things can be found here https://www.elastic.co/guide/en/apm/agent/nodejs/current/agent-api.html |
The goal of this is to allow admins to better understand performance bottlenecks in their application before and after users alert them to the issue.
The text was updated successfully, but these errors were encountered: