Skip to content

Commit

Permalink
Move addDynamicField in express-dynamic-fields example out of per…
Browse files Browse the repository at this point in the history
…-request middleware (#18)
  • Loading branch information
christineyen authored and toshok committed Aug 14, 2017
1 parent f90a4a6 commit c6fd5dc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions examples/express-dynamic-fields/express-honey.js
Expand Up @@ -4,14 +4,14 @@ var process = require('process');
module.exports = function(options) {
var honey = new libhoney(options);

return function(req, res, next) {
// Attach dynamic fields to the global event builder in libhoney.
// Dynamic fields calculate their values at the time the event is created
// (the event.sendNow call below)
honey.addDynamicField('rss_after', () => process.memoryUsage().rss);
honey.addDynamicField('heapTotal_after', () => process.memoryUsage().heapTotal);
honey.addDynamicField('heapUsed_after', () => process.memoryUsage().heapUsed);
// Attach dynamic fields to the global event builder in libhoney.
// Dynamic fields calculate their values at the time the event is created
// (the event.sendNow call below)
honey.addDynamicField('rss_after', () => process.memoryUsage().rss);
honey.addDynamicField('heapTotal_after', () => process.memoryUsage().heapTotal);
honey.addDynamicField('heapUsed_after', () => process.memoryUsage().heapUsed);

return function(req, res, next) {
var event = honey.newEvent();
event.add({
app: req.app,
Expand Down

0 comments on commit c6fd5dc

Please sign in to comment.