Skip to content

Instantly share code, notes, and snippets.

@glennblock
Created September 1, 2018 06:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glennblock/89a4964d866df92a22a68f9d7863064d to your computer and use it in GitHub Desktop.
Save glennblock/89a4964d866df92a22a68f9d7863064d to your computer and use it in GitHub Desktop.
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