Search code examples
hystrixhystrix-dashboard

Hystrix Dashboarding in Node.js Services?


Is there any functionality in Node.js to stream hystrix events from Node.js services to monitor it on a dashboard.


Solution

  • I'm going to guess you're a Java developer who's now doing Node and looking for an equivalent solution to Hystrix and Hystrix Dashboard in the Node ecosystem. So you're looking for a circuit breaker library that supports monitoring. There's not a single solution in the Node world that does all of this, but my bet would be on:

    • oppossum for the circuit-breaker pattern
    • Prometheus as a general purpose monitoring solution
    • Grafana as a general purpose visualization solution
    • opossum-prometheus to push metrics from the circuit-breaker to Prometheus

    Example code as seen on the opossum-prometheus GitHub page

      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);
    

    In Grafana this will look like this:

    Grafana dashboard showing the events emitted by a circuit breaker at different rates of error.

    Here is a Medium article explaining how to set up this stack in more detail.