datadog-lambda-js
Advanced tools
Comparing version 7.101.0 to 7.102.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.STREAM_RESPONSE = exports.HANDLER_STREAMING = exports.datadogLambdaVersion = void 0; | ||
exports.datadogLambdaVersion = "7.101.0"; | ||
exports.datadogLambdaVersion = "7.102.0"; | ||
// Response streaming functions | ||
@@ -6,0 +6,0 @@ exports.HANDLER_STREAMING = Symbol.for("aws.lambda.runtime.handler.streaming"); |
@@ -10,2 +10,3 @@ import { Context, Handler } from "aws-lambda"; | ||
export declare const captureLambdaPayloadEnvVar = "DD_CAPTURE_LAMBDA_PAYLOAD"; | ||
export declare const captureLambdaPayloadMaxDepthEnvVar = "DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH"; | ||
export declare const traceManagedServicesEnvVar = "DD_TRACE_MANAGED_SERVICES"; | ||
@@ -12,0 +13,0 @@ export declare const siteURLEnvVar = "DD_SITE"; |
@@ -75,3 +75,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getEnvValue = exports.getTraceHeaders = exports.sendDistributionMetric = exports.sendDistributionMetricWithDate = exports.extractArgs = exports.datadog = exports.defaultConfig = exports.coldStartTraceSkipLibEnvVar = exports.minColdStartTraceDurationEnvVar = exports.coldStartTracingEnvVar = exports.decodeAuthorizerContextEnvVar = exports.encodeAuthorizerContextEnvVar = exports.defaultSiteURL = exports.traceExtractorEnvVar = exports.mergeXrayTracesEnvVar = exports.lambdaTaskRootEnvVar = exports.datadogHandlerEnvVar = exports.enhancedMetricsEnvVar = exports.logInjectionEnvVar = exports.logForwardingEnvVar = exports.logLevelEnvVar = exports.siteURLEnvVar = exports.traceManagedServicesEnvVar = exports.captureLambdaPayloadEnvVar = exports.apiKeyKMSEnvVar = exports.apiKeyEnvVar = void 0; | ||
exports.getEnvValue = exports.getTraceHeaders = exports.sendDistributionMetric = exports.sendDistributionMetricWithDate = exports.extractArgs = exports.datadog = exports.defaultConfig = exports.coldStartTraceSkipLibEnvVar = exports.minColdStartTraceDurationEnvVar = exports.coldStartTracingEnvVar = exports.decodeAuthorizerContextEnvVar = exports.encodeAuthorizerContextEnvVar = exports.defaultSiteURL = exports.traceExtractorEnvVar = exports.mergeXrayTracesEnvVar = exports.lambdaTaskRootEnvVar = exports.datadogHandlerEnvVar = exports.enhancedMetricsEnvVar = exports.logInjectionEnvVar = exports.logForwardingEnvVar = exports.logLevelEnvVar = exports.siteURLEnvVar = exports.traceManagedServicesEnvVar = exports.captureLambdaPayloadMaxDepthEnvVar = exports.captureLambdaPayloadEnvVar = exports.apiKeyKMSEnvVar = exports.apiKeyEnvVar = void 0; | ||
var constants_1 = require("./constants"); | ||
@@ -86,2 +86,3 @@ var metrics_1 = require("./metrics"); | ||
exports.captureLambdaPayloadEnvVar = "DD_CAPTURE_LAMBDA_PAYLOAD"; | ||
exports.captureLambdaPayloadMaxDepthEnvVar = "DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH"; | ||
exports.traceManagedServicesEnvVar = "DD_TRACE_MANAGED_SERVICES"; | ||
@@ -108,2 +109,3 @@ exports.siteURLEnvVar = "DD_SITE"; | ||
captureLambdaPayload: false, | ||
captureLambdaPayloadMaxDepth: 10, | ||
createInferredSpan: true, | ||
@@ -424,2 +426,5 @@ debugLogging: false, | ||
} | ||
if (userConfig === undefined || userConfig.captureLambdaPayloadMaxDepth === undefined) { | ||
config.captureLambdaPayloadMaxDepth = Number(getEnvValue(exports.captureLambdaPayloadMaxDepthEnvVar, "10")); | ||
} | ||
return config; | ||
@@ -426,0 +431,0 @@ } |
import { Context } from "aws-lambda"; | ||
import { TraceConfig } from "../listener"; | ||
import { TracerWrapper } from "../tracer-wrapper"; | ||
import { SpanContextWrapper } from "trace/span-context-wrapper"; | ||
import { SpanContextWrapper } from "../span-context-wrapper"; | ||
export declare const DATADOG_TRACE_ID_HEADER = "x-datadog-trace-id"; | ||
@@ -6,0 +6,0 @@ export declare const DATADOG_PARENT_ID_HEADER = "x-datadog-parent-id"; |
@@ -1,2 +0,2 @@ | ||
import { SpanContextWrapper } from "trace/span-context-wrapper"; | ||
import { SpanContextWrapper } from "../../span-context-wrapper"; | ||
import { EventTraceExtractor } from "../extractor"; | ||
@@ -3,0 +3,0 @@ export declare class StepFunctionEventTraceExtractor implements EventTraceExtractor { |
@@ -15,2 +15,8 @@ import { Context } from "aws-lambda"; | ||
/** | ||
* The captured AWS Lambda payloads will become tags of the `aws.lambda` span. This sets how deep | ||
* it fathoms the JSON structure. When the max depth reached, the tag's value will be the | ||
* stringified value of the deeper nested items. | ||
*/ | ||
captureLambdaPayloadMaxDepth: number; | ||
/** | ||
* Whether to create inferred spans for managed services | ||
@@ -17,0 +23,0 @@ */ |
@@ -147,4 +147,4 @@ "use strict"; | ||
if (this.config.captureLambdaPayload) { | ||
(0, utils_1.tagObject)(this.tracerWrapper.currentSpan, "function.request", event); | ||
(0, utils_1.tagObject)(this.tracerWrapper.currentSpan, "function.response", result); | ||
(0, utils_1.tagObject)(this.tracerWrapper.currentSpan, "function.request", event, 0, this.config.captureLambdaPayloadMaxDepth); | ||
(0, utils_1.tagObject)(this.tracerWrapper.currentSpan, "function.response", result, 0, this.config.captureLambdaPayloadMaxDepth); | ||
} | ||
@@ -151,0 +151,0 @@ var coldStartNodes = (0, index_1.getTraceTree)(); |
@@ -48,5 +48,10 @@ "use strict"; | ||
var _DatadogSpanContext = require("dd-trace/packages/dd-trace/src/opentracing/span_context"); | ||
return new SpanContextWrapper(new _DatadogSpanContext({ | ||
traceId: traceId, | ||
spanId: spanId, | ||
return new SpanContextWrapper( | ||
// The inner type _DatadogSpanContext must have traceId and spanId as objects instead of strings because of the toArray() call | ||
// https://github.com/DataDog/dd-trace-js/blob/9c71b3060081a77639bab4c6b2a26c952f4a114f/packages/dd-trace/src/encode/0.4.js#L168 | ||
new _DatadogSpanContext({ | ||
// tslint:disable-next-line:no-construct | ||
traceId: new String(traceId), | ||
// tslint:disable-next-line:no-construct | ||
spanId: new String(spanId), | ||
sampling: { priority: samplingPriority }, | ||
@@ -53,0 +58,0 @@ }), source); |
@@ -1,2 +0,2 @@ | ||
export declare function tagObject(currentSpan: any, key: string, obj: any, depth?: number): any; | ||
export declare function tagObject(currentSpan: any, key: string, obj: any, depth?: number, maxDepth?: number): any; | ||
//# sourceMappingURL=tag-object.d.ts.map |
@@ -32,15 +32,13 @@ "use strict"; | ||
var redactableKeys = ["authorization", "x-authorization", "password", "token"]; | ||
var maxDepth = 10; | ||
function tagObject(currentSpan, key, obj, depth) { | ||
function tagObject(currentSpan, key, obj, depth, maxDepth) { | ||
var e_1, _a; | ||
if (depth === void 0) { depth = 0; } | ||
if (maxDepth === void 0) { maxDepth = 10; } | ||
if (depth >= maxDepth) { | ||
return; | ||
return currentSpan.setTag(key, redactVal(key, JSON.stringify(obj).substring(0, 5000))); | ||
} | ||
else { | ||
depth += 1; | ||
} | ||
if (obj === null) { | ||
return currentSpan.setTag(key, obj); | ||
} | ||
depth += 1; | ||
if (typeof obj === "string") { | ||
@@ -55,3 +53,3 @@ var parsed = void 0; | ||
} | ||
return tagObject(currentSpan, key, parsed, depth); | ||
return tagObject(currentSpan, key, parsed, depth, maxDepth); | ||
} | ||
@@ -65,3 +63,3 @@ if (typeof obj === "number" || typeof obj === "boolean") { | ||
var _d = __read(_c.value, 2), k = _d[0], v = _d[1]; | ||
tagObject(currentSpan, "".concat(key, ".").concat(k), v, depth); | ||
tagObject(currentSpan, "".concat(key, ".").concat(k), v, depth, maxDepth); | ||
} | ||
@@ -76,3 +74,2 @@ } | ||
} | ||
return; | ||
} | ||
@@ -79,0 +76,0 @@ } |
{ | ||
"name": "datadog-lambda-js", | ||
"version": "7.101.0", | ||
"version": "7.102.0", | ||
"description": "Lambda client library that supports hybrid tracing in node js", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -21,2 +21,16 @@ # datadog-lambda-js | ||
Besides the environment variables supported by dd-trace-js, the datadog-lambda-js library added following environment variables. | ||
| Environment Variables | Description | Default Value | | ||
| -------------------- | ------------ | ------------- | | ||
| DD_ENCODE_AUTHORIZER_CONTEXT | When set to `true` for Lambda authorizers, the tracing context will be encoded into the response for propagation. Supported for NodeJS and Python. | `true` | | ||
| DD_DECODE_AUTHORIZER_CONTEXT | When set to `true` for Lambdas that are authorized via Lambda authorizers, it will parse and use the encoded tracing context (if found). Supported for NodeJS and Python. | `true` | | ||
| DD_COLD_START_TRACING | Set to `false` to disable Cold Start Tracing. Used in NodeJS and Python. | `true` | | ||
| DD_MIN_COLD_START_DURATION | Sets the minimum duration (in milliseconds) for a module load event to be traced via Cold Start Tracing. Number. | `3` | | ||
| DD_COLD_START_TRACE_SKIP_LIB | optionally skip creating Cold Start Spans for a comma-separated list of libraries. Useful to limit depth or skip known libraries. | `./opentracing/tracer` | | ||
| DD_CAPTURE_LAMBDA_PAYLOAD | [Captures incoming and outgoing AWS Lambda payloads][1] in the Datadog APM spans for Lambda invocations. | `false` | | ||
| DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH | Determines the level of detail captured from AWS Lambda payloads, which are then assigned as tags for the `aws.lambda` span. It specifies the nesting depth of the JSON payload structure to process. Once the specified maximum depth is reached, the tag's value is set to the stringified value of any nested elements beyond this level. <br> For example, given the input payload: <pre>{<br> "lv1" : {<br> "lv2": {<br> "lv3": "val"<br> }<br> }<br>}</pre> If the depth is set to `2`, the resulting tag's key is set to `function.request.lv1.lv2` and the value is `{\"lv3\": \"val\"}`. <br> If the depth is set to `0`, the resulting tag's key is set to `function.request` and value is `{\"lv1\":{\"lv2\":{\"lv3\": \"val\"}}}` | `10` | | ||
## Lambda Profiling Beta | ||
@@ -36,3 +50,3 @@ | ||
The 6.x.x release introduces support for the node 16 runtime and esm modules. | ||
The 6.x.x release introduces support for the node 16 runtime and esm modules. | ||
@@ -39,0 +53,0 @@ ### 7.x.x |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
499238
6822
83