How to use the @instana/serverless.backendConnector.sendBundle function in @instana/serverless

To help you get started, we’ve selected a few @instana/serverless 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 instana / nodejs-sensor / packages / aws-lambda / src / wrapper.js View on Github external
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();
  });
}

@instana/serverless

Internal utility package for serverless Node.js tracing and monitoring with Instana

MIT
Latest version published 3 days ago

Package Health Score

84 / 100
Full package analysis