From 54d446ac3febc1859e2c284c88a380a66a025188 Mon Sep 17 00:00:00 2001 From: kirrg001 Date: Sat, 24 Aug 2024 08:26:49 +0200 Subject: [PATCH] chore: fixed typos and simplified bundle check --- packages/aws-lambda/src/wrapper.js | 1 + packages/aws-lambda/test/multiple_data/test.js | 2 +- packages/serverless/src/backend_connector.js | 4 +--- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/aws-lambda/src/wrapper.js b/packages/aws-lambda/src/wrapper.js index dd74e1c839..2821f58fb5 100644 --- a/packages/aws-lambda/src/wrapper.js +++ b/packages/aws-lambda/src/wrapper.js @@ -438,6 +438,7 @@ function postHandler(entrySpan, error, result, callback) { // When the Lambda handler finishes we send all spans via `sendBundle`. // If there is any span collected afterwards (async operations), we send them out // directly and that's why we set `setTransmitImmediate` to true. + // We need to rework the default behavior via https://jsw.ibm.com/browse/INSTA-13498 spanBuffer.setTransmitImmediate(true); const metricsData = metrics.gatherData(); diff --git a/packages/aws-lambda/test/multiple_data/test.js b/packages/aws-lambda/test/multiple_data/test.js index 33cd5a56b9..79867c472e 100644 --- a/packages/aws-lambda/test/multiple_data/test.js +++ b/packages/aws-lambda/test/multiple_data/test.js @@ -141,7 +141,7 @@ describe('multiple data lambda handler', function () { control.getRawBundles(), control.getRawSpanArrays() ]).then(([spans, rawBundles, rawSpanArrays]) => { - // 1 X bundle requestat the end of the lambda fn + // 1 X bundle request at the end of the lambda fn expect(rawBundles.length).to.equal(1); // All spans are sent at the end of the lambda fn diff --git a/packages/serverless/src/backend_connector.js b/packages/serverless/src/backend_connector.js index 40c2f2db4f..da42978f0c 100644 --- a/packages/serverless/src/backend_connector.js +++ b/packages/serverless/src/backend_connector.js @@ -117,9 +117,7 @@ exports.setLogger = function setLogger(_logger) { * the variable is always true. */ exports.sendBundle = function sendBundle(bundle, finalLambdaRequest, callback) { - logger.debug( - `Sending bundle to Instana (no. of spans: ${(bundle && bundle.spans && bundle.spans.length) || 'unknown'})` - ); + logger.debug(`Sending bundle to Instana (no. of spans: ${bundle?.spans?.length ?? 'unknown'})`); send('/bundle', bundle, finalLambdaRequest, callback); };