
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
opossum-prometheus
Advanced tools
This module provides Prometheus metrics for
opossum circuit breakers. To use
it with your circuit breakers, just pass them in to the PrometheusMetrics
constructor.
For each circuit breaker, the metrics are:
prometheus counter
for each event nameprometheus summary
for the events success
, failed
execution time.Example:
const CircuitBreaker = require('opossum');
const PrometheusMetrics = require('opossum-prometheus');
// create a couple of circuit breakers
const c1 = new CircuitBreaker(someFunction);
const c2 = new CircuitBreaker(someOtherFunction);
// Provide them to the constructor
const prometheus = new PrometheusMetrics({ circuits: [c1, c2] });
//...
// Provide other circuit breaker later
const c3 = new CircuitBreaker(someOtherFunction3);
prometheus.add([c3]);
// Write metrics to the console
console.log(await prometheus.metrics());
This module would typically be used in an application that can provide an endpoint for the Prometheus server to monitor.
The prometheusRegistry
constructor parameter allows you to provide an existing
prom-client registry.
The metrics about the circuit will be added to the provided registry instead
of the global registry.
The default metrics
will not be added to the provided registry.
const CircuitBreaker = require('opossum');
const PrometheusMetrics = require('opossum-prometheus');
const { Registry } = require('prom-client');
// Create a registry
const registry = new Registry();
// create a circuit
const circuit = new CircuitBreaker(functionThatMightFail);
const metrics = new PrometheusMetrics({ circuits: [circuit], registry: registry })
The PrometheusMetrics
constructor takes an options object as detailed below.
const options = {};
new PrometheusMetrics(options)
Name | Description | Default |
---|---|---|
circuits | A list or individual circuit breaker to create metrics for | No circuits |
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 |
metricPrefix | Prefix for circuit breakers metrics name | any string |
0.4.0 (2024-04-08)
FAQs
Prometheus metrics for opossum circuit breaker
The npm package opossum-prometheus receives a total of 5,263 weekly downloads. As such, opossum-prometheus popularity was classified as popular.
We found that opossum-prometheus demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.