How to use the epsagon.lambdaWrapper function in epsagon

To help you get started, we’ve selected a few epsagon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github epsagon / epsagon-node / test / acceptance / lambda-handlers / handler.js View on Github external
// vim: ts=4 sw=4 expandtab
/* eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }] */
const epsagon = require('epsagon');

epsagon.init({
    token: 'my-secret-token',
    appName: 'my-app-name',
    metadataOnly: false,
});
const matrixFunctions = {};

matrixFunctions.sanity = epsagon.lambdaWrapper((event, context, callback) => {
    const response = {
        statusCode: 200,
        body: JSON.stringify({
            message: 'It Worked!',
            input: event,
        }),
    };

    callback(null, response);
});

matrixFunctions.labels = epsagon.lambdaWrapper((event, context, callback) => {
    const response = {
        statusCode: 200,
        body: JSON.stringify({
            message: 'It Worked!',
github comicrelief / lambda-wrapper / src / Wrapper / LambdaWrapper.js View on Github external
return handler.call(instance, di, request, callback);
  };

  // If the Epsagon token is enabled, then wrap the instance in the Epsagon wrapper
  if (
    typeof process.env.EPSAGON_TOKEN === 'string'
    && process.env.EPSAGON_TOKEN !== 'undefined'
    && typeof process.env.EPSAGON_SERVICE_NAME === 'string'
    && process.env.EPSAGON_SERVICE_NAME !== 'undefined'
  ) {
    Epsagon.init({
      token: process.env.EPSAGON_TOKEN,
      appName: process.env.EPSAGON_SERVICE_NAME,
    });

    instance = Epsagon.lambdaWrapper(instance);
  }

  return instance;
});
github epsagon / epsagon-node / test / acceptance / lambda-handlers / handler.js View on Github external
});
const matrixFunctions = {};

matrixFunctions.sanity = epsagon.lambdaWrapper((event, context, callback) => {
    const response = {
        statusCode: 200,
        body: JSON.stringify({
            message: 'It Worked!',
            input: event,
        }),
    };

    callback(null, response);
});

matrixFunctions.labels = epsagon.lambdaWrapper((event, context, callback) => {
    const response = {
        statusCode: 200,
        body: JSON.stringify({
            message: 'It Worked!',
            input: event,
        }),
    };
    epsagon.label('label-key', 'label-value');
    epsagon.label(null, null);
    epsagon.label('label-key', 12);
    epsagon.label(12, 12);
    epsagon.label(12, null);
    epsagon.label('12', null);

    callback(null, response);
});
github epsagon / epsagon-node / test / acceptance / lambda-handlers / handler.js View on Github external
Object.keys(matrixFunctions).forEach((funcName, _index) => {
    module.exports[funcName] = matrixFunctions[funcName];
    module.exports[`${funcName}_e`] = epsagon.lambdaWrapper(matrixFunctions[funcName]);
});

epsagon

Epsagon Instrumentation for Node.js

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis