aws-xray-sdk-core
Advanced tools
Comparing version 3.5.1 to 3.5.2
@@ -186,4 +186,10 @@ "use strict"; | ||
}; | ||
cls.createNamespace(NAMESPACE); | ||
logger.getLogger().debug('Starting the AWS X-Ray SDK in automatic mode (default).'); | ||
if (process.env.AWS_XRAY_MANUAL_MODE) { | ||
cls_mode = false; | ||
logger.getLogger().debug('Starting the AWS X-Ray SDK in manual mode.'); | ||
} | ||
else { | ||
cls.createNamespace(NAMESPACE); | ||
logger.getLogger().debug('Starting the AWS X-Ray SDK in automatic mode (default).'); | ||
} | ||
if (process.env.AWS_XRAY_CONTEXT_MISSING) { | ||
@@ -190,0 +196,0 @@ contextUtils.setContextMissingStrategy(process.env.AWS_XRAY_CONTEXT_MISSING); |
@@ -16,3 +16,3 @@ "use strict"; | ||
const XRAY_PLUGIN_NAME = 'XRaySDKInstrumentation'; | ||
const buildAttributesFromMetadata = async (service, operation, region, res, error) => { | ||
const buildAttributesFromMetadata = async (service, operation, region, commandInput, res, error) => { | ||
var _a, _b, _c; | ||
@@ -24,4 +24,6 @@ const { extendedRequestId, requestId, httpStatusCode: statusCode, attempts } = ((_a = res === null || res === void 0 ? void 0 : res.output) === null || _a === void 0 ? void 0 : _a.$metadata) || (error === null || error === void 0 ? void 0 : error.$metadata); | ||
retryCount: attempts, | ||
data: res === null || res === void 0 ? void 0 : res.output, | ||
request: { | ||
operation, | ||
params: commandInput, | ||
httpRequest: { | ||
@@ -63,8 +65,11 @@ region, | ||
const getXRayMiddleware = (config, manualSegment) => (next, context) => async (args) => { | ||
var _a; | ||
const segment = contextUtils.isAutomaticMode() ? contextUtils.resolveSegment() : manualSegment; | ||
const { clientName, commandName } = context; | ||
const operation = commandName.slice(0, -7); // Strip trailing "Command" string | ||
const commandInput = (_a = args === null || args === void 0 ? void 0 : args.input) !== null && _a !== void 0 ? _a : {}; | ||
const commandOperation = commandName.slice(0, -7); // Strip trailing "Command" string | ||
const operation = commandOperation.charAt(0).toLowerCase() + commandOperation.slice(1); | ||
const service = clientName.slice(0, -6); // Strip trailing "Client" string | ||
if (!segment) { | ||
const output = service + '.' + operation.charAt(0).toLowerCase() + operation.slice(1); | ||
const output = service + '.' + operation; | ||
if (!contextUtils.isAutomaticMode()) { | ||
@@ -107,3 +112,3 @@ logger.getLogger().info('Call ' + output + ' requires a segment object' + | ||
} | ||
const [aws, http] = await buildAttributesFromMetadata(service, operation, await config.region(), res, null); | ||
const [aws, http] = await buildAttributesFromMetadata(service, operation, await config.region(), commandInput, res, null); | ||
subsegment.addAttribute('aws', aws); | ||
@@ -117,3 +122,3 @@ subsegment.addAttribute('http', http); | ||
if (err.$metadata) { | ||
const [aws, http] = await buildAttributesFromMetadata(service, operation, await config.region(), null, err); | ||
const [aws, http] = await buildAttributesFromMetadata(service, operation, await config.region(), commandInput, null, err); | ||
subsegment.addAttribute('aws', aws); | ||
@@ -120,0 +125,0 @@ subsegment.addAttribute('http', http); |
{ | ||
"name": "aws-xray-sdk-core", | ||
"version": "3.5.1", | ||
"version": "3.5.2", | ||
"description": "AWS X-Ray SDK for Javascript", | ||
@@ -58,3 +58,3 @@ "author": "Amazon Web Services", | ||
"repository": "https://github.com/aws/aws-xray-sdk-node/tree/master/packages/core", | ||
"gitHead": "e32dd9580def3556ddee50b0090e2c9b97bcf361" | ||
"gitHead": "6a9f9991c4aa3eead1609f986ea9354d50f5436f" | ||
} |
@@ -25,6 +25,14 @@ | ||
AWSXRay.enableManualMode(); | ||
```js | ||
AWSXRay.enableAutomaticMode(); | ||
AWSXRay.enableAutomaticMode(); | ||
AWSXRay.enableManualMode(); | ||
/* see https://github.com/aws/aws-xray-sdk-node/pull/595 | ||
for details on using this environment variable | ||
to prevent memory leaks when using manual mode | ||
*/ | ||
process.env.AWS_XRAY_MANUAL_MODE = 'true'; | ||
``` | ||
#### Automatic mode | ||
@@ -58,2 +66,3 @@ | ||
AWS_XRAY_DEBUG_MODE Enables logging of debug messages to console output. Logging to a file is no longer built in. See 'configure logging' below. | ||
AWS_XRAY_MANUAL_MODE For overriding the default automatic mode. See 'Automatic mode'. | ||
AWS_XRAY_TRACING_NAME For overriding the default segment name to use | ||
@@ -60,0 +69,0 @@ with the middleware. See 'dynamic and fixed naming modes'. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
240113
5508
799
20