monitor-dog
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "monitor-dog", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A helpful wrapper for dogstatsd.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -32,1 +32,55 @@ # monitor-dog | ||
``` | ||
## Documentation | ||
### .set, .increment, .histogram, .gauge | ||
These methods behave exactly as you would expect on a regular | ||
[dogstatsd Client](https://www.npmjs.com/package/node-dogstatsd). | ||
### .timer(name, [startNow]) | ||
Creates and returns new timer with the given `name`. Optional boolean | ||
`startNow` can be provided to start the timer at a later date using the | ||
`.start` method. | ||
##### Synchronous | ||
```js | ||
// Create the timer | ||
var sumTimer = monitor.timer('sum.time'); | ||
// Perform a computation | ||
var sum = 0; | ||
for (var i = 0; i < 1000000; i++) { | ||
sum += i; | ||
} | ||
// Call .stop() to send a histogram event named 'sum.time' | ||
// with the recorded duration... | ||
sumTimer.stop(); | ||
``` | ||
##### Asynchronous | ||
```js | ||
var requestTimer = monitor.timer('request.time'); | ||
request('/some/endpoint', function (err, res) { | ||
requestTimer.stop(); | ||
}); | ||
``` | ||
##### Delayed Use | ||
```js | ||
var delayedTime = monitor.timer('delayed.timer', false); | ||
// ... Do some other stuff ... | ||
delayedTimer.start(); | ||
// ... Do some more stuff ... | ||
delayedTimer.stop(); | ||
``` | ||
## License | ||
MIT |
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
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
18031
86