Skip to content

Latest commit

 

History

History
97 lines (75 loc) · 2.36 KB

File metadata and controls

97 lines (75 loc) · 2.36 KB

@gasket/plugin-happyfeet

Integrates with happy-feet to add application instance termination when health metrics such as memory usage enter a bad state.

Installation

npm i @gasket/plugin-happyfeet

Update your gasket file plugin configuration:

// gasket.js

+ import pluginHappyfeet from '@gasket/plugin-happyfeet';

export default makeGasket({
  plugins: [
+   pluginHappyFeet
  ]
});

Configuration

You can specify the various happy-feet config options in gasket.js.

// gasket.js
export default makeGasket({
   happyFeet: {
    // https://github.com/asilvas/happy-feet#usage
    escalationSoftLimitMin: 20, // 20s
    escalationSoftLimitMax: 300, // 5min
    uncaughtExceptionSoftLimit: 1,
    uncaughtExceptionHardLimit: void 0,
    rssSoftLimit: 0.9 * 1024 * 1024 * 1024, // ~900MB
    rssHardLimit: 1.8 * 1024 * 1024 * 1024, // ~1.9GB
    logOnUnhappy: true
  }
});

Happy Feet for gasket has no default configuration.

Actions

getHappyFeet

This action is used to configure and get a Happy Feet instance. You can specify the various happy-feet config options in the gasketConfig or pass the config object directly to the action.

gasketConfig example

// gasket.js
export default makeGasket({
   happyFeet: {
    // https://github.com/asilvas/happy-feet#usage
    escalationSoftLimitMin: 20, // 20s
    escalationSoftLimitMax: 300, // 5min
    uncaughtExceptionSoftLimit: 1,
    uncaughtExceptionHardLimit: void 0,
    rssSoftLimit: 0.9 * 1024 * 1024 * 1024, // ~900MB
    rssHardLimit: 1.8 * 1024 * 1024 * 1024, // ~1.9GB
    logOnUnhappy: true
  }
});
const happy = gasket.actions.getHappyFeet();

happyConfig example

const happyConfig =  {
  // https://github.com/asilvas/happy-feet#usage
  escalationSoftLimitMin: 20, // 20s
  escalationSoftLimitMax: 300, // 5min
  uncaughtExceptionSoftLimit: 1,
  uncaughtExceptionHardLimit: void 0,
  rssSoftLimit: 0.9 * 1024 * 1024 * 1024, // ~900MB
  rssHardLimit: 1.8 * 1024 * 1024 * 1024, // ~1.9GB
  logOnUnhappy: true
}
const happy = gasket.actions.getHappyFeet(happyConfig);

License

MIT