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

opossum-prometheus

Package Overview
Dependencies
Maintainers
5
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opossum-prometheus - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

12

CHANGELOG.md

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

## [0.3.0](https://github.com/lholmquist/opossum-prometheus/compare/v0.2.0...v0.3.0) (2020-09-02)
### Features
* Providing metric prefix for circuit metrics ([#32](https://github.com/lholmquist/opossum-prometheus/issues/32)) ([0d85a86](https://github.com/lholmquist/opossum-prometheus/commit/0d85a86a9f594c58f3f900cb98000e58a9eeb058))
### Bug Fixes
* upgrade standard-version from 8.0.1 to 8.0.2 ([#30](https://github.com/lholmquist/opossum-prometheus/issues/30)) ([e8edaa1](https://github.com/lholmquist/opossum-prometheus/commit/e8edaa11c2bd35908810477872519d6694fc4857))
## [0.2.0](https://github.com/lholmquist/opossum-prometheus/compare/v0.1.0...v0.2.0) (2020-04-23)

@@ -7,0 +19,0 @@

10

index.js

@@ -16,6 +16,7 @@ 'use strict';

this._registry = options.registry || client.register;
this._metricPrefix = options.metricPrefix || ``;
this._client = client;
this._options = options;
this._counter = new this._client.Counter({
name: `circuit`,
name: `${this._metricPrefix}circuit`,
help: `A count of all circuit' events`,

@@ -28,3 +29,3 @@ registers: [this._registry],

this._summary = new this._client.Summary({
name: `circuit_perf`,
name: `${this._metricPrefix}circuit_perf`,
help: `A summary of all circuit's events`,

@@ -38,3 +39,6 @@ registers: [this._registry],

this.interval = this._client
.collectDefaultMetrics({ prefix: 'opossum_', timeout: 5000 });
.collectDefaultMetrics({
prefix: `${this._metricPrefix}opossum_`,
timeout: 5000
});
}

@@ -41,0 +45,0 @@

{
"name": "opossum-prometheus",
"version": "0.2.0",
"version": "0.3.0",
"description": "Prometheus metrics for opossum circuit breaker",

@@ -30,8 +30,8 @@ "main": "index.js",

"codacy-coverage": "^3.4.0",
"nyc": "^15.0.0",
"nyc": "^15.1.0",
"opossum": "^5.0.0",
"standard-version": "^7.1.0",
"standard-version": "^9.0.0",
"standardx": "^5.0.0",
"tap-spec": "^5.0.0",
"tape": "^4.13.2"
"tape": "^5.0.1"
},

@@ -38,0 +38,0 @@ "dependencies": {

@@ -76,2 +76,3 @@ # Prometheus Metrics for Opossum Circuit Breaker

|`registry` |An existing registry to use for prometheus metrics |`undefined` - The default prometheus registry will be used and default system metrics will be collected|
|`exposePerformanceMetrics`|Measure the performance of breakers and report them through the registry|true |
|`exposePerformanceMetrics`|Measure the performance of breakers and report them through the registry|true |
|`metricPrefix`|Prefix for circuit breakers metrics name|any string |

@@ -33,13 +33,14 @@ 'use strict';

test('The factory function takes an object instead of just an Array', async t => {
t.plan(3);
const c1 = new CircuitBreaker(passFail, { name: 'fred' });
const prometheus = new PrometheusMetrics({ circuits: c1 });
await c1.fire(1);
t.equal(c1.name, 'fred');
t.ok(/circuit.*fred/.test(prometheus.metrics));
t.ok(/circuit_perf.*fred/.test(prometheus.metrics));
prometheus.clear();
t.end();
});
test('The factory function takes an object instead of just an Array',
async t => {
t.plan(3);
const c1 = new CircuitBreaker(passFail, { name: 'fred' });
const prometheus = new PrometheusMetrics({ circuits: c1 });
await c1.fire(1);
t.equal(c1.name, 'fred');
t.ok(/circuit.*fred/.test(prometheus.metrics));
t.ok(/circuit_perf.*fred/.test(prometheus.metrics));
prometheus.clear();
t.end();
});

@@ -323,1 +324,22 @@ test('The factory function provides access to metrics for all circuits',

});
test('The factory function provides metric prefix and it append to metric name',
async t => {
t.plan(6);
const c1 = new CircuitBreaker(passFail, { name: 'fred' });
const c2 = new CircuitBreaker(passFail, { name: 'bob' });
const prometheus = new PrometheusMetrics({
circuits: [c1, c2],
metricPrefix: 'some_prefix_'
});
await c1.fire(1);
await c2.fire(1);
t.equal(c1.name, 'fred');
t.equal(c2.name, 'bob');
t.ok(/some_prefix_circuit.*fred/.test(prometheus.metrics));
t.ok(/some_prefix_circuit_perf.*fred/.test(prometheus.metrics));
t.ok(/some_prefix_circuit.*bob/.test(prometheus.metrics));
t.ok(/some_prefix_circuit_perf.*bob/.test(prometheus.metrics));
prometheus.clear();
t.end();
});

Sorry, the diff of this file is not supported yet

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