Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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!',
// 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);
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;
});
Object.keys(userBrowserAndDevice).forEach((metricKey) => {
logger.metric(metricKey, userBrowserAndDevice[metricKey], true);
});
}
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;
});
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);
});
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);
});
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);
});
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);
});
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);
});
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);
});