Comparing version 1.10.1 to 1.11.0-canary-1
@@ -5,2 +5,11 @@ # Change Log | ||
# [1.11.0](https://github.com/nodeshift/opossum/compare/v1.10.1...v1.11.0) (2019-03-14) | ||
### Features | ||
* add errorFilter option to bypass incrementing failure stats ([8018012](https://github.com/nodeshift/opossum/commit/8018012)) | ||
## [1.10.1](https://github.com/nodeshift/opossum/compare/v1.10.0...v1.10.1) (2019-02-25) | ||
@@ -7,0 +16,0 @@ |
@@ -54,2 +54,8 @@ 'use strict'; | ||
* does not exceed this threshold, the circuit will remain closed. Default: 0 | ||
* @param options.errorFilter {Function} an optional function that will be | ||
* called when the circuit's function fails (returns a rejected Promise). If | ||
* this function returns truthy, the circuit's failure statistics will not be | ||
* incremented. This is useful, for example, when you don't want HTTP 404 to | ||
* trip the circuit, but still want to handle it as a failure case. | ||
* @return a {@link CircuitBreaker} instance | ||
@@ -56,0 +62,0 @@ */ |
@@ -6,2 +6,6 @@ 'use strict'; | ||
const HystrixStats = require('./hystrix-stats'); | ||
let PrometheusMetrics; | ||
if (!process.env.WEB) { | ||
PrometheusMetrics = require('./prometheus-metrics'); | ||
} | ||
const Semaphore = require('./semaphore'); | ||
@@ -20,2 +24,3 @@ | ||
const HYSTRIX_STATS = Symbol('hystrix-stats'); | ||
const PROMETHEUS_METRICS = Symbol('prometheus-metrics'); | ||
const CACHE = new WeakMap(); | ||
@@ -77,2 +82,7 @@ const ENABLED = Symbol('Enabled'); | ||
* does not exceed this threshold, the circuit will remain closed. Default: 0 | ||
* @param options.errorFilter {Function} an optional function that will be | ||
* called when the circuit's function fails (returns a rejected Promise). If | ||
* this function returns truthy, the circuit's failure statistics will not be | ||
* incremented. This is useful, for example, when you don't want HTTP 404 to | ||
* trip the circuit, but still want to handle it as a failure case. | ||
*/ | ||
@@ -88,2 +98,3 @@ class CircuitBreaker extends EventEmitter { | ||
this.options.capacity = Number.isInteger(options.capacity) ? options.capacity : Number.MAX_SAFE_INTEGER; | ||
this.options.errorFilter = options.errorFilter || (_ => false); | ||
@@ -158,2 +169,5 @@ this.semaphore = new Semaphore(this.options.capacity); | ||
this[HYSTRIX_STATS] = new HystrixStats(this); | ||
if (!process.env.WEB) { | ||
this[PROMETHEUS_METRICS] = new PrometheusMetrics(this); | ||
} | ||
} | ||
@@ -205,2 +219,5 @@ | ||
this.hystrixStats.shutdown(); | ||
if (!process.env.WEB) { | ||
this.metrics.clear(); | ||
} | ||
this[STATE] = SHUTDOWN; | ||
@@ -274,2 +291,9 @@ } | ||
get metrics () { | ||
if (!process.env.WEB) { | ||
return this[PROMETHEUS_METRICS]; | ||
} | ||
return undefined; | ||
} | ||
get enabled () { | ||
@@ -551,2 +575,4 @@ return this[ENABLED]; | ||
function fail (circuit, err, args, latency) { | ||
if (circuit.options.errorFilter(err)) return; | ||
/** | ||
@@ -553,0 +579,0 @@ * Emitted when the circuit breaker action fails |
{ | ||
"name": "opossum", | ||
"version": "1.10.1", | ||
"version": "1.11.0-canary-1", | ||
"author": "Red Hat, Inc.", | ||
@@ -8,4 +8,5 @@ "license": "Apache-2.0", | ||
"prebuild": "npm run lint", | ||
"build": "npm run build:browser && npm run build:docs", | ||
"build:browser": "webpack --config=config/webpack.config.js", | ||
"build": "npm run build:browser && npm run build:node && npm run build:docs", | ||
"build:browser": "webpack --config=config/webpack.browser.config.js", | ||
"build:node": "webpack --config=config/webpack.config.js", | ||
"build:docs": "jsdoc --verbose -d docs -t ./node_modules/ink-docstrap/template -R README.md index.js lib", | ||
@@ -18,3 +19,3 @@ "pretest": "npm run lint && npm run build:browser", | ||
"test:coverage": "nyc tape test/*.js | tap-spec", | ||
"prepare": "npm audit && npm run build:browser", | ||
"prepare": "npm run build:browser && npm run build:node", | ||
"postpublish": "./publish-docs.sh", | ||
@@ -50,3 +51,3 @@ "prerelease": "npm test", | ||
"semistandard": "~13.0.1", | ||
"standard-version": "5.0.0", | ||
"standard-version": "5.0.1", | ||
"tap-spec": "~5.0.0", | ||
@@ -66,3 +67,6 @@ "tape": "~4.10.1", | ||
"rate-limiting" | ||
] | ||
], | ||
"dependencies": { | ||
"prom-client": "^11.2.1" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20
1196951
1
13171
2
16
5
+ Addedprom-client@^11.2.1
+ Addedbintrees@1.0.2(transitive)
+ Addedprom-client@11.5.3(transitive)
+ Addedtdigest@0.1.2(transitive)