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

trooba-hystrix-handler

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trooba-hystrix-handler

The handler provides hystrix functionality to trooba request/response pipeline

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

trooba-hystrix-handler

Greenkeeper badge

Trooba handler that provides Hystrix functionality to trooba based service pipelines. For more details on this topic, please read these blog posts Part 1 and Part 2.

codecov Build Status NPM Downloads Known Vulnerabilities

Install

npm install trooba-hystrix-handler -S

Usage

The component collects services metrics and publishes it to process event stream under the topic 'trooba:hystrix:data'.

Pipeline configuration
const Trooba = require('trooba');
// config is used to configure transport and hystrix handler

const pipe = Trooba
// set config parameters
.use(require('trooba-hystrix-handler'), {
    timeout: 2000,  // optional
    circuitBreakerErrorThresholdPercentage: 50, // optional
    circuitBreakerForceClosed: false, // optional
    circuitBreakerForceOpened: false, // optional
    circuitBreakerRequestVolumeThreshold: 20, // optional
    circuitBreakerSleepWindowInMilliseconds: 5000, // optional
    requestVolumeRejectionThreshold: 0, // optional
    statisticalWindowNumberOfBuckets: 10, // optional
    statisticalWindowLength: 10000, // optional
    percentileWindowNumberOfBuckets: 6, // optional
    percentileWindowLength: 60000 // optional
})
// add http transport
.use(require('trooba-http-transport'), {
    hostname: 'localhost',
    port: 8000
})
.build({
    fallback: (err, request) => {  // optional
        console.log(request); // will print {foo:'bar'}
        return Promise.resolve('fallback');
    }
});

pipe.create({
    command: 'my-service-command', // required
})
.request({
    foo: 'bar'
}, (err, response) => console.log(err, response));
Viewing metrics using Hystrix dashboard

In case an application and hystrix-dashboard are packaged together, one can expose hystrix.stream as one of the http commands.

const express = require('express');
const app = express();
const dashboard = require('hystrix-dashboard');

app.use(dashboard({
    // configurable hystrix metrics topic that trooba hystrix handler uses to publish data
    topic: 'trooba:hystrix:data'
}));

app.listen(8000); //  http://localhost:8080/hystrix.stream

Keywords

FAQs

Package last updated on 27 Sep 2017

Did you know?

Socket

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.

Install

Related posts

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