Skip to content

Commit

Permalink
tiebreaker: the one ending later should be printed first (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjvans authored Oct 23, 2023
1 parent 2b0fb42 commit 208d159
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/traces/CDSConsoleExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,11 @@ class CDSConsoleExporter /* implements SpanExporter */ {
const furtherLogsToPrint = this._temporaryStorage.get(span.spanContext().traceId)
if (furtherLogsToPrint) {
furtherLogsToPrint
// REVISIT: ordering correct?
// .sort((a, b) => {
// const d = hrTimeToMilliseconds(a.startTime) - hrTimeToMilliseconds(b.startTime)
// if (d !== 0) return d
// return hrTimeToMilliseconds(b.endTime) - hrTimeToMilliseconds(a.endTime) //> the one ending later should be printed first
// })
.sort((a, b) => hrTimeToMilliseconds(a.startTime) - hrTimeToMilliseconds(b.startTime))
.sort((a, b) => {
const d = hrTimeToMilliseconds(a.startTime) - hrTimeToMilliseconds(b.startTime)
if (d !== 0) return d
return hrTimeToMilliseconds(b.endTime) - hrTimeToMilliseconds(a.endTime) //> the one ending later should be printed first
})
.forEach(t => (toLog += this._exportInfoString(t, true, span.startTime)))
this._temporaryStorage.delete(span.spanContext().traceId)
}
Expand Down

0 comments on commit 208d159

Please sign in to comment.