Merge pull request #6230 from overleaf/jpa-collect-latency-get-dict

[web] collect latency for getting the users dict

GitOrigin-RevId: ff13cfd7c27a64b15b36c0a0cd8653b4681be6b2
This commit is contained in:
Jakob Ackermann 2022-01-04 14:01:46 +00:00 committed by Copybot
parent 17eb841b31
commit b1eac3abde

View file

@ -2,11 +2,13 @@ const request = require('request')
const requestRetry = require('requestretry') const requestRetry = require('requestretry')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const Metrics = require('@overleaf/metrics')
const TIMEOUT = 10 * 1000 const TIMEOUT = 10 * 1000
module.exports = { module.exports = {
getUserDictionaryWithRetries(userId, callback) { getUserDictionaryWithRetries(userId, callback) {
const timer = new Metrics.Timer('spelling_get_dict')
const options = { const options = {
url: `${Settings.apis.spelling.url}/user/${userId}`, url: `${Settings.apis.spelling.url}/user/${userId}`,
timeout: 3 * 1000, timeout: 3 * 1000,
@ -30,6 +32,7 @@ module.exports = {
) )
} }
timer.done()
callback(null, body) callback(null, body)
}) })
}, },