@@ -90,8 +90,7 @@ const retriableGetTraceIds = (options: GetXRayTraceIdsOptions) =>
90
90
/**
91
91
* Get the trace details for a given trace ID from the AWS X-Ray API.
92
92
*
93
- * When the trace is returned, the segments are parsed, since the document is returned
94
- * stringified, and then sorted by start time.
93
+ * When the trace is returned, the segments are parsed, since the document is returned as a string.
95
94
*
96
95
* @param options - The options to get trace details, including the trace IDs and expected segments count
97
96
*/
@@ -113,7 +112,7 @@ const getTraceDetails = async (
113
112
) ;
114
113
}
115
114
116
- const parsedAndSortedTraces : XRayTraceParsed [ ] = [ ] ;
115
+ const parsedTraces : XRayTraceParsed [ ] = [ ] ;
117
116
for ( const trace of traces ) {
118
117
const { Id : id , Segments : segments } = trace ;
119
118
if ( segments === undefined || segments . length !== expectedSegmentsCount ) {
@@ -136,20 +135,14 @@ const getTraceDetails = async (
136
135
Document : JSON . parse ( Document ) as XRayTraceDocumentParsed ,
137
136
} ) ;
138
137
}
139
- const sortedSegments = parsedSegments . sort (
140
- ( a , b ) => a . Document . start_time - b . Document . start_time
141
- ) ;
142
138
143
- parsedAndSortedTraces . push ( {
139
+ parsedTraces . push ( {
144
140
Id : id as string ,
145
- Segments : sortedSegments ,
141
+ Segments : parsedSegments ,
146
142
} ) ;
147
143
}
148
144
149
- return parsedAndSortedTraces . sort (
150
- ( a , b ) =>
151
- a . Segments [ 0 ] . Document . start_time - b . Segments [ 0 ] . Document . start_time
152
- ) ;
145
+ return parsedTraces ;
153
146
} ;
154
147
155
148
/**
0 commit comments