Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: siimon/prom-client
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v14.1.0
Choose a base ref
...
head repository: siimon/prom-client
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v14.1.1
Choose a head ref
  • 8 commits
  • 10 files changed
  • 3 contributors

Commits on Aug 23, 2022

  1. chore: add .npmrc (#511)

    SimenB authored Aug 23, 2022
    Copy the full SHA
    e21178e View commit details
  2. Copy the full SHA
    d1673f2 View commit details
  3. chore: update prettier (#510)

    SimenB authored Aug 23, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    c1fb4d9 View commit details
  4. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    20f67ec View commit details

Commits on Oct 27, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    a6e3510 View commit details

Commits on Dec 8, 2022

  1. Copy the full SHA
    15babd5 View commit details

Commits on Dec 31, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    7e2d65d View commit details
  2. 14.1.1

    SimenB committed Dec 31, 2022
    Copy the full SHA
    cf6106f View commit details
Showing with 32 additions and 26 deletions.
  1. +6 −6 .github/workflows/nodejs.yml
  2. +1 −0 .npmrc
  3. +2 −0 CHANGELOG.md
  4. +4 −4 README.md
  5. +2 −1 index.js
  6. +8 −6 lib/metrics/gc.js
  7. +1 −2 lib/metrics/processHandles.js
  8. +1 −2 lib/metrics/processRequests.js
  9. +1 −2 lib/metrics/processResources.js
  10. +6 −3 package.json
12 changes: 6 additions & 6 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -16,25 +16,25 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [10.x, 12.x, 14.x, 16.x, 17.x, 18.x]
node-version: [10.x, 12.x, 14.x, 16.x, 17.x, 18.x, 19.x]
os: [ubuntu-latest, windows-latest, macOS-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Restore dependencies cache
uses: actions/cache@v2
uses: actions/cache@v3
id: cache
with:
path: node_modules
key: ${{ matrix.os }}-{{ matrix.node-version }}-node_modules-${{ hashFiles('**/package.json') }}
key: ${{ matrix.os }}-${{ matrix.node-version }}-node_modules-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ matrix.os }}-{{ matrix.node-version }}-node_modules-
${{ matrix.os }}-${{ matrix.node-version }}-node_modules-
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm i
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@ project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- Increase compatibility with external build system such as `rollup` by making perf_hooks optional in gc.js

### Added

## [14.1.0] - 2022-08-23
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -491,21 +491,21 @@ const client = require('prom-client');
let gateway = new client.Pushgateway('http://127.0.0.1:9091');

gateway.pushAdd({ jobName: 'test' })
.then({resp, body} => {
.then(({resp, body}) => {
/* ... */
})
.catch(err => {
/* ... */
})); //Add metric and overwrite old ones
gateway.push({ jobName: 'test' })
.then({resp, body} => {
.then(({resp, body}) => {
/* ... */
})
.catch(err => {
/* ... */
})); //Overwrite all metrics (use PUT)
gateway.delete({ jobName: 'test' })
.then({resp, body} => {
.then(({resp, body}) => {
/* ... */
})
.catch(err => {
@@ -514,7 +514,7 @@ gateway.delete({ jobName: 'test' })

//All gateway requests can have groupings on it
gateway.pushAdd({ jobName: 'test', groupings: { key: 'value' } })
.then({resp, body} => {
.then(({resp, body}) => {
/* ... */
})
.catch(err => {
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -17,7 +17,8 @@ exports.Summary = require('./lib/summary');
exports.Pushgateway = require('./lib/pushgateway');

exports.linearBuckets = require('./lib/bucketGenerators').linearBuckets;
exports.exponentialBuckets = require('./lib/bucketGenerators').exponentialBuckets;
exports.exponentialBuckets =
require('./lib/bucketGenerators').exponentialBuckets;

exports.collectDefaultMetrics = require('./lib/defaultMetrics');

14 changes: 8 additions & 6 deletions lib/metrics/gc.js
Original file line number Diff line number Diff line change
@@ -14,10 +14,13 @@ const NODEJS_GC_DURATION_SECONDS = 'nodejs_gc_duration_seconds';
const DEFAULT_GC_DURATION_BUCKETS = [0.001, 0.01, 0.1, 1, 2, 5];

const kinds = [];
kinds[perf_hooks.constants.NODE_PERFORMANCE_GC_MAJOR] = 'major';
kinds[perf_hooks.constants.NODE_PERFORMANCE_GC_MINOR] = 'minor';
kinds[perf_hooks.constants.NODE_PERFORMANCE_GC_INCREMENTAL] = 'incremental';
kinds[perf_hooks.constants.NODE_PERFORMANCE_GC_WEAKCB] = 'weakcb';

if (perf_hooks && perf_hooks.constants) {
kinds[perf_hooks.constants.NODE_PERFORMANCE_GC_MAJOR] = 'major';
kinds[perf_hooks.constants.NODE_PERFORMANCE_GC_MINOR] = 'minor';
kinds[perf_hooks.constants.NODE_PERFORMANCE_GC_INCREMENTAL] = 'incremental';
kinds[perf_hooks.constants.NODE_PERFORMANCE_GC_WEAKCB] = 'weakcb';
}

module.exports = (registry, config = {}) => {
if (!perf_hooks) {
@@ -32,8 +35,7 @@ module.exports = (registry, config = {}) => {
: DEFAULT_GC_DURATION_BUCKETS;
const gcHistogram = new Histogram({
name: namePrefix + NODEJS_GC_DURATION_SECONDS,
help:
'Garbage collection duration by kind, one of major, minor, incremental or weakcb.',
help: 'Garbage collection duration by kind, one of major, minor, incremental or weakcb.',
labelNames: ['kind', ...labelNames],
buckets,
registers: registry ? [registry] : undefined,
3 changes: 1 addition & 2 deletions lib/metrics/processHandles.js
Original file line number Diff line number Diff line change
@@ -20,8 +20,7 @@ module.exports = (registry, config = {}) => {

new Gauge({
name: namePrefix + NODEJS_ACTIVE_HANDLES,
help:
'Number of active libuv handles grouped by handle type. Every handle type is C++ class name.',
help: 'Number of active libuv handles grouped by handle type. Every handle type is C++ class name.',
labelNames: ['type', ...labelNames],
registers,
collect() {
3 changes: 1 addition & 2 deletions lib/metrics/processRequests.js
Original file line number Diff line number Diff line change
@@ -18,8 +18,7 @@ module.exports = (registry, config = {}) => {

new Gauge({
name: namePrefix + NODEJS_ACTIVE_REQUESTS,
help:
'Number of active libuv requests grouped by request type. Every request type is C++ class name.',
help: 'Number of active libuv requests grouped by request type. Every request type is C++ class name.',
labelNames: ['type', ...labelNames],
registers: registry ? [registry] : undefined,
collect() {
3 changes: 1 addition & 2 deletions lib/metrics/processResources.js
Original file line number Diff line number Diff line change
@@ -17,8 +17,7 @@ module.exports = (registry, config = {}) => {

new Gauge({
name: namePrefix + NODEJS_ACTIVE_RESOURCES,
help:
'Number of active resources that are currently keeping the event loop alive, grouped by async resource type.',
help: 'Number of active resources that are currently keeping the event loop alive, grouped by async resource type.',
labelNames: ['type', ...labelNames],
registers: registry ? [registry] : undefined,
collect() {
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prom-client",
"version": "14.1.0",
"version": "14.1.1",
"description": "Client for prometheus",
"main": "index.js",
"files": [
@@ -13,9 +13,11 @@
},
"scripts": {
"benchmarks": "node ./benchmarks/index.js",
"test": "npm run lint && npm run compile-typescript && npm run test-unit",
"test": "npm run lint && npm run check-prettier && npm run compile-typescript && npm run test-unit",
"lint": "eslint .",
"test-unit": "jest",
"run-prettier": "prettier . .eslintrc",
"check-prettier": "npm run run-prettier -- --check",
"compile-typescript": "tsc --project ."
},
"repository": {
@@ -41,7 +43,7 @@
"jest": "^26.0.1",
"lint-staged": "^10.0.4",
"nock": "^13.0.5",
"prettier": "2.0.5",
"prettier": "2.7.1",
"typescript": "^4.0.2"
},
"dependencies": {
@@ -62,6 +64,7 @@
"useTabs": true,
"arrowParens": "avoid",
"trailingComma": "all",
"endOfLine": "auto",
"overrides": [
{
"files": "*.md",