mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
[docstore] add metrics for writes to docs collection (#31741)
* [docstore] add metrics for writes to docs collection Co-authored-by: Brian Gough <brian.gough@overleaf.com> * [docstore] fix import * [docstore] use counter metric * [docstore] add metric on lines delta Co-authored-by: Brian Gough <brian.gough@overleaf.com> --------- Co-authored-by: Brian Gough <brian.gough@overleaf.com> GitOrigin-RevId: 4662c5862315c800cb7b4d57bef60e08fbe7ba59
This commit is contained in:
committed by
Copybot
co-authored by
Brian Gough
parent
fe65bc2cc1
commit
d7514feafe
@@ -6,6 +6,7 @@ import DocArchive from './DocArchiveManager.js'
|
||||
import RangeManager from './RangeManager.js'
|
||||
import Settings from '@overleaf/settings'
|
||||
import { setTimeout } from 'node:timers/promises'
|
||||
import Metrics from '@overleaf/metrics'
|
||||
|
||||
/**
|
||||
* @import { Document } from 'mongodb'
|
||||
@@ -255,6 +256,19 @@ const DocManager = {
|
||||
})
|
||||
}
|
||||
updateLines = !_.isEqual(doc.lines, lines)
|
||||
if (doc.lines.length === lines.length) {
|
||||
Metrics.inc('mongo_docs_update_delta', 1, {
|
||||
status: 'same-line-length',
|
||||
})
|
||||
} else if (doc.lines.length > lines.length) {
|
||||
Metrics.inc('mongo_docs_update_delta', 1, {
|
||||
status: 'smaller-line-length',
|
||||
})
|
||||
} else if (doc.lines.length < lines.length) {
|
||||
Metrics.inc('mongo_docs_update_delta', 1, {
|
||||
status: 'larger-line-length',
|
||||
})
|
||||
}
|
||||
updateVersion = doc.version !== version
|
||||
updateRanges = RangeManager.shouldUpdateRanges(doc.ranges, ranges)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user