@instana/aws-lambda
Advanced tools
Comparing version 1.80.0 to 1.81.0
{ | ||
"name": "@instana/aws-lambda", | ||
"version": "1.80.0", | ||
"version": "1.81.0", | ||
"description": "Instana tracing and monitoring for Node.js based AWS Lambdas", | ||
@@ -61,4 +61,4 @@ "author": { | ||
"dependencies": { | ||
"@instana/core": "^1.80.0", | ||
"@instana/serverless": "^1.80.0" | ||
"@instana/core": "^1.81.0", | ||
"@instana/serverless": "^1.81.0" | ||
}, | ||
@@ -75,3 +75,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "c4d353ed41b1bb1e7ca4274325c70e852d748f64" | ||
"gitHead": "28aedfe40f810da68b47fb20c27281ba47690b83" | ||
} |
@@ -9,8 +9,7 @@ 'use strict'; | ||
module.exports = exports = require('./wrapper'); | ||
// required for backwards compatibility for first four beta customers | ||
exports.awsLambda = module.exports; | ||
} else { | ||
module.exports = exports = require('./noop_wrapper'); | ||
// required for backwards compatibility for first four beta customers | ||
exports.awsLambda = module.exports; | ||
} | ||
// required for backwards compatibility | ||
exports.awsLambda = module.exports; |
'use strict'; | ||
// We need to require core to provide noop implementations for currentSpan, sdk etc. but neither tracing nor metric | ||
// collection will be activated. (Neither core.init nor core.preInit are called.) | ||
const instanaCore = require('@instana/core'); | ||
const { tracing } = instanaCore; | ||
let config; | ||
exports.wrap = noopWrap; | ||
function noopWrap(config, originalHandler) { | ||
function noopWrap(_config, originalHandler) { | ||
if (arguments.length === 1) { | ||
originalHandler = config; | ||
originalHandler = _config; | ||
_config = null; | ||
} | ||
config = _config || {}; | ||
return originalHandler; | ||
} | ||
exports.currentSpan = function getHandleForCurrentSpan() { | ||
return tracing.getHandleForCurrentSpan(); | ||
}; | ||
exports.sdk = tracing.sdk; | ||
exports.setLogger = function setLogger(logger) { | ||
config.logger = logger; | ||
instanaCore.logger.init(config); | ||
}; | ||
exports.opentracing = tracing.opentracing; |
@@ -14,2 +14,3 @@ 'use strict'; | ||
let logger = consoleLogger; | ||
let config; | ||
@@ -25,7 +26,7 @@ // Initialize instrumentations early to allow for require statements after our package has been required but before the | ||
*/ | ||
exports.wrap = function wrap(config, originalHandler) { | ||
exports.wrap = function wrap(_config, originalHandler) { | ||
/* eslint-disable no-unused-vars */ | ||
if (arguments.length === 1) { | ||
originalHandler = config; | ||
config = null; | ||
originalHandler = _config; | ||
_config = null; | ||
} | ||
@@ -38,15 +39,15 @@ | ||
return function handler0() { | ||
return shimmedHandler(originalHandler, this, arguments, config); | ||
return shimmedHandler(originalHandler, this, arguments, _config); | ||
}; | ||
case 1: | ||
return function handler1(event) { | ||
return shimmedHandler(originalHandler, this, arguments, config); | ||
return shimmedHandler(originalHandler, this, arguments, _config); | ||
}; | ||
case 2: | ||
return function handler2(event, context) { | ||
return shimmedHandler(originalHandler, this, arguments, config); | ||
return shimmedHandler(originalHandler, this, arguments, _config); | ||
}; | ||
default: | ||
return function handler3(event, context, callback) { | ||
return shimmedHandler(originalHandler, this, arguments, config); | ||
return shimmedHandler(originalHandler, this, arguments, _config); | ||
}; | ||
@@ -56,3 +57,3 @@ } | ||
function shimmedHandler(originalHandler, originalThis, originalArgs, config) { | ||
function shimmedHandler(originalHandler, originalThis, originalArgs, _config) { | ||
const event = originalArgs[0]; | ||
@@ -67,3 +68,3 @@ const context = originalArgs[1]; | ||
init(event, context, config); | ||
init(event, context, _config); | ||
@@ -132,5 +133,5 @@ // The AWS lambda runtime does not seem to inspect the number of arguments the handler function expects. Instead, it | ||
*/ | ||
function init(event, context, config) { | ||
function init(event, context, _config) { | ||
/* eslint-disable dot-notation */ | ||
config = config || {}; | ||
config = _config || {}; | ||
@@ -203,1 +204,15 @@ if (config.logger) { | ||
} | ||
exports.currentSpan = function getHandleForCurrentSpan() { | ||
return tracing.getHandleForCurrentSpan(); | ||
}; | ||
exports.sdk = tracing.sdk; | ||
exports.setLogger = function setLogger(_logger) { | ||
logger = _logger; | ||
config.logger = logger; | ||
instanaCore.logger.init(config); | ||
}; | ||
exports.opentracing = tracing.opentracing; |
28980
638
Updated@instana/core@^1.81.0
Updated@instana/serverless@^1.81.0