Socket
Socket
Sign inDemoInstall

prom-client

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prom-client - npm Package Compare versions

Comparing version 3.0.4 to 3.1.0

lib/summary.js

1

index.js

@@ -12,1 +12,2 @@ /**

exports.histogram = require('./lib/histogram');
exports.summary = require('./lib/summary');

3

package.json
{
"name": "prom-client",
"version": "3.0.4",
"version": "3.1.0",
"description": "Client for prometheus",

@@ -34,4 +34,5 @@ "main": "index.js",

"object-hash": "^0.9.2",
"tdigest": "^0.1.1",
"util-extend": "^1.0.1"
}
}

@@ -13,3 +13,3 @@ # Prometheus client for node.js [![Build Status](https://travis-ci.org/siimon/prom-client.svg?branch=master)](https://travis-ci.org/siimon/prom-client)

All metric types has 2 mandatory parameters, name and help.
All metric types has 2 mandatory parameters, name and help.

@@ -56,3 +56,3 @@ #### Counter

**Configuration**
**Configuration**

@@ -62,3 +62,3 @@ The defaults buckets are intended to cover usual web/rpc requests, this can however be overriden.

var Client = require('prom-client');
new Client.histogram('metric_name', 'metric_help', {
new Client.histogram('metric_name', 'metric_help', {
buckets: [ 0.10, 5, 15, 50, 100, 500 ]

@@ -84,4 +84,35 @@ });

#### Labels
#### Summary
Summaries calculate percentiles of observed values.
**Configuration**
The default percentiles are: 0.01, 0.05, 0.5, 0.9, 0.95, 0.99, 0.999. But they can be overriden like this:
```
var Client = require('prom-client');
new Client.summary('metric_name', 'metric_help', {
percentiles: [ 0.01, 0.1, 0.9, 0.99 ]
});
```
Usage example
```
var Client = require('prom-client');
var summary = new Client.summary('metric_name', 'metric_help');
summary.observe(10);
```
Utility to observe request durations
```
var end = summary.startTimer();
xhrRequest(function(err, res) {
end(); // Observes the value to xhrRequests duration in seconds
});
```
#### Labels
All metrics take an array as 3rd parameter that should include all supported label keys. There are 2 ways to add values to the labels

@@ -88,0 +119,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc