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.1.3
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.2.0
Choose a head ref
  • 5 commits
  • 13 files changed
  • 4 contributors

Commits on Sep 28, 2018

  1. Create benchmark suite (#222)

    nowells authored and SimenB committed Sep 28, 2018
    Copy the full SHA
    24bfd0f View commit details

Commits on Nov 8, 2018

  1. Matt jarrett fix child dependency with vulnerability (#230)

    * Adds dependncy change info
    
    * Updates merge child dependency version after found vulnerability
    cujarrett authored and siimon committed Nov 8, 2018
    Copy the full SHA
    c3d154a View commit details

Commits on Nov 13, 2018

  1. Sliding windows for summaries (#229)

    * Added sliding window for summaries
    
    * Added test cases
    
    * remove comment
    
    * Do not break old behaviour
    
    * Added documentation how to enable the sliding window feature for summaries
    
    * Update changelog
    carsotho authored and siimon committed Nov 13, 2018
    Copy the full SHA
    f9f9475 View commit details
  2. Updated changelog for release

    siimon committed Nov 13, 2018
    Copy the full SHA
    dc1c2ed View commit details
  3. 11.2.0

    siimon committed Nov 13, 2018
    Copy the full SHA
    e2373c3 View commit details
Showing with 7,941 additions and 2,310 deletions.
  1. +1 −1 .eslintrc
  2. +57 −46 CHANGELOG.md
  3. +17 −0 README.md
  4. +67 −0 benchmarks/histogram.js
  5. +16 −0 benchmarks/index.js
  6. +48 −0 benchmarks/registry.js
  7. +38 −0 benchmarks/utils/labels.js
  8. +9 −4 lib/summary.js
  9. +62 −0 lib/timeWindowQuantiles.js
  10. +7,479 −2,235 package-lock.json
  11. +9 −24 package.json
  12. +60 −0 test/summaryTest.js
  13. +78 −0 test/timeWindowQuantilesTest.js
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@
}
},
{
"files": ["example/**/*.js"],
"files": ["example/**/*.js","benchmarks/**/*.js"],
"rules": {
"no-console": "off"
}
103 changes: 57 additions & 46 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -13,177 +13,188 @@ project adheres to [Semantic Versioning](http://semver.org/).

### Added

## [11.2.0]

### Changed

* Updated child dependency `merge` patch version to remove vulnerability.

### Added

* Added an initial `benchmark` suite which can be run with `npm run benchmarks`.
* Add support for sliding windows in Summaries

## [11.1.3] - 2018-09-22

### Changed

- Fixed performance by avoiding `Object.assign` on hot paths, as well as
* Fixed performance by avoiding `Object.assign` on hot paths, as well as
mutating objects when appropriate.

## [11.1.2] - 2018-09-19

### Changed

- Allow setting Gauge values to NaN, +Inf, and -Inf
- Fixed `histogram` scrape performance by using `acc.push` instead of `acc.concat`. Fixes #216 with #219
* Allow setting Gauge values to NaN, +Inf, and -Inf
* Fixed `histogram` scrape performance by using `acc.push` instead of `acc.concat`. Fixes #216 with #219

## [11.1.1] - 2018-06-29

### Changed

- Fixed `processOpenFileDescriptors` metric when no custom config was set
* Fixed `processOpenFileDescriptors` metric when no custom config was set

## [11.1.0] - 2018-06-29

- Added ability to set a name prefix in the default metrics
* Added ability to set a name prefix in the default metrics

### Changed

- Fixed `startTimer` utility to not mutate objects passed as `startLabels`
- Fixed `Counter` to validate labels parameter of `inc()` against initial
* Fixed `startTimer` utility to not mutate objects passed as `startLabels`
* Fixed `Counter` to validate labels parameter of `inc()` against initial
labelset
- Fixed `AggregatorFactory` losing the aggregator method of metrics
* Fixed `AggregatorFactory` losing the aggregator method of metrics

## [11.0.0] - 2018-03-10

### Breaking

- Fixed `gauge.setToCurrentTime()` to use seconds instead of milliseconds
- This conforms to Prometheus
* Fixed `gauge.setToCurrentTime()` to use seconds instead of milliseconds
* This conforms to Prometheus
[best practices](https://prometheus.io/docs/practices/naming/#base-units)
- Dropped support for node 4
* Dropped support for node 4

## [10.2.3] - 2018-02-28

### Breaking

### Changed

- Fixed issue that `registry.getMetricsAsJSON()` ignores registry default labels
* Fixed issue that `registry.getMetricsAsJSON()` ignores registry default labels

### Added

## [10.2.2] - 2017-11-02

### Changed

- Fixed invalid `process_virtual_memory_bytes` reported under linux
* Fixed invalid `process_virtual_memory_bytes` reported under linux

## [10.2.1] - 2017-10-27

### Changed

- Only resolve/reject `clusterMetrics` promise if no callback is provided
* Only resolve/reject `clusterMetrics` promise if no callback is provided

## [10.2.0] - 2017-10-16

### Changed

- Don't add event listeners if cluster module is not used.
- Fixed issue with counters having extra records when using empty labels
* Don't add event listeners if cluster module is not used.
* Fixed issue with counters having extra records when using empty labels

### Added

- Added `reset` to Counter and Gauge
- Added `resetMetrics` to register to calling `reset` of all metric instances
* Added `reset` to Counter and Gauge
* Added `resetMetrics` to register to calling `reset` of all metric instances

## [10.1.1] - 2017-09-26

### Changed

- Update TypeScript definitions and JSDoc comments to match JavaScript sources
- Fix lexical scope of `arguments` in cluster code
* Update TypeScript definitions and JSDoc comments to match JavaScript sources
* Fix lexical scope of `arguments` in cluster code

## [10.1.0] - 2017-09-04

### Added

- Support aggregating metrics across workers in a Node.js cluster.
* Support aggregating metrics across workers in a Node.js cluster.

## [10.0.4] - 2017-08-22

### Changed

- Include invalid values in the error messages
* Include invalid values in the error messages

## [10.0.3] - 2017-08-07

### Added

- Added registerMetric to definitions file
* Added registerMetric to definitions file

### Changed

- Fixed typing of DefaultMetricsCollectorConfiguration in definitions file
- Don't pass timestamps through to pushgateway by default
* Fixed typing of DefaultMetricsCollectorConfiguration in definitions file
* Don't pass timestamps through to pushgateway by default

## [10.0.2] - 2017-07-07

### Changed

- Don't poll default metrics every single tick
* Don't poll default metrics every single tick

## [10.0.1] - 2017-07-06

### Added

- Metrics should be initialized to 0 when there are no labels
* Metrics should be initialized to 0 when there are no labels

## [10.0.0] - 2017-07-04

### Breaking

- Print deprecation warning when metrics are constructed using non-objects
- Print deprecation warning when `collectDefaultMetrics` is called with a number
* Print deprecation warning when metrics are constructed using non-objects
* Print deprecation warning when `collectDefaultMetrics` is called with a number

### Added

- Ability to set default labels by registry
- Allow passing in `registry` as second argument to `collectDefaultMetrics` to
* Ability to set default labels by registry
* Allow passing in `registry` as second argument to `collectDefaultMetrics` to
use that instead of the default registry

### Changed

- Convert code base to ES2015 code (node 4)
- add engines field to package.json
- Use object shorthand
- Remove `util-extend` in favor of `Object.assign`
- Arrow functions over binding or putting `this` in a variable
- Use template strings
- `prototype` -> `class`
* Convert code base to ES2015 code (node 4)
* add engines field to package.json
* Use object shorthand
* Remove `util-extend` in favor of `Object.assign`
* Arrow functions over binding or putting `this` in a variable
* Use template strings
* `prototype` -> `class`

## [9.1.1] - 2017-06-17

### Changed

- Don't set timestamps for metrics that are never updated
* Don't set timestamps for metrics that are never updated

## [9.1.0] - 2017-06-07

### Added

- Ability to merge registries
* Ability to merge registries

### Changed

- Correct typedefs for object constructor of metrics
* Correct typedefs for object constructor of metrics

## [9.0.0] - 2017-05-06

### Added

- Support for multiple registers
- Support for object literals in metric constructors
- Timestamp support
* Support for multiple registers
* Support for object literals in metric constructors
* Timestamp support

### Changed

- Collection of default metrics is now disabled by default. Start collection by
* Collection of default metrics is now disabled by default. Start collection by
running `collectDefaultMetrics()`.

### Deprecated

- Creating metrics with one argument per parameter - use object literals
* Creating metrics with one argument per parameter - use object literals
instead.

[unreleased]: https://github.com/siimon/prom-client/compare/v10.2.2...HEAD
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -258,6 +258,23 @@ new client.Summary({
});
```

To enable the sliding window functionality for summaries you need to add
`maxAgeSeconds` and `ageBuckets` to the config like this:

```js
const client = require('prom-client');
new client.Summary({
name: 'metric_name',
help: 'metric_help',
maxAgeSeconds: 600,
ageBuckets: 5
});
```

The `maxAgeSeconds` will tell how old an bucket can be before it is reset and
`ageBuckets` configures how many buckets we will have in our sliding window for
the summary.

Usage example

```js
67 changes: 67 additions & 0 deletions benchmarks/histogram.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
'use strict';

const { getLabelNames, labelCombinationFactory } = require('./utils/labels');

module.exports = setupHistogramSuite;

function setupHistogramSuite(suite) {
suite.add(
'observe#1 with 64',
labelCombinationFactory([64], (client, { histogram }, labels) =>
histogram.observe(labels, 1)
),
{ teardown, setup: setup(1) }
);

suite.add(
'observe#2 with 8',
labelCombinationFactory([8, 8], (client, { histogram }, labels) =>
histogram.observe(labels, 1)
),
{ teardown, setup: setup(2) }
);

suite.add(
'observe#2 with 4 and 2 with 2',
labelCombinationFactory([4, 4, 2, 2], (client, { histogram }, labels) =>
histogram.observe(labels, 1)
),
{ teardown, setup: setup(4) }
);

suite.add(
'observe#2 with 2 and 2 with 4',
labelCombinationFactory([2, 2, 4, 4], (client, { histogram }, labels) =>
histogram.observe(labels, 1)
),
{ teardown, setup: setup(4) }
);

suite.add(
'observe#6 with 2',
labelCombinationFactory(
[2, 2, 2, 2, 2, 2],
(client, { histogram }, labels) => histogram.observe(labels, 1)
),
{ teardown, setup: setup(6) }
);
}

function setup(labelCount) {
return client => {
const registry = new client.Registry();

const histogram = new client.Histogram({
name: 'histogram',
help: 'histogram',
labelNames: getLabelNames(labelCount),
registers: [registry]
});

return { registry, histogram };
};
}

function teardown(client, { registry }) {
registry.clear();
}
16 changes: 16 additions & 0 deletions benchmarks/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

const createRegressionBenchmark = require('@clevernature/benchmark-regression');

const currentClient = require('..');
const benchmarks = createRegressionBenchmark(currentClient, [
'prom-client@latest'
]);

benchmarks.suite('registry', require('./registry'));
benchmarks.suite('histogram', require('./histogram'));
benchmarks.run().catch(err => {
console.error(err.stack);
// eslint-disable-next-line no-process-exit
process.exit(1);
});
Loading