{"id":13473571,"url":"https://github.com/nodeshift/opossum-prometheus","last_synced_at":"2025-04-06T07:14:54.173Z","repository":{"id":38377743,"uuid":"202202960","full_name":"nodeshift/opossum-prometheus","owner":"nodeshift","description":"Prometheus metrics for opossum circuit breakers","archived":false,"fork":false,"pushed_at":"2025-03-24T07:11:47.000Z","size":1199,"stargazers_count":22,"open_issues_count":10,"forks_count":13,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-30T06:05:32.415Z","etag":null,"topics":["circuit-breaker","metrics","opossum","prometheus"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nodeshift.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-13T18:31:09.000Z","updated_at":"2025-03-20T14:08:38.000Z","dependencies_parsed_at":"2024-01-16T06:11:07.115Z","dependency_job_id":"a00356cb-80a5-46c0-b838-a71b3cbd85d4","html_url":"https://github.com/nodeshift/opossum-prometheus","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodeshift%2Fopossum-prometheus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodeshift%2Fopossum-prometheus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodeshift%2Fopossum-prometheus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodeshift%2Fopossum-prometheus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodeshift","download_url":"https://codeload.github.com/nodeshift/opossum-prometheus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247445681,"owners_count":20939961,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circuit-breaker","metrics","opossum","prometheus"],"created_at":"2024-07-31T16:01:04.913Z","updated_at":"2025-04-06T07:14:54.154Z","avatar_url":"https://github.com/nodeshift.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Prometheus Metrics for Opossum Circuit Breaker\n\n![Node.js CI](https://github.com/nodeshift/opossum-prometheus/workflows/Node.js%20CI/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/nodeshift/opossum-prometheus/badge.svg?branch=main)](https://coveralls.io/github/nodeshift/opossum-prometheus?branch=main)\n[![Known Vulnerabilities](https://snyk.io/test/npm/opossum-prometheus/badge.svg)](https://snyk.io/test/npm/opossum-prometheus)\n\nThis module provides [Prometheus](https://prometheus.io/) metrics for\n[opossum](https://github.com/nodeshift/opossum) circuit breakers. To use\nit with your circuit breakers, just pass them in to the `PrometheusMetrics`\nconstructor.\n\nFor each circuit breaker, the metrics are:\n\n  * a `prometheus counter` for each event name\n  * a `prometheus summary` for the events `success`, `failed` execution time.\n\nExample:\n\n```js\n  const CircuitBreaker = require('opossum');\n  const PrometheusMetrics = require('opossum-prometheus');\n\n  // create a couple of circuit breakers\n  const c1 = new CircuitBreaker(someFunction);\n  const c2 = new CircuitBreaker(someOtherFunction);\n\n  // Provide them to the constructor\n  const prometheus = new PrometheusMetrics({ circuits: [c1, c2] });\n\n  //...\n  // Provide other circuit breaker later\n  const c3 = new CircuitBreaker(someOtherFunction3);\n  prometheus.add([c3]);\n  \n  // Write metrics to the console\n  console.log(await prometheus.metrics());\n```\n\nThis module would typically be used in an application that can provide\nan endpoint for the Prometheus server to monitor.\n\nThe `prometheusRegistry` constructor parameter allows you to provide an existing\n[prom-client](https://github.com/siimon/prom-client) registry.\nThe metrics about the circuit will be added to the provided registry instead\nof the global registry.\nThe [default metrics](https://github.com/siimon/prom-client#default-metrics)\nwill not be added to the provided registry.\n\n```js\nconst CircuitBreaker = require('opossum');\nconst PrometheusMetrics = require('opossum-prometheus');\nconst { Registry } = require('prom-client');\n\n// Create a registry\nconst registry = new Registry();\n\n// create a circuit\nconst circuit = new CircuitBreaker(functionThatMightFail);\nconst metrics = new PrometheusMetrics({ circuits: [circuit], registry: registry })\n```\n\n## Options\nThe `PrometheusMetrics` constructor takes an options object as detailed below.\n\n```js\nconst options = {};\nnew PrometheusMetrics(options)\n```\n\n|Name                      |Description                                                             |Default                                                                                                |\n|--------------------------|------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|\n|`circuits`                |A list or individual circuit breaker to create metrics for              |No circuits                                                                                            |\n|`registry`                |An existing registry to use for prometheus metrics                      |`undefined` - The default prometheus registry will be used and default system metrics will be collected|\n|`exposePerformanceMetrics`|Measure the performance of breakers and report them through the registry|true                                                                                                   |\n|`metricPrefix`|Prefix for circuit breakers metrics name|any string                                                                                                 |","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodeshift%2Fopossum-prometheus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodeshift%2Fopossum-prometheus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodeshift%2Fopossum-prometheus/lists"}