Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
entrySpan.error = entrySpan.ec > 0;
entrySpan.d = Date.now() - entrySpan.ts;
entrySpan.transmit();
}
const spans = spanBuffer.getAndResetSpans();
const metricsData = metrics.gatherData();
const metricsPayload = {
plugins: [{ name: 'com.instana.plugin.aws.lambda', entityId: identityProvider.getEntityId(), data: metricsData }]
};
backendConnector.sendBundle({ spans, metrics: metricsPayload }, err => {
if (err) {
// We intentionally do not propagate the error from the backend request - the customer's lambda needs to finish
// successfully, no matter if we have been able to report metrics and spans.
logger.warn('Could not send traces and metrics to Instana.', err.message);
logger.debug('Could not send traces and metrics to Instana.', err);
} else {
logger.info('Traces and metrics have been sent to Instana.');
}
callback();
});
}