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: v11.5.2
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: v11.5.3
Choose a head ref
  • 3 commits
  • 4 files changed
  • 2 contributors

Commits on Jun 27, 2019

  1. Compress t-digest to prevent memory leakage (#234)

    * 142: Fix memory leakage and add compressCount option
    
    * #142: Add compression of tdigest to CHANGELOG
    atd-schubert authored and siimon committed Jun 27, 2019
    Copy the full SHA
    26c65fe View commit details
  2. Changelog 11.5.2

    siimon committed Jun 27, 2019
    Copy the full SHA
    42d19c1 View commit details
  3. 11.5.3

    siimon committed Jun 27, 2019
    Copy the full SHA
    200c94e View commit details
Showing with 105 additions and 91 deletions.
  1. +7 −1 CHANGELOG.md
  2. +1 −0 index.d.ts
  3. +7 −0 lib/summary.js
  4. +90 −90 package.json
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -13,6 +13,13 @@ project adheres to [Semantic Versioning](http://semver.org/).

### Added

## [11.5.1] - 2019-06-27

### Changed

- Parameter `compressCount` in Summaries to control compression of data in t-digest.
- Compress t-digest in Summaries

## [11.5.2] - 2019-06-20

### Changed
@@ -47,7 +54,6 @@ project adheres to [Semantic Versioning](http://semver.org/).
metrics. (#244)

### Added

- Added a `remove()` method on each metric type, based on [Prometheus "Writing Client Libraries" section on labels](https://prometheus.io/docs/instrumenting/writing_clientlibs/#labels)

## [11.2.1]
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -466,6 +466,7 @@ export interface SummaryConfiguration {
aggregator?: Aggregator;
maxAgeSeconds?: number;
ageBuckets?: number;
compressCount?: number;
}

/**
7 changes: 7 additions & 0 deletions lib/summary.js
Original file line number Diff line number Diff line change
@@ -21,6 +21,8 @@ const {
} = require('./validation');
const timeWindowQuantiles = require('./timeWindowQuantiles');

const DEFAULT_COMPRESS_COUNT = 1000; // every 1000 measurements

class Summary {
/**
* Summary
@@ -80,6 +82,8 @@ class Summary {
this.hashMap = {};
this.labelNames = config.labelNames || [];

this.compressCount = config.compressCount || DEFAULT_COMPRESS_COUNT;

if (this.labelNames.length === 0) {
this.hashMap = {
[hashObject({})]: {
@@ -262,6 +266,9 @@ function observe(labels) {

summaryOfLabel.td.push(labelValuePair.value);
summaryOfLabel.count++;
if (summaryOfLabel.count % this.compressCount === 0) {
summaryOfLabel.td.compress();
}
summaryOfLabel.sum += labelValuePair.value;
this.hashMap[hash] = summaryOfLabel;
};
180 changes: 90 additions & 90 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,92 +1,92 @@
{
"name": "prom-client",
"version": "11.5.2",
"description": "Client for prometheus",
"main": "index.js",
"files": [
"lib/",
"index.js",
"index.d.ts"
],
"engines": {
"node": ">=6.1"
},
"scripts": {
"benchmarks": "node ./benchmarks/index.js",
"test": "npm run lint && npm run compile-typescript && npm run test-unit",
"lint": "eslint .",
"test-unit": "jest",
"compile-typescript": "tsc --project ."
},
"repository": {
"type": "git",
"url": "git@github.com:siimon/prom-client.git"
},
"keywords": [
"Prometheus",
"Metrics",
"Client"
],
"author": "Simon Nyberg",
"license": "Apache-2.0",
"homepage": "https://github.com/siimon/prom-client",
"devDependencies": {
"@clevernature/benchmark-regression": "^1.0.0",
"eslint": "^5.6.0",
"eslint-config-prettier": "^4.3.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-prettier": "^3.0.1",
"express": "^4.13.3",
"husky": "^1.3.1",
"jest": "^24.8.0",
"lint-staged": "^7.0.0",
"lolex": "^4.0.1",
"prettier": "1.17.1",
"typescript": "^3.0.3"
},
"dependencies": {
"tdigest": "^0.1.1"
},
"types": "./index.d.ts",
"jest": {
"testEnvironment": "node",
"testRegex": ".*Test\\.js$"
},
"lint-staged": {
"*.js": [
"eslint --fix",
"git add"
],
"*.{ts,md,json,yml}": [
"prettier --write",
"git add"
],
".{eslintrc,travis.yml}": [
"prettier --write",
"git add"
]
},
"prettier": {
"singleQuote": true,
"useTabs": true,
"overrides": [
{
"files": "*.md",
"options": {
"useTabs": false
}
},
{
"files": ".eslintrc",
"options": {
"parser": "json"
}
}
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
"name": "prom-client",
"version": "11.5.3",
"description": "Client for prometheus",
"main": "index.js",
"files": [
"lib/",
"index.js",
"index.d.ts"
],
"engines": {
"node": ">=6.1"
},
"scripts": {
"benchmarks": "node ./benchmarks/index.js",
"test": "npm run lint && npm run compile-typescript && npm run test-unit",
"lint": "eslint .",
"test-unit": "jest",
"compile-typescript": "tsc --project ."
},
"repository": {
"type": "git",
"url": "git@github.com:siimon/prom-client.git"
},
"keywords": [
"Prometheus",
"Metrics",
"Client"
],
"author": "Simon Nyberg",
"license": "Apache-2.0",
"homepage": "https://github.com/siimon/prom-client",
"devDependencies": {
"@clevernature/benchmark-regression": "^1.0.0",
"eslint": "^5.6.0",
"eslint-config-prettier": "^4.3.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-prettier": "^3.0.1",
"express": "^4.13.3",
"husky": "^1.3.1",
"jest": "^24.8.0",
"lint-staged": "^7.0.0",
"lolex": "^4.0.1",
"prettier": "1.17.1",
"typescript": "^3.0.3"
},
"dependencies": {
"tdigest": "^0.1.1"
},
"types": "./index.d.ts",
"jest": {
"testEnvironment": "node",
"testRegex": ".*Test\\.js$"
},
"lint-staged": {
"*.js": [
"eslint --fix",
"git add"
],
"*.{ts,md,json,yml}": [
"prettier --write",
"git add"
],
".{eslintrc,travis.yml}": [
"prettier --write",
"git add"
]
},
"prettier": {
"singleQuote": true,
"useTabs": true,
"overrides": [
{
"files": "*.md",
"options": {
"useTabs": false
}
},
{
"files": ".eslintrc",
"options": {
"parser": "json"
}
}
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}