change metrics a bit for promethious

This commit is contained in:
Henry Oswald 2019-01-14 10:18:12 +00:00
parent 5eaf4c8551
commit 186f321391
2 changed files with 4 additions and 4 deletions

View file

@ -11,11 +11,11 @@ class ASpellWorker
@count = 0
@pipe = child_process.spawn("aspell", ["pipe", "-t", "--encoding=utf-8", "-d", language])
logger.info process: @pipe.pid, lang: @language, "starting new aspell worker"
metrics.inc "aspellWorker-start-" + @language
metrics.inc "aspellWorker-start", 1, {method: @language}
@pipe.on 'exit', () =>
@state = 'killed'
logger.info process: @pipe.pid, lang: @language, "aspell worker has exited"
metrics.inc "aspellWorker-exit-" + @language
metrics.inc "aspellWorker-exit" , 1, {method: @language}
@pipe.on 'close', () =>
@state = 'closed' unless @state == 'killed'
if @callback?

View file

@ -17,10 +17,10 @@ module.exports = LearnedWordsManager =
getLearnedWords: (user_token, callback = (error, words)->) ->
mongoCachedWords = mongoCache.get(user_token)
if mongoCachedWords?
metrics.inc "mongoCache-hit", 0.1
metrics.inc "mongoCache", 0.1, {status: "hit"}
return callback(null, mongoCachedWords)
metrics.inc "mongoCache-miss", 0.1
metrics.inc "mongoCache", 0.1, {status: "miss"}
logger.info user_token:user_token, "mongoCache miss"
db.spellingPreferences.findOne token: user_token, (error, preferences) ->