Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

opossum

Package Overview
Dependencies
Maintainers
4
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opossum - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

14

CHANGELOG.md

@@ -5,2 +5,16 @@ # Changelog

## [2.2.0](https://github.com/nodeshift/opossum/compare/v2.1.0...v2.2.0) (2019-06-24)
### Bug Fixes
* ensure that including dist/opossum.js works ([#341](https://github.com/nodeshift/opossum/issues/341)) ([873deb5](https://github.com/nodeshift/opossum/commit/873deb5)), closes [/github.com/lance/elizabethan-insults/commit/ebabdf359c54090cfde31a06ad09576eeba82488#diff-23fce1009af5652674e09470cda3c008R9](https://github.com/nodeshift/opossum/issues/diff-23fce1009af5652674e09470cda3c008R9)
### Features
* add prometheusRegistry option ([#332](https://github.com/nodeshift/opossum/issues/332)) ([0056cdc](https://github.com/nodeshift/opossum/commit/0056cdc))
## [2.1.0](https://github.com/nodeshift/opossum/compare/v2.0.0...v2.1.0) (2019-06-12)

@@ -7,0 +21,0 @@

5

lib/circuit.js

@@ -189,3 +189,6 @@ 'use strict';

if (PrometheusMetrics && options.usePrometheus) {
this[PROMETHEUS_METRICS] = new PrometheusMetrics(this);
this[PROMETHEUS_METRICS] = new PrometheusMetrics(
this,
options.prometheusRegistry
);
}

@@ -192,0 +195,0 @@ }

16

lib/prometheus-metrics.js

@@ -17,4 +17,5 @@ 'use strict';

class PrometheusMetrics {
constructor (circuit) {
constructor (circuit, registry) {
this.circuit = circuit;
this._registry = registry || client.register
this._client = client;

@@ -24,4 +25,6 @@ this.counters = [];

this.interval = this._client
.collectDefaultMetrics({ prefix, timeout: 5000 });
if (!registry) {
this.interval = this._client
.collectDefaultMetrics({ prefix, timeout: 5000 });
}

@@ -31,3 +34,4 @@ for (let eventName of this.circuit.eventNames()) {

name: `${prefix}${eventName}`,
help: `A count of the ${circuit.name} circuit's ${eventName} event`
help: `A count of the ${circuit.name} circuit's ${eventName} event`,
registers: [this._registry]
});

@@ -43,7 +47,7 @@ this.circuit.on(eventName, _ => {

clearInterval(this.interval);
this._client.register.clear();
this._registry.clear();
}
get metrics () {
return this._client.register.metrics();
return this._registry.metrics();
}

@@ -50,0 +54,0 @@

{
"name": "opossum",
"version": "2.1.0",
"version": "2.2.0",
"author": "Red Hat, Inc.",

@@ -13,5 +13,4 @@ "license": "Apache-2.0",

"prebuild": "npm run lint",
"build": "npm run build:browser && npm run build:node && npm run build:docs",
"build:node": "webpack --config=config/webpack.config.js",
"build:browser": "webpack --config=config/webpack.browser.config.js",
"build": "./test/browser/generate-index.sh && npm run build:browser && npm run build:docs",
"build:browser": "webpack --config=config/webpack.config.js",
"build:docs": "npm run build:docs:html && npm run build:docs:markdown",

@@ -59,3 +58,3 @@ "build:docs:html": "documentation build index.js -f html -o docs --config documentation.yml",

"tape": "~4.10.1",
"webpack": "~4.33.0",
"webpack": "~4.35.0",
"webpack-cli": "~3.3.0"

@@ -62,0 +61,0 @@ },

@@ -262,2 +262,23 @@ # opossum [![CircleCI](https://circleci.com/gh/nodeshift/opossum/tree/master.svg?style=svg&circle-token=0742302baa8c95cef354997ea52a383d3d078ff1)](https://circleci.com/gh/nodeshift/opossum/tree/master)

The `prometheusRegistry` option allows to provide a existing
[prom-client](https://github.com/siimon/prom-client) registry.
The metrics about the circuit will be added to the provided registry instead
of the global registry.
The [default metrics](https://github.com/siimon/prom-client#default-metrics)
will not be added to the provided registry.
```js
const opossum = require('opossum');
const { Registry } = require('prom-client');
// Create a registry
const prometheusRegistry = new Registry();
// create a circuit
const circuit = opossum(functionThatMightFail, {
usePrometheus: true,
prometheusRegistry
});
```
#### Hystrix

@@ -264,0 +285,0 @@

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc