Skip to content

Commit cf7f7a9

Browse files
niieanibbrzoska
authored andcommitted
feat: add computedRenderBeaconSpans entries to visualization mapping
1 parent 7f64f32 commit cf7f7a9

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

src/visualizer/mapOperationForVisualization.ts

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,79 @@ export const mapOperationForVisualization = (
205205
},
206206
}))
207207

208+
// Add computedRenderBeaconSpans as three computed-span entries per beacon
209+
const entriesFromComputedRenderBeaconSpans = Object.entries(
210+
traceRecording.computedRenderBeaconSpans || {},
211+
).flatMap<MappedSpanAndAnnotation>(([beaconName, beaconSpan]) => [
212+
{
213+
groupName: beaconName,
214+
type: 'computed-span',
215+
span: {
216+
type: 'computed-span',
217+
duration: beaconSpan.firstRenderTillContent,
218+
name: `${beaconName}/firstRenderTillContent`,
219+
startTime: adjustTimestampBy(
220+
traceRecording.startTime,
221+
beaconSpan.startOffset,
222+
),
223+
relatedTo: traceRecording.relatedTo,
224+
},
225+
annotation: {
226+
id: traceRecording.id,
227+
occurrence: 1,
228+
operationRelativeStartTime: beaconSpan.startOffset,
229+
operationRelativeEndTime:
230+
beaconSpan.startOffset + beaconSpan.firstRenderTillContent,
231+
},
232+
},
233+
{
234+
groupName: beaconName,
235+
type: 'computed-span',
236+
span: {
237+
type: 'computed-span',
238+
duration: beaconSpan.firstRenderTillLoading,
239+
name: `${beaconName}/firstRenderTillLoading`,
240+
startTime: adjustTimestampBy(
241+
traceRecording.startTime,
242+
beaconSpan.startOffset,
243+
),
244+
relatedTo: traceRecording.relatedTo,
245+
},
246+
annotation: {
247+
id: traceRecording.id,
248+
occurrence: 1,
249+
operationRelativeStartTime: beaconSpan.startOffset,
250+
operationRelativeEndTime:
251+
beaconSpan.startOffset + beaconSpan.firstRenderTillLoading,
252+
},
253+
},
254+
{
255+
groupName: beaconName,
256+
type: 'computed-span',
257+
span: {
258+
type: 'computed-span',
259+
duration: beaconSpan.firstRenderTillData,
260+
name: `${beaconName}/firstRenderTillData`,
261+
startTime: adjustTimestampBy(
262+
traceRecording.startTime,
263+
beaconSpan.startOffset,
264+
),
265+
relatedTo: traceRecording.relatedTo,
266+
},
267+
annotation: {
268+
id: traceRecording.id,
269+
occurrence: 1,
270+
operationRelativeStartTime: beaconSpan.startOffset,
271+
operationRelativeEndTime:
272+
beaconSpan.startOffset + beaconSpan.firstRenderTillData,
273+
},
274+
},
275+
])
276+
208277
const entriesWithComputedSpans = [
209278
...mappedEntries,
210279
...entriesFromComputedSpans,
280+
...entriesFromComputedRenderBeaconSpans,
211281
].sort((a, b) => {
212282
const orderA = order[a.type] ?? 100
213283
const orderB = order[b.type] ?? 100

0 commit comments

Comments
 (0)