-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[Obs Onboarding] Add page rendering performance monitoring #213769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0167471
28ebab7
858d025
1756c0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,8 +17,8 @@ import { perfomanceMarkers } from '../../performance_markers'; | |
| import { DescriptionWithPrefix } from '../types'; | ||
|
|
||
| interface PerformanceMeta { | ||
| queryRangeSecs: number; | ||
| queryOffsetSecs: number; | ||
| queryRangeSecs?: number; | ||
| queryOffsetSecs?: number; | ||
| isInitialLoad?: boolean; | ||
| description?: DescriptionWithPrefix; | ||
| } | ||
|
|
@@ -33,24 +33,25 @@ export function measureInteraction(pathname: string) { | |
| * @param customMetrics - Custom metrics to be included in the performance measure. | ||
| */ | ||
| pageReady(eventData?: EventData) { | ||
| let performanceMeta: PerformanceMeta | undefined; | ||
| const performanceMeta: PerformanceMeta = {}; | ||
| performance.mark(perfomanceMarkers.endPageReady); | ||
|
|
||
| if (eventData?.meta) { | ||
| const { rangeFrom, rangeTo, description } = eventData.meta; | ||
| if (eventData?.meta?.rangeFrom && eventData?.meta?.rangeTo) { | ||
| const { rangeFrom, rangeTo } = eventData.meta; | ||
|
|
||
| // Convert the date range to epoch timestamps (in milliseconds) | ||
| const dateRangesInEpoch = getDateRange({ | ||
| from: rangeFrom, | ||
| to: rangeTo, | ||
| }); | ||
|
|
||
| performanceMeta = { | ||
| queryRangeSecs: getTimeDifferenceInSeconds(dateRangesInEpoch), | ||
| queryOffsetSecs: | ||
| rangeTo === 'now' ? 0 : getOffsetFromNowInSeconds(dateRangesInEpoch.endDate), | ||
| description, | ||
| }; | ||
| performanceMeta.queryRangeSecs = getTimeDifferenceInSeconds(dateRangesInEpoch); | ||
| performanceMeta.queryOffsetSecs = | ||
| rangeTo === 'now' ? 0 : getOffsetFromNowInSeconds(dateRangesInEpoch.endDate); | ||
|
Comment on lines
+48
to
+50
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the diff I guess we don't need to add a new test in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it should be fine as the structure of the resulting object sent to the telemetry API did not change |
||
| } | ||
|
|
||
| if (eventData?.meta?.description) { | ||
| performanceMeta.description = eventData.meta.description; | ||
| } | ||
|
|
||
| if ( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.