prom-client
Advanced tools
Comparing version 3.5.0 to 4.0.0
10
index.js
@@ -8,7 +8,3 @@ /** | ||
exports.counter = require('./lib/counter'); | ||
exports.gauge = require('./lib/gauge'); | ||
exports.register = require('./lib/register'); | ||
exports.histogram = require('./lib/histogram'); | ||
exports.summary = require('./lib/summary'); | ||
@@ -23,1 +19,7 @@ exports.Counter = require('./lib/counter'); | ||
exports.exponentialBuckets = require('./lib/bucketGenerators').exponentialBuckets; | ||
var defaultMetrics = require('./lib/defaultMetrics'); | ||
defaultMetrics(); | ||
exports.defaultMetrics = defaultMetrics; |
@@ -50,3 +50,3 @@ /** | ||
* @param {object} labels - What label you want to be incremented | ||
* @param {float} value - Value to increment, if omitted increment with 1 | ||
* @param {Number} value - Value to increment, if omitted increment with 1 | ||
* @returns {void} | ||
@@ -53,0 +53,0 @@ */ |
@@ -51,3 +51,3 @@ /** | ||
* @param {object} labels - Object with labels and their values | ||
* @param {float} value - Value to set the gauge to, must be positive | ||
* @param {Number} value - Value to set the gauge to, must be positive | ||
* @returns {void} | ||
@@ -65,3 +65,3 @@ */ | ||
* @param {object} labels - Object with labels where key is the label key and value is label value. Can only be one level deep | ||
* @param {float} value - Value to increment - if omitted, increment with 1 | ||
* @param {Number} value - Value to increment - if omitted, increment with 1 | ||
* @returns {void} | ||
@@ -77,3 +77,3 @@ */ | ||
* @param {object} labels - Object with labels where key is the label key and value is label value. Can only be one level deep | ||
* @param {float} value - Value to decrement - if omitted, decrement with 1 | ||
* @param {Number} value - Value to decrement - if omitted, decrement with 1 | ||
* @returns {void} | ||
@@ -80,0 +80,0 @@ */ |
@@ -61,3 +61,3 @@ /** | ||
* @param {object} labels - Object with labels where key is the label key and value is label value. Can only be one level deep | ||
* @param {float} value - Value to observe in the histogram | ||
* @param {Number} value - Value to observe in the histogram | ||
* @returns {void} | ||
@@ -64,0 +64,0 @@ */ |
@@ -52,3 +52,3 @@ /** | ||
* @param {object} labels - Object with labels where key is the label key and value is label value. Can only be one level deep | ||
* @param {float} value - Value to observe | ||
* @param {Number} value - Value to observe | ||
* @returns {void} | ||
@@ -55,0 +55,0 @@ */ |
{ | ||
"name": "prom-client", | ||
"version": "3.5.0", | ||
"version": "4.0.0", | ||
"description": "Client for prometheus", | ||
@@ -16,3 +16,3 @@ "main": "index.js", | ||
"lint": "eslint --ignore-pattern doc/ --ignore-path .gitignore .", | ||
"test-unit": "mocha test/" | ||
"test-unit": "mocha --recursive test/" | ||
}, | ||
@@ -19,0 +19,0 @@ "repository": { |
@@ -15,2 +15,60 @@ # Prometheus client for node.js [![Build Status](https://travis-ci.org/siimon/prom-client.svg?branch=master)](https://travis-ci.org/siimon/prom-client) [![Build status](https://ci.appveyor.com/api/projects/status/k2e0gwonkcee3lp9/branch/master?svg=true)](https://ci.appveyor.com/project/siimon/prom-client/branch/master) | ||
#### Default metrics | ||
There are some default metrics recommended by Prometheus | ||
[itself](https://prometheus.io/docs/instrumenting/writing_clientlibs/#standard-and-runtime-collectors). These metrics are collected | ||
automatically for you when you do `require('prom-client')`. | ||
NOTE: Some of the metrics, concerning File Descriptors and Memory, are only available on Linux. | ||
In addition, some Node-specific metrics are included, such as event loop lag, and active handles. See what metrics there are in | ||
[lib/metrics](lib/metrics). | ||
The function returned from `defaultMetrics` takes 2 options, a blacklist of metrics to skip, and a timeout for how often the probe should | ||
be fired. By default all probes are launched every 10 seconds, but this can be modified like this: | ||
```js | ||
var client = require('prom-client'); | ||
var defaultMetrics = client.defaultMetrics; | ||
// Skip `osMemoryHeap` probe, and probe every 5th second. | ||
defaultMetrics(['osMemoryHeap'], 5000); | ||
```` | ||
You can get the full list of metrics by inspecting `client.defaultMetrics.metricsList`. | ||
`defaultMetrics` returns an identification when invoked, which is a reference to the `Timer` used to keep the probes going. This can be | ||
passed to `clearInterval` in order to stop all probes. | ||
NOTE: Existing intervals are automatically cleared when calling `defaultMetrics`. | ||
```js | ||
var client = require('prom-client'); | ||
var defaultMetrics = client.defaultMetrics; | ||
var interval = defaultMetrics(); | ||
// ... some time later | ||
clearInterval(interval); | ||
```` | ||
NOTE: `unref` is called on the `interval` internally, so it will not keep your node process going indefinitely if it's the only thing | ||
keeping it from shutting down. | ||
##### Disabling default metrics | ||
To disable collecting the default metrics, you have to call the function and pass it to `clearInterval`. | ||
```js | ||
var client = require('prom-client'); | ||
clearInterval(client.defaultMetrics()); | ||
// Clear the register | ||
client.register.clear(); | ||
``` | ||
#### Counter | ||
@@ -17,0 +75,0 @@ |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
53104
23
1122
224
3