Skip to content

Commit

Permalink
Merge branch 'master' into greenkeeper/nyc-14.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lance authored Jun 10, 2019
2 parents f98853e + 669971b commit 3b5cabf
Show file tree
Hide file tree
Showing 16 changed files with 1,538 additions and 534 deletions.
11 changes: 11 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,21 @@ jobs:
ignore:
- gh-pages

node12:
docker:
- image: circleci/node:12
<<: *common-build

filters:
branches:
ignore:
- gh-pages

workflows:
version: 2
test_node_versions:
jobs:
- node8
- node10
- node12

43 changes: 42 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,48 @@
# Change Log
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.0.0](https://github.com/nodeshift/opossum/compare/v1.11.1...v2.0.0) (2019-06-05)


### Build System

* use node 12 on ci/cd in addition to 8 and 10 ([93f8008](https://github.com/nodeshift/opossum/commit/93f8008))


### Features

* prometheus client integration ([282b467](https://github.com/nodeshift/opossum/commit/282b467))

### Breaking Changes

* `health-check-failed` and `semaphore-locked` events have been changed to `healthCheckFailed` and `semaphoreLocked` respectively


### [1.11.1](https://github.com/nodeshift/opossum/compare/v1.11.0...v1.11.1) (2019-05-22)


### Build System

* don't fail coverage from untrusted forks ([194e18d](https://github.com/nodeshift/opossum/commit/194e18d))
* remove travis-ci now that circleci is good ([9756bf5](https://github.com/nodeshift/opossum/commit/9756bf5))
* rename the workflow to test_node_versions in circleci ([c7cc277](https://github.com/nodeshift/opossum/commit/c7cc277))
* set circleci to ignore gh-pages branch ([23e1384](https://github.com/nodeshift/opossum/commit/23e1384))
* set up coveralls (again); remove Makefile ([d099b45](https://github.com/nodeshift/opossum/commit/d099b45))
* switch to standardx for linting ([4967736](https://github.com/nodeshift/opossum/commit/4967736))
* try circleci for continuous integration ([1a77f3a](https://github.com/nodeshift/opossum/commit/1a77f3a))
* try workflows for multiple version builds ([5e9e6c8](https://github.com/nodeshift/opossum/commit/5e9e6c8))
* use codacy for coverage instead of coveralls ([e359ab9](https://github.com/nodeshift/opossum/commit/e359ab9))


### Tests

* generate browser/headless test suite ([2d24b35](https://github.com/nodeshift/opossum/commit/2d24b35))
* improve circuit.shutdown() test ([6841abc](https://github.com/nodeshift/opossum/commit/6841abc))
* switch to serve instead of http-server for browser tests ([50ccab7](https://github.com/nodeshift/opossum/commit/50ccab7))



# [1.11.0](https://github.com/nodeshift/opossum/compare/v1.10.1...v1.11.0) (2019-03-14)


Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ Click the 'Pull Request' button and fill out the form.

These are mostly notes for myself.

* Make sure everything works: `make clean && npm install && make ci`
* Run standard-version: `npm run release`
* Be sure you are starting from a clean slate: `npm clean && npm install`
* Run standard-version: `npm run release` - this will run the `ci` task
* Push to GitHub: `git push --follow-tags origin master`
* Publish to npmjs.com: `npm publish`
* Assuming all goes well, head over to https://github.com/nodeshift/opossum/releases
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on the web - search it! Fowler's blog post is one place to
| Documentation: | https://nodeshift.dev/opossum/ |
| Typngs: | https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/opossum
| Issue tracker: | https://github.com/nodeshift/opossum/issues |
| Engines: | Node.js 8.x, 10.x, 11.x |
| Engines: | Node.js 8.x, 10.x, 11.x, 12.x |

## Usage

Expand Down Expand Up @@ -161,8 +161,8 @@ Here are the events you can listen for.
* `close` - emitted when the breaker state changes to `closed`
* `halfOpen` - emitted when the breaker state changes to `halfOpen`
* `fallback` - emitted when the breaker has a fallback function and executes it
* `semaphore-locked` - emitted when the breaker is at capacity and cannot execute the request
* `health-check-failed` - emitted when a user-supplied health check function returns a rejected promise
* `semaphoreLocked` - emitted when the breaker is at capacity and cannot execute the request
* `healthCheckFailed` - emitted when a user-supplied health check function returns a rejected promise

Handling events gives a greater level of control over your application behavior.

Expand Down
66 changes: 66 additions & 0 deletions config/webpack.browser.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const path = require('path');
const webpack = require('webpack');
const configs = ['opossum', 'opossum.min', 'browser-test']
.map(key => generateConfig(key));

// add a webpack for tests
configs.push({
target: 'web',
mode: 'development',
entry: './test/browser/index.js',
node: {
fs: 'empty'
},
output: {
path: path.resolve(__dirname, '..', 'test', 'browser'),
filename: 'webpack-test.js'
},
resolve: {
modules: ['node_modules'],
extensions: ['*', '.js']
},
plugins: [
new webpack.IgnorePlugin(/prom-client/),
new webpack.DefinePlugin({
'process.env': {
WEB: JSON.stringify('web')
}
})
]
});

function generateConfig (name) {
const mode = name.indexOf('min') > -1 ? 'production' : 'development';
const config = {
mode,
entry: {
circuitBreaker: './index.js'
},
output: {
path: path.resolve(__dirname, '..', 'dist'),
filename: `${name}.js`,
sourceMapFilename: `${name}.map`,
library: 'circuitBreaker',
libraryTarget: 'umd'
},
node: {
process: true,
console: true
},
plugins: [
new webpack.IgnorePlugin(/prom-client/),
new webpack.ProvidePlugin({
'circuitBreaker': 'opossum'
}),
new webpack.DefinePlugin({
'process.env': {
WEB: JSON.stringify('web')
}
})
],
devtool: 'source-map'
};
return config;
}

module.exports = configs;
21 changes: 2 additions & 19 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
const path = require('path');
const webpack = require('webpack');
const configs = ['opossum', 'opossum.min', 'browser-test']
const configs = ['opossum', 'opossum.min']
.map(key => generateConfig(key));

// add a webpack for tests
configs.push({
target: 'web',
mode: 'development',
entry: './test/browser/index.js',
node: {
fs: 'empty'
},
output: {
path: path.resolve(__dirname, '..', 'test', 'browser'),
filename: 'webpack-test.js'
},
resolve: {
modules: ['node_modules'],
extensions: ['*', '.js']
}
});

function generateConfig (name) {
const mode = name.indexOf('min') > -1 ? 'production' : 'development';
const config = {
target: 'node',
mode,
entry: {
circuitBreaker: './index.js'
Expand Down
82 changes: 70 additions & 12 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ <h3 class='mb0 no-anchor'>opossum</h3>
#hystrixStats
</a></li>

<li><a
href='#circuitbreakermetrics'
class='regular pre-open'>
#metrics
</a></li>

<li><a
href='#circuitbreakerenabled'
class='regular pre-open'>
Expand Down Expand Up @@ -300,19 +306,19 @@ <h3 class='mb0 no-anchor'>opossum</h3>


<li><a
href='#eventcircuitbreakersemaphore-locked'
href='#eventcircuitbreakersemaphorelocked'
class="">
CircuitBreaker#semaphore-locked
CircuitBreaker#semaphoreLocked

</a>

</li>


<li><a
href='#eventcircuitbreakerhealth-check-failed'
href='#eventcircuitbreakerhealthcheckfailed'
class="">
CircuitBreaker#health-check-failed
CircuitBreaker#healthCheckFailed

</a>

Expand Down Expand Up @@ -588,8 +594,8 @@ <h3>Events</h3>
<li><code>close</code> - emitted when the breaker state changes to <code>closed</code></li>
<li><code>halfOpen</code> - emitted when the breaker state changes to <code>halfOpen</code></li>
<li><code>fallback</code> - emitted when the breaker has a fallback function and executes it</li>
<li><code>semaphore-locked</code> - emitted when the breaker is at capacity and cannot execute the request</li>
<li><code>health-check-failed</code> - emitted when a user-supplied health check function returns a rejected promise</li>
<li><code>semaphoreLocked</code> - emitted when the breaker is at capacity and cannot execute the request</li>
<li><code>healthCheckFailed</code> - emitted when a user-supplied health check function returns a rejected promise</li>
</ul>
<p>Handling events gives a greater level of control over your application behavior.</p>
<pre class='hljs'><span class="hljs-keyword">const</span> circuit = circuitBreaker(<span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> $.<span class="hljs-keyword">get</span>(route), circuitBreakerOptions);
Expand Down Expand Up @@ -1921,6 +1927,58 @@ <h3 class='fl m0' id='circuitbreaker'>










</section>

</div>
</div>

<div class='border-bottom' id='circuitbreakermetrics'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>metrics</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>



<p>Get the prometheus metrics for this circuit</p>

<div class='pre p1 fill-light mt0'>metrics</div>

<p>
Type:
PrometheusMetrics
</p>























Expand Down Expand Up @@ -2966,8 +3024,8 @@ <h3 class='fl m0' id='eventcircuitbreakersuccess'>

<div class='clearfix'>

<h3 class='fl m0' id='eventcircuitbreakersemaphore-locked'>
CircuitBreaker#semaphore-locked
<h3 class='fl m0' id='eventcircuitbreakersemaphorelocked'>
CircuitBreaker#semaphoreLocked
</h3>


Expand All @@ -2977,7 +3035,7 @@ <h3 class='fl m0' id='eventcircuitbreakersemaphore-locked'>
<p>Emitted when the rate limit has been reached and there
are no more locks to be obtained.</p>

<div class='pre p1 fill-light mt0'>CircuitBreaker#semaphore-locked</div>
<div class='pre p1 fill-light mt0'>CircuitBreaker#semaphoreLocked</div>

<p>
Type:
Expand Down Expand Up @@ -3020,8 +3078,8 @@ <h3 class='fl m0' id='eventcircuitbreakersemaphore-locked'>

<div class='clearfix'>

<h3 class='fl m0' id='eventcircuitbreakerhealth-check-failed'>
CircuitBreaker#health-check-failed
<h3 class='fl m0' id='eventcircuitbreakerhealthcheckfailed'>
CircuitBreaker#healthCheckFailed
</h3>


Expand All @@ -3031,7 +3089,7 @@ <h3 class='fl m0' id='eventcircuitbreakerhealth-check-failed'>
<p>Emitted with the user-supplied health check function
returns a rejected promise.</p>

<div class='pre p1 fill-light mt0'>CircuitBreaker#health-check-failed</div>
<div class='pre p1 fill-light mt0'>CircuitBreaker#healthCheckFailed</div>

<p>
Type:
Expand Down
Loading

0 comments on commit 3b5cabf

Please sign in to comment.