Skip to content

Commit 4ca0710

Browse files
committed
🐛 Fix typecheck errors after rebase onto main
- eventRow.tsx: remove duplicate view_update key in RUM_EVENT_TYPE_COLOR - trackCommonViewMetrics/trackViews/rumPublicApi: make setLoadingTime return {no_view, no_active_view, overwritten} so addTelemetryUsage gets the fields now required by the AddViewLoadingTime telemetry schema (landed in main via rum-events-format #352)
1 parent d725ca7 commit 4ca0710

5 files changed

Lines changed: 15 additions & 5 deletions

File tree

developer-extension/src/panel/components/tabs/eventsTab/eventRow.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ const RUM_EVENT_TYPE_COLOR = {
3737
telemetry: 'teal',
3838
vital: 'orange',
3939
transition: 'green',
40-
view_update: 'blue',
4140
}
4241

4342
const LOG_STATUS_COLOR = {

packages/rum-core/src/boot/rumPublicApi.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const noopStartRum = (): ReturnType<StartRum> => ({
2424
addError: () => undefined,
2525
addEvent: () => undefined,
2626
addTiming: () => undefined,
27-
setLoadingTime: () => undefined,
27+
setLoadingTime: () => ({ no_view: false, no_active_view: false, overwritten: false }),
2828
addFeatureFlagEvaluation: () => undefined,
2929
startView: () => undefined,
3030
setViewContext: () => undefined,

packages/rum-core/src/boot/rumPublicApi.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,9 +787,12 @@ export function makeRumPublicApi(
787787

788788
setViewLoadingTime: monitor(() => {
789789
const callTimestamp = timeStampNow()
790-
strategy.setLoadingTime(callTimestamp)
790+
const { no_view, no_active_view, overwritten } = strategy.setLoadingTime(callTimestamp)
791791
addTelemetryUsage({
792792
feature: 'addViewLoadingTime',
793+
no_view,
794+
no_active_view,
795+
overwritten,
793796
})
794797
}),
795798

packages/rum-core/src/domain/view/trackViews.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,13 @@ export function trackViews(
179179
addTiming: (name: string, time: RelativeTime | TimeStamp = timeStampNow()) => {
180180
currentView.addTiming(name, time)
181181
},
182-
setLoadingTime: (callTimestamp?: TimeStamp) => currentView.setLoadingTime(callTimestamp),
182+
setLoadingTime: (callTimestamp?: TimeStamp) => {
183+
if (!currentView) {
184+
return { no_view: true, no_active_view: false, overwritten: false }
185+
}
186+
const result = currentView.setLoadingTime(callTimestamp)
187+
return { no_view: false, ...result }
188+
},
183189
startView: (options?: ViewOptions, startClocks?: ClocksState) => {
184190
currentView.end({ endClocks: startClocks })
185191
currentView = startNewView(ViewLoadingType.ROUTE_CHANGE, startClocks, options)

packages/rum-core/src/domain/view/viewMetrics/trackCommonViewMetrics.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,17 @@ export function trackCommonViewMetrics(
8484
},
8585
setLoadingTime: (callTimestamp?: TimeStamp) => {
8686
if (viewEnded) {
87-
return
87+
return { no_active_view: true, overwritten: hasManualLoadingTime }
8888
}
8989
const loadingTime = elapsed(viewStart.timeStamp, callTimestamp ?? timeStampNow())
9090
if (!hasManualLoadingTime) {
9191
stopLoadingTimeTracking()
9292
}
93+
const overwritten = hasManualLoadingTime
9394
hasManualLoadingTime = true
9495
commonViewMetrics.loadingTime = loadingTime
9596
scheduleViewUpdate()
97+
return { no_active_view: false, overwritten }
9698
},
9799
}
98100
}

0 commit comments

Comments
 (0)