Skip to content

Commit 0c87fb3

Browse files
committed
Merge branch 'master' into sergio.prada/task-improve-int-tests
* master: Update condition for setting dd parent source (#95)
2 parents b652a4e + 8ab3c90 commit 0c87fb3

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "datadog-lambda-js",
3-
"version": "3.26.0",
3+
"version": "3.27.0",
44
"description": "Lambda client library that supports hybrid tracing in node js",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/trace/listener.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ describe("TraceListener", () => {
150150
function_arn: "arn:aws:lambda:us-east-1:123456789101:function:my-lambda",
151151
function_version: "$LATEST",
152152
request_id: "1234",
153-
resource_names: "my-lambda",
154-
"_dd.parent_source": "xray",
153+
resource_names: "my-lambda"
155154
},
156155
type: "serverless",
157156
},

src/trace/listener.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,19 @@ export class TraceListener {
9090
if (this.context) {
9191
logDebug("Applying lambda context to datadog traces");
9292
const functionArn = (this.context.invokedFunctionArn ?? "").toLowerCase();
93-
const tk = functionArn.split(":")
93+
const tk = functionArn.split(":");
9494
options.tags = {
9595
cold_start: didFunctionColdStart(),
9696
function_arn: tk.length > 7 ? tk.slice(0, 7).join(":") : functionArn,
9797
function_version: tk.length > 7 ? tk[7] : "$LATEST",
9898
request_id: this.context.awsRequestId,
9999
resource_names: this.context.functionName,
100100
};
101-
if (this.contextService.traceSource !== Source.DDTrace) {
102-
options.tags['_dd.parent_source'] = this.contextService.traceSource;
101+
if (
102+
(this.contextService.traceSource === Source.Xray && this.config.mergeDatadogXrayTraces) ||
103+
this.contextService.traceSource === Source.Event
104+
) {
105+
options.tags["_dd.parent_source"] = this.contextService.traceSource;
103106
}
104107
}
105108
if (this.stepFunctionContext) {

0 commit comments

Comments
 (0)