Skip to content

Commit fcd8cdd

Browse files
committed
Sort events chronologically in history replay and OTLP batches
1 parent 9e93e33 commit fcd8cdd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

translate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function translateOtlpLogs(otlp) {
5353
}
5454
}
5555
}
56-
return out;
56+
return out.sort((a, b) => (a.timestamp < b.timestamp ? -1 : a.timestamp > b.timestamp ? 1 : 0));
5757
}
5858

5959
// ─── Jaeger trace export → flat events ─────────────────────────────────────
@@ -198,7 +198,7 @@ function translateOtlpTraces(payload) {
198198
}
199199
}
200200
}
201-
return out;
201+
return out.sort((a, b) => (a.timestamp < b.timestamp ? -1 : a.timestamp > b.timestamp ? 1 : 0));
202202
}
203203

204204
module.exports = { translateOtlpLogs, translateJaegerTraces, translateOtlpTraces };

0 commit comments

Comments
 (0)