1.0.5 • Published 4 years ago
@puzzleio/service-health v1.0.5
Health service
This module provides some information about your service.
Installation
# NPM
npm i @puzzleio/service-health --save
# Yarn
yarn install @puzzleio/service-health
Parts
This module consists of 3 main parts.
- HealthService (which is responsible for retrieving health information from the requested providers).
- InfoProvider (which is responsible for providing health information)
- WebFramework (which is responsible for integrating with the web frameworks).
Usage
const serviceHealth = require('@puzzleio/service-health');
const infoProvider = new serviceHealth.InfoProvider({
loadDefaultProviders: true
});
const healthProvider = new serviceHealth.HealthProvider(config, infoProvider);
// inside your async function, try
const health = await healthProvider.retrieve();
// returns an object that contains the health information
// you can return only the information about specific parts of the hardware/software
// by providing the list of modules
// built-in info services: CPU, memory, OS, path, uptime, user
const health = await healthProvider.retrieve(['CPU', 'memoy']);
And you're good to go!
License
MIT