Skip to content

Support for the AppEnlight Metrics API for applications using express.js

License

Notifications You must be signed in to change notification settings

Newstex/express-appenlight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-appenlight

Support for the AppEnlight Metrics API for applications using express.js

Initializing AppEnlight Tracer:

All that's needed to enable the tracer is to initialize it and set it up as middleware for your Express.js app:

var AppEnlight = require('express-appenlight');
app.use(new AppEnlight({
	key: 'MY_APPENLIGHT_KEY',
	tags: {
		optional: 'TAGS',
	},
	base_url: 'http://custom-appenlight-url/api',
}, app));

Once that's set up, every request will have an ae_transaction option.

Tracing a custom function

Some functions are automatically traced, however to add in a custom trace you can use the ae_transaction.newTracer function available on every request object.

Usage:

function (req, res, next){
	// Add a new trace
	var trace = req.ae_transaction.newTracer('custom', 'functionName', req.query);

	// Do your application logic
	... do stuff...

	// Call when everything is completed
	trace.end();
}

Special Thanks

A special thanks to Thomas Watson (https://github.com/watson) for his great Node.js Oslo talk on Node.js performance monitoring.

This takes much of the code from: https://github.com/watson/talks/blob/master/2016/06%20NodeConf%20Oslo/example-app/stats

About

Support for the AppEnlight Metrics API for applications using express.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published