remove logging and bump to 2.0.4

This commit is contained in:
Henry Oswald 2018-11-29 16:10:55 +00:00
parent 9a737bef2f
commit 752541b7f1
3 changed files with 1 additions and 8 deletions

View file

@ -60,7 +60,6 @@ module.exports = Metrics =
help: key, help: key,
labelNames: ['app','host','status','method'] labelNames: ['app','host','status','method']
}) })
console.log("doing inc", key, opts)
opts.app = appname opts.app = appname
opts.host = hostname opts.host = hostname
promMetrics[key].inc(opts) promMetrics[key].inc(opts)
@ -86,13 +85,11 @@ module.exports = Metrics =
labelNames: ['app', 'path', 'status_code', 'method', 'collection', 'query'] labelNames: ['app', 'path', 'status_code', 'method', 'collection', 'query']
}) })
opts.app = appname opts.app = appname
console.log("doing timing", key, opts)
promMetrics[key].observe(opts, timeSpan) promMetrics[key].observe(opts, timeSpan)
Timer : class Timer : class
constructor :(key, sampleRate = 1, opts)-> constructor :(key, sampleRate = 1, opts)->
this.start = new Date() this.start = new Date()
console.log("creating new timer", key)
key = Metrics.sanitizeKey(key) key = Metrics.sanitizeKey(key)
this.key = key this.key = key
this.sampleRate = sampleRate this.sampleRate = sampleRate

View file

@ -1,6 +1,6 @@
{ {
"name": "metrics-sharelatex", "name": "metrics-sharelatex",
"version": "2.0.3", "version": "2.0.4",
"description": "A drop-in metrics and monitoring module for node.js apps", "description": "A drop-in metrics and monitoring module for node.js apps",
"repository": { "repository": {
"type": "git", "type": "git",

View file

@ -16,7 +16,6 @@ module.exports = (obj, methodName, prefix, logger) ->
modifedMethodName = "#{splitPrefix[1]}_#{methodName}" modifedMethodName = "#{splitPrefix[1]}_#{methodName}"
else else
modifedMethodName = methodName modifedMethodName = methodName
console.log "Async method", prefix, key, methodName, modifedMethodName
obj[methodName] = (originalArgs...) -> obj[methodName] = (originalArgs...) ->
[firstArgs..., callback] = originalArgs [firstArgs..., callback] = originalArgs
@ -26,9 +25,6 @@ module.exports = (obj, methodName, prefix, logger) ->
logger.log "[Metrics] expected wrapped method '#{methodName}' to be invoked with a callback" logger.log "[Metrics] expected wrapped method '#{methodName}' to be invoked with a callback"
return realMethod.apply this, originalArgs return realMethod.apply this, originalArgs
console.log("creating timer for async method", prefix, startPrefix, modifedMethodName)
timer = new metrics.Timer(startPrefix, null, {method: modifedMethodName}) timer = new metrics.Timer(startPrefix, null, {method: modifedMethodName})
realMethod.call this, firstArgs..., (callbackArgs...) -> realMethod.call this, firstArgs..., (callbackArgs...) ->