NOTE: this is still a draft, so it's subject to changes. This alert will be removed as soon as final version will be available

πŸ’Š@hsuite/health - Comprehensive System Health Monitoring

πŸ₯ Advanced health monitoring and system diagnostics library for NestJS applications with DAG network monitoring

Enterprise-grade health monitoring solution providing real-time system resource tracking, service health checks, performance metrics collection, and specialized DAG network monitoring with event-driven updates and comprehensive diagnostics.


πŸ“š Table of Contents


✨ Quick Start

Installation

npm install @hsuite/health

Basic Setup

Health Check Usage


πŸ—οΈ Architecture

Core Component Areas

πŸ₯ System Health Monitoring

  • Real-time Health Checks - Comprehensive system health validation

  • Service Connectivity - MongoDB, Redis, and microservice monitoring

  • Health Status Aggregation - Multi-service health state management

  • Cached Responses - Efficient health check performance optimization

πŸ“Š Resource Metrics Collection

  • CPU Monitoring - Real-time CPU utilization and multi-core tracking

  • Memory Management - Memory usage, availability, and percentage tracking

  • Disk Space Monitoring - Storage utilization and free space alerts

  • Network Metrics - Input/output traffic monitoring and analysis

🌐 DAG Network Monitoring

  • Network Health Tracking - Specialized DAG network status monitoring

  • Event-Driven Updates - Real-time threshold monitoring with events

  • Network Threshold Management - Online/offline status detection

  • Performance Optimization - Efficient network status collection

⚑ Performance Features

  • Response Caching - 1-second caching for optimal performance

  • Error Handling - Comprehensive exception management

  • Resource Optimization - Efficient OS utility integration

  • Multi-core Support - Advanced CPU usage calculations

Module Structure


πŸ”§ API Reference

Core Health Endpoints

All health endpoints are publicly accessible with @Public() decorator.

Health Check Endpoint

GET /health/check

  • Purpose: Comprehensive system health validation

  • Caching: 1-second response caching

  • Monitors: Redis, MongoDB, disk space, memory, DAG network, microservices

System Information Endpoint

GET /health/infos

  • Purpose: Detailed system metrics and resource utilization

  • Caching: 1-second response caching

  • Data: Platform, CPU, memory, disk, network metrics

Health Check Response Schema

System Information Schema

Resource Metrics Tables

CPU Metrics
Type
Description

usage

number

CPU utilization percentage (0-100)

cpus

number

Number of CPU cores

speed

number

CPU clock frequency in MHz

Memory Metrics
Type
Description

totalMemMb

number

Total memory in MB

usedMemMb

number

Used memory in MB

freeMemMb

number

Free memory in MB

usedMemPercentage

number

Memory usage percentage

freeMemPercentage

number

Free memory percentage

Storage Metrics
Type
Description

totalGb

string

Total storage in GB

usedGb

string

Used storage in GB

freeGb

string

Free storage in GB

usedPercentage

string

Storage usage percentage

freePercentage

string

Free storage percentage


πŸ“– Guides

Health Monitoring Setup Guide

Complete guide to setting up comprehensive health monitoring for your application. Comprehensive setup instructions covering health indicator configuration, system monitoring, resource tracking, service health checks, and enterprise-grade health monitoring with real-time alerts and notifications.

DAG Network Monitoring Guide

Learn how to implement and monitor DAG network health with event-driven updates. Advanced monitoring guide covering DAG network connectivity, consensus monitoring, network performance tracking, event-driven health updates, and enterprise-grade network monitoring with automated diagnostics.

Performance Optimization Guide

Best practices for optimizing health monitoring performance and resource usage. Detailed optimization guide covering monitoring efficiency, resource utilization optimization, performance tuning, scalability improvements, and enterprise-grade performance optimization for health monitoring systems.

Alert and Threshold Management Guide

Set up proactive monitoring with alerts and threshold-based notifications. Comprehensive guide for implementing alert systems, threshold configuration, notification management, escalation procedures, and enterprise-grade monitoring with automated alerting and incident response.


🎯 Examples

Comprehensive Health Monitoring Service

DAG Network Monitoring Service

Advanced Redis Configuration Service

Health Metrics Analytics Service


πŸ”— Integration

Required Dependencies

Module Integration

Documentation Generation

Environment Configuration

Integration with HSuite Ecosystem

Performance Considerations

πŸ“Š Caching Strategy

  • 1-Second Caching - Health checks and metrics responses cached for optimal performance

  • Memory Management - Efficient resource metrics collection with OS utilities

  • Event-Driven Updates - DAG network status uses events to reduce polling overhead

πŸ”§ Optimization Features

  • Multi-core CPU Calculations - Advanced CPU usage calculations for multi-core systems

  • Efficient Collection - Optimized OS utility integration for resource monitoring

  • Connection Pooling - Redis connection optimization for health checks

πŸ›‘οΈ Error Handling

  • Comprehensive Exception Management - Proper error types and detailed messages

  • Graceful Degradation - Fallback mechanisms for failed health checks

  • Service Isolation - Individual service failures don't affect overall monitoring


πŸ₯ Enterprise Health Monitoring: Comprehensive system diagnostics with real-time resource tracking and specialized DAG network monitoring.

πŸ“Š Advanced Analytics: Performance analysis, trend calculation, and intelligent recommendations for system optimization.

🌐 DAG Network Integration: Event-driven network monitoring with threshold management and automated status updates.


Built with ❀️ by the HSuite Team Copyright © 2025 HSuite. All rights reserved.

Last updated