Created
June 22, 2017 22:41
-
-
Save elliotttf/ac92dbe5061ac6023aa41ee42a8bfc2a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const { createBackgroundTransaction, endTransaction } = require('newrelic'); | |
const fs = require('fs'); | |
createBackgroundTransaction('fileProcessing', () => { | |
return new Promise((resolve, reject) => fs.readFile('/tmp/input.txt', (err, file) => { | |
if (err) { | |
return reject(err); | |
} | |
resolve(file); | |
})) | |
.then(file => { | |
// process file contents | |
}) | |
.then(() => endTransaction()) | |
.catch(() => endTransaction()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment