Skip to content

Commit 1d21fec

Browse files
committed
fix comparator
1 parent 12741f5 commit 1d21fec

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

dd-java-agent/instrumentation/mule-4/src/test/groovy/mule4/MuleForkedTest.groovy

+3-2
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,10 @@ class MuleForkedTest extends WithHttpServer<MuleTestContainer> {
214214
*/
215215
private static class TreeComparator implements Comparator<DDSpan> {
216216
private final Map<DDSpan, Long> levels
217+
private final Map<Long, DDSpan> traceMap
217218

218219
TreeComparator(List<DDSpan> trace) {
219-
final Map<Long, DDSpan> traceMap = trace.collectEntries { [(it.spanId): it] }
220+
traceMap = trace.collectEntries { [(it.spanId): it] }
220221
levels = trace.collectEntries({
221222
[(it): walkUp(traceMap, it, 0)]
222223
})
@@ -232,7 +233,7 @@ class MuleForkedTest extends WithHttpServer<MuleTestContainer> {
232233
if (o1.parentId == o2.parentId) {
233234
return o1.spanId <=> o2.spanId
234235
}
235-
return o1.parentId <=> o2.parentId
236+
return compare(traceMap.get(o1.parentId), traceMap.get(o2.parentId))
236237
}
237238

238239
def walkUp(Map<Long, DDSpan> traceMap, DDSpan span, int size) {

0 commit comments

Comments
 (0)