Skip to content

Instantly share code, notes, and snippets.

@kobalski
Created September 6, 2018 21:03
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 kobalski/9198b3689c717f5d32ef7fb6de8e8cc6 to your computer and use it in GitHub Desktop.
Save kobalski/9198b3689c717f5d32ef7fb6de8e8cc6 to your computer and use it in GitHub Desktop.
Simple try catch with open tracing
const thundra = require('@thundra/core');
exports.handler = thundra({
apiKey : <Your API Key>
})((event, context, callback) => {
const tracer = thundra.tracer();
const span = tracer.startSpan('say-hello');
try {
const message = sayHello('Thundra');
span.setTag('msg', message);
span.finish();
callback(null, {msg: message});
} catch (err) {
span.setTag('error', err.message);
span.setTag('stack trace', err.stack);
span.finish();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment