Skip to content

Commit

Permalink
Merge branch 'main' into jordan.gonzalez/add-gitlab-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanista authored Jan 23, 2024
2 parents 57b902b + afc1a75 commit 864e3f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/utils/tag-object.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ describe("tagObject", () => {
level2_list: [null, true, "nice", { l3: "v3" }],
level2_bool: true,
level2_int: 2,
level2_null: null,
level2_empty_obj: {},
},
vals: [{ thingOne: 1 }, { thingTwo: 2 }],
},
Expand All @@ -83,6 +85,8 @@ describe("tagObject", () => {
["function.request.level1.level2_list", '[null,true,"nice",{"l3":"v3"}]'],
["function.request.level1.level2_bool", "true"],
["function.request.level1.level2_int", "2"],
["function.request.level1.level2_null", null],
["function.request.level1.level2_empty_obj", "{}"],
["function.request.vals.0", '{"thingOne":1}'],
["function.request.vals.1", '{"thingTwo":2}'],
]);
Expand Down
6 changes: 3 additions & 3 deletions src/utils/tag-object.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const redactableKeys = ["authorization", "x-authorization", "password", "token"];

export function tagObject(currentSpan: any, key: string, obj: any, depth = 0, maxDepth = 10): any {
if (depth >= maxDepth) {
return currentSpan.setTag(key, redactVal(key, JSON.stringify(obj).substring(0, 5000)));
}
if (obj === null) {
return currentSpan.setTag(key, obj);
}
if (depth >= maxDepth) {
return currentSpan.setTag(key, redactVal(key, JSON.stringify(obj).substring(0, 5000)));
}
depth += 1;
if (typeof obj === "string") {
let parsed: string;
Expand Down

0 comments on commit 864e3f5

Please sign in to comment.