mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #10587 from overleaf/td-commit-hash-metric
Add editing session segmentation values for long tasks and release GitOrigin-RevId: ee22238ae40b342cbd6b1e6cddcb2d0e67dba138
This commit is contained in:
parent
5728ffba2c
commit
c4b1bb87ea
2 changed files with 31 additions and 0 deletions
|
@ -287,6 +287,8 @@ If the project has been renamed please look in your project list for a new proje
|
|||
'MeanLagsPerMeasure',
|
||||
'MeanKeypressesPerMeasure',
|
||||
'MeanKeypressPaint',
|
||||
'LongTasks',
|
||||
'Release',
|
||||
]
|
||||
|
||||
for (const prop of perfProps) {
|
||||
|
|
|
@ -2,6 +2,7 @@ import { Transaction } from '@codemirror/state'
|
|||
import { EditorView } from '@codemirror/view'
|
||||
import { round } from 'lodash'
|
||||
import grammarlyExtensionPresent from '../shared/utils/grammarly'
|
||||
import getMeta from '../utils/meta'
|
||||
|
||||
const TIMER_START_NAME = 'CM6-BeforeUpdate'
|
||||
const TIMER_END_NAME = 'CM6-AfterUpdate'
|
||||
|
@ -47,6 +48,22 @@ try {
|
|||
}
|
||||
} catch (e) {}
|
||||
|
||||
let performanceLongtaskSupported = false
|
||||
let longTaskSinceLastReportCount = 0
|
||||
|
||||
// Detect support for long task monitoring
|
||||
try {
|
||||
if (PerformanceObserver.supportedEntryTypes.includes('longtask')) {
|
||||
performanceLongtaskSupported = true
|
||||
|
||||
// Register observer for long task notifications
|
||||
const observer = new PerformanceObserver(list => {
|
||||
longTaskSinceLastReportCount += list.getEntries().length
|
||||
})
|
||||
observer.observe({ entryTypes: ['longtask'] })
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
function isInputOrDelete(userEventType: string | undefined) {
|
||||
return (
|
||||
!!userEventType && ['input', 'delete'].includes(userEventType.split('.')[0])
|
||||
|
@ -242,6 +259,16 @@ export function reportCM6Perf() {
|
|||
|
||||
performance.clearMeasures(TIMER_KEYPRESS_MEASURE_NAME)
|
||||
|
||||
let longTasks = null
|
||||
|
||||
// Get long task entries (Chromium-based browsers only at time of writing)
|
||||
if (performanceLongtaskSupported) {
|
||||
longTasks = longTaskSinceLastReportCount
|
||||
longTaskSinceLastReportCount = 0
|
||||
}
|
||||
|
||||
const release = getMeta('ol-ExposedSettings')?.sentryRelease || null
|
||||
|
||||
return {
|
||||
max,
|
||||
mean,
|
||||
|
@ -259,6 +286,8 @@ export function reportCM6Perf() {
|
|||
meanLagsPerMeasure,
|
||||
meanKeypressesPerMeasure,
|
||||
meanKeypressPaint,
|
||||
longTasks,
|
||||
release,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue