mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 06:39:02 +02:00
Merge pull request #28459 from overleaf/em-history-restore-metrics
Add revert file/project timing metrics GitOrigin-RevId: 5c701f70b8d8dcb9052c6559815e05bc3af9bcad
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const Settings = require('@overleaf/settings')
|
||||
const Path = require('path')
|
||||
const FileWriter = require('../../infrastructure/FileWriter')
|
||||
const Metrics = require('../../infrastructure/Metrics')
|
||||
const FileSystemImportManager = require('../Uploads/FileSystemImportManager')
|
||||
const EditorController = require('../Editor/EditorController')
|
||||
const Errors = require('../Errors/Errors')
|
||||
@@ -77,6 +78,7 @@ const RestoreManager = {
|
||||
threadIds,
|
||||
options = {}
|
||||
) {
|
||||
const endTimer = Metrics.revertFileDurationSeconds.startTimer()
|
||||
const project = await ProjectGetter.promises.getProject(projectId, {
|
||||
overleaf: true,
|
||||
rootDoc_id: true,
|
||||
@@ -176,6 +178,7 @@ const RestoreManager = {
|
||||
userId
|
||||
)
|
||||
|
||||
endTimer({ type: 'file' })
|
||||
return {
|
||||
_id: newFile._id,
|
||||
type: 'file',
|
||||
@@ -296,6 +299,7 @@ const RestoreManager = {
|
||||
new Set(newRanges.comments.map(({ op: { t } }) => t))
|
||||
)
|
||||
|
||||
endTimer({ type: 'doc' })
|
||||
return {
|
||||
_id,
|
||||
type: importInfo.type,
|
||||
@@ -333,6 +337,7 @@ const RestoreManager = {
|
||||
},
|
||||
|
||||
async revertProject(userId, projectId, version) {
|
||||
const endTimer = Metrics.revertProjectDurationSeconds.startTimer()
|
||||
const project = await ProjectGetter.promises.getProject(projectId, {
|
||||
overleaf: true,
|
||||
})
|
||||
@@ -398,6 +403,7 @@ const RestoreManager = {
|
||||
}
|
||||
}
|
||||
|
||||
endTimer()
|
||||
return reverted
|
||||
},
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
const Metrics = require('@overleaf/metrics')
|
||||
|
||||
exports.analyticsQueue = new Metrics.prom.Counter({
|
||||
@@ -5,3 +7,16 @@ exports.analyticsQueue = new Metrics.prom.Counter({
|
||||
help: 'Number of events sent to the analytics queue',
|
||||
labelNames: ['status', 'event_type'],
|
||||
})
|
||||
|
||||
exports.revertFileDurationSeconds = new Metrics.prom.Histogram({
|
||||
name: 'timer_revert_file_duration_seconds',
|
||||
help: 'Duration of the file restore operation',
|
||||
buckets: [0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5],
|
||||
labelNames: ['type'],
|
||||
})
|
||||
|
||||
exports.revertProjectDurationSeconds = new Metrics.prom.Histogram({
|
||||
name: 'timer_revert_project_duration_seconds',
|
||||
help: 'Duration of the project restore operation',
|
||||
buckets: [0.5, 1, 2, 5, 10, 30, 60, 120, 300, 900, 1800],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user