Created
September 1, 2018 06:28
-
-
Save glennblock/89a4964d866df92a22a68f9d7863064d to your computer and use it in GitHub Desktop.
This file contains 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
var logger = require('@iopipe/logger'); | |
var iopipe = require('@iopipe/iopipe')( | |
{ | |
token: module.webtask.secrets.iopipe, | |
plugins: [logger({ enabled: true })] | |
} | |
); | |
var handler = iopipe( | |
(event, context, callback) => { | |
execute(event, context, callback); | |
} | |
); | |
module.exports = (ctx, cb) => { | |
var context = { | |
functionName: 'iopipe', | |
}; | |
handler({id: '1', description: 'something'}, context, cb); | |
}; | |
function execute (event, context, callback) { | |
console.log('event', event); | |
context.iopipe.label('webtask-iopipe'); | |
context.iopipe.metric('answer', 42); | |
callback(undefined, event); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment