Skip to content

feat(protocols): implement protocol health monitoring#181

Open
feyishola wants to merge 1 commit into
MD-Creative-Production:mainfrom
feyishola:feat/health-monitor
Open

feat(protocols): implement protocol health monitoring#181
feyishola wants to merge 1 commit into
MD-Creative-Production:mainfrom
feyishola:feat/health-monitor

Conversation

@feyishola

Copy link
Copy Markdown

closes #152

Protocol Health Monitoring — Implemented

Location: src/modules/protocols/health/


Files Created

File Purpose
interfaces/protocol-health.interface.ts All types: ProtocolStatus, MetricType, MetricThreshold, DTOs, ProtocolAlert, ProtocolHealthSnapshot
protocol-health.service.ts Core logic: metric collection, threshold evaluation, alert lifecycle
protocol-health.controller.ts REST endpoints
protocol-health.module.ts NestJS module
protocol-health.service.spec.ts 19 tests covering all scenarios

REST API (/api/protocols/health)

Method Path Description
POST /register Register a protocol with metric thresholds
POST /metrics Record metric observations for a protocol
GET / Get all protocol health snapshots
GET /alerts Get all active (unresolved) alerts
GET /:protocolId Get a single protocol health snapshot

How It Works

  1. Register a protocol with per‑metric thresholds
    Example: warn when error_rate > 5%, critical when error_rate > 10%; or warn when transaction_count < 10.
    Supports four metric types:

    • transaction_count
    • error_rate
    • response_time_ms
    • active_users
  2. Record metrics → triggers threshold checks

    • When a breach is detected → an alert is generated
    • When the metric recovers → the alert is auto‑resolved
    • Severity escalations (warning → critical) replace the old alert
  3. Protocol status is derived from active alerts:

    • healthy → no alerts
    • degraded → warnings only
    • critical → any critical alert

@mijinummi

Copy link
Copy Markdown
Collaborator

Hello @feyishola , thanks for your contribution, please kindly resolve the conflict, and fix the remaining 1 ci that is failing. Well done for this great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💚 Implement Protocol Health Monitoring

2 participants