Node.js 中是否有任何功能可以从 Node.js 服务流式传输 hystrix 事件以在仪表板上对其进行监控。
2 回答
1
我猜你是一名 Java 开发人员,他现在正在做 Node,并在 Node 生态系统中寻找与 Hystrix 和 Hystrix Dashboard 等效的解决方案。所以你正在寻找一个支持监控的断路器库。在 Node 世界中没有一个解决方案可以做到这一切,但我敢打赌:
- 断路器模式的反面
- Prometheus作为通用监控解决方案
- Grafana作为通用可视化解决方案
- opossum-prometheus将指标从断路器推送到 Prometheus
opossum-prometheus GitHub 页面上的示例代码
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(prometheus.metrics);
在 Grafana 中,这将如下所示:
这是一篇Medium 文章,解释了如何更详细地设置此堆栈。
于 2020-06-04T22:09:31.277 回答