Skip to content

Commit 22627ab

Browse files
authored
fix: tagObject to avoid ignoring booleans (#388)
* fix `tagObject` to not ignore booleans * lint
1 parent 14f4be7 commit 22627ab

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/utils/tag-object.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,22 @@ describe("tagObject", () => {
2222
keyOne: "foobar",
2323
myObject: {
2424
anotherKey: ["array", "of", "values"],
25+
nestedBoolean: false,
2526
},
2627
val: null,
2728
number: 1,
29+
aBoolean: true,
2830
},
2931
});
3032
expect(setTag.mock.calls).toEqual([
3133
["lambda_payload.request.keyOne", "foobar"],
3234
["lambda_payload.request.myObject.anotherKey.0", "array"],
3335
["lambda_payload.request.myObject.anotherKey.1", "of"],
3436
["lambda_payload.request.myObject.anotherKey.2", "values"],
37+
["lambda_payload.request.myObject.nestedBoolean", false],
3538
["lambda_payload.request.val", null],
3639
["lambda_payload.request.number", 1],
40+
["lambda_payload.request.aBoolean", true],
3741
]);
3842
});
3943
it("tags arrays of objects", () => {

src/utils/tag-object.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function tagObject(currentSpan: any, key: string, obj: any, depth = 0): a
2020
}
2121
return tagObject(currentSpan, key, parsed, depth);
2222
}
23-
if (typeof obj === "number") {
23+
if (typeof obj === "number" || typeof obj === "boolean") {
2424
return currentSpan.setTag(key, obj);
2525
}
2626
if (typeof obj === "object") {

0 commit comments

Comments
 (0)