@metrics/client
Advanced tools
Comparing version 2.3.1 to 2.4.0
@@ -8,2 +8,15 @@ # Changelog | ||
## [unreleased] | ||
## [2.4.0] - 2019-03-07 | ||
- Remove redundant (and wrongly) set of source property - [#24](https://github.com/metrics-js/client/pull/24) | ||
- Guard against MaxListenersExceededWarning when large amount of streams is piped - [#23](https://github.com/metrics-js/client/pull/23) | ||
- Updated dependencies - [#22](https://github.com/metrics-js/client/pull/22) | ||
- Fix code example in documentation - [#21](https://github.com/metrics-js/client/pull/21) | ||
## [2.3.1] - 2019-02-07 | ||
- Updated @metrics/metric to version 2.3.1 | ||
## [2.3.0] - 2019-01-21 | ||
@@ -41,2 +54,5 @@ | ||
[unreleased]: https://github.com/metrics-js/client/compare/v2.4.0...HEAD | ||
[2.4.0]: https://github.com/metrics-js/client/compare/v2.3.1...v2.4.0 | ||
[2.3.1]: https://github.com/metrics-js/client/compare/v2.3.0...v2.3.1 | ||
[2.3.0]: https://github.com/metrics-js/client/compare/v2.2.0...v2.3.0 | ||
@@ -43,0 +59,0 @@ [2.2.0]: https://github.com/metrics-js/client/compare/v2.1.1...v2.2.0 |
@@ -15,6 +15,6 @@ 'use strict'; | ||
const push = Symbol('push'); | ||
const push = Symbol('metrics:client:push'); | ||
const MetricsClient = class MetricsClient extends stream.Transform { | ||
constructor({ id = undefined } = {}) { | ||
constructor({ id } = {}) { | ||
super( | ||
@@ -33,2 +33,12 @@ Object.assign( | ||
}); | ||
// Avoid hitting the max listeners limit when multiple | ||
// streams is piped into the same stream. | ||
this.on('pipe', (src) => { | ||
this.setMaxListeners(this.getMaxListeners() + 1); | ||
}); | ||
this.on('unpipe', () => { | ||
this.setMaxListeners(this.getMaxListeners() - 1); | ||
}); | ||
} | ||
@@ -54,4 +64,2 @@ | ||
counter.on('metric', metric => { | ||
// eslint-disable-next-line no-param-reassign | ||
metric.source = this.source; | ||
this[push](metric); | ||
@@ -65,4 +73,2 @@ }); | ||
gauge.on('metric', metric => { | ||
// eslint-disable-next-line no-param-reassign | ||
metric.source = this.source; | ||
this[push](metric); | ||
@@ -76,4 +82,2 @@ }); | ||
summary.on('metric', metric => { | ||
// eslint-disable-next-line no-param-reassign | ||
metric.source = this.source; | ||
this[push](metric); | ||
@@ -87,4 +91,2 @@ }); | ||
histogram.on('metric', metric => { | ||
// eslint-disable-next-line no-param-reassign | ||
metric.source = this.source; | ||
this[push](metric); | ||
@@ -107,3 +109,2 @@ }); | ||
}); | ||
metric.source = this.source; | ||
this[push](metric); | ||
@@ -115,3 +116,2 @@ }; | ||
const metric = new Metric(options); | ||
metric.source = this.source; | ||
this[push](metric); | ||
@@ -118,0 +118,0 @@ } |
{ | ||
"name": "@metrics/client", | ||
"version": "2.3.1", | ||
"version": "2.4.0", | ||
"description": "Streaming system independent metric production", | ||
@@ -27,15 +27,15 @@ "main": "lib/client.js", | ||
"@metrics/metric": "^2.3.1", | ||
"readable-stream": "^3.1.1", | ||
"readable-stream": "^3.2.0", | ||
"time-span": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^5.11.0", | ||
"eslint": "^5.15.1", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-config-prettier": "^3.1.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-prettier": "^3.0.0", | ||
"eslint-config-prettier": "^4.1.0", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-prettier": "^3.0.1", | ||
"benchmark": "^2.1.4", | ||
"prettier": "^1.11.1", | ||
"lolex": "^3.0.0", | ||
"tap": "^12.1.1" | ||
"prettier": "^1.16.4", | ||
"lolex": "^3.1.0", | ||
"tap": "^12.6.0" | ||
}, | ||
@@ -42,0 +42,0 @@ "repository": { |
@@ -16,2 +16,4 @@ # @metrics/client | ||
```js | ||
const Metrics = require('@metrics/client'); | ||
const client = new Metrics(); | ||
@@ -18,0 +20,0 @@ ``` |
31406
579
308
Updatedreadable-stream@^3.2.0