monitor-dog
Advanced tools
Comparing version 1.4.1 to 1.5.0
@@ -207,8 +207,9 @@ 'use strict'; | ||
* default: `true`. | ||
* @param {Object} [tags] Optional tags for the event. | ||
* @return {Timer} Timer object that can be stopped when timing is finished. | ||
*/ | ||
Monitor.prototype.timer = function (histName, start) { | ||
Monitor.prototype.timer = function (histName, start, tags) { | ||
var self = this; | ||
return new Timer(function (duration) { | ||
self.histogram(histName, duration); | ||
self.histogram(histName, duration, tags); | ||
}, start); | ||
@@ -215,0 +216,0 @@ }; |
{ | ||
"name": "monitor-dog", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"description": "A helpful wrapper for dogstatsd.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -54,2 +54,15 @@ 'use strict'; | ||
it('should call client histogram method with correct name when stopped', function (done) { | ||
var timerName = 'timer'; | ||
var timerTags = { tag1: 'one' } | ||
monitor.client.histogram.restore(); | ||
sinon.stub(monitor.client, 'histogram', function (name, duration, tags) { | ||
expect(name).to.equal(monitor.prefix + '.' + timerName); | ||
expect(tags).to.deep.equal([ 'tag1:one' ]) | ||
done(); | ||
}); | ||
var timer = monitor.timer(timerName, true, timerTags); | ||
timer.stop(); | ||
}); | ||
it('should report a realistic duration when stopped', function (done) { | ||
@@ -56,0 +69,0 @@ var duration = 60; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55373
1458
5