Skip to content

Commit d237ec2

Browse files
Replace use of _SpanPointer and AgentWriter (#812)
* Replace use of _SpanPointer * Use SpanLink * fix * add trace id and span id * change how ids are added * new spanlink * fix new spanlink * cleanup * try not patching agentwriter * try except for Span._get_links * Remove AgentWriter patch * update amd snapshots * remove extra file * arm snapshots * remove extra * trying to fix snapshots * remove file * new amd snapshots? * remove bak
1 parent 89084d6 commit d237ec2

19 files changed

Lines changed: 11717 additions & 10893 deletions

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ datadog = ">=0.51.0,<1.0.0"
3131
wrapt = "^1.11.2"
3232
ddtrace = [
3333
{version = ">=3.19.1,<4", python = ">=3.8,<3.10"},
34-
{version = ">=4.1.1,<5,!=4.6.*,<4.8.0", python = ">=3.10"}
34+
{version = ">=4.1.1,<5,!=4.6.*", python = ">=3.10"}
3535
]
3636
ujson = [
3737
{version = ">=5.10.0,<5.12.0", python = ">=3.8,<3.10"},

scripts/run_integration_tests.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,9 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do
263263
echo "Writing logs to $function_snapshot_path because no snapshot exists yet"
264264
echo "$logs" >$function_snapshot_path
265265
else
266-
# Compare new logs to snapshots
267-
diff_output=$(echo "$logs" | sort | diff -w - <(sort $function_snapshot_path))
266+
# Compare new logs to snapshots (LC_ALL=C: stable sort; parse-json.js sorts object keys so
267+
# e.g. span meta key order / trailing-comma lines do not vary between runs)
268+
diff_output=$(echo "$logs" | LC_ALL=C sort | diff -w - <(LC_ALL=C sort $function_snapshot_path))
268269
if [ $? -eq 1 ]; then
269270
if [ -n "$UPDATE_SNAPSHOTS" ]; then
270271
# If $UPDATE_SNAPSHOTS is set to true write the new logs over the current snapshot

tests/integration/parse-json.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,24 @@ var rl = readline.createInterface({
77
terminal: false
88
});
99

10+
function sortKeys (value) {
11+
if (value === null || typeof value !== 'object') {
12+
return value
13+
}
14+
if (Array.isArray(value)) {
15+
return value.map(sortKeys)
16+
}
17+
var sorted = {}
18+
Object.keys(value).sort().forEach(function (key) {
19+
sorted[key] = sortKeys(value[key])
20+
})
21+
return sorted
22+
}
23+
1024
rl.on('line', function(line){
1125
try {
1226
const obj = JSON.parse(line)
13-
console.log(JSON.stringify(obj, null, 2))
27+
console.log(JSON.stringify(sortKeys(obj), null, 2))
1428
} catch (e) {
1529
console.log(line)
1630
}

0 commit comments

Comments
 (0)