PacketFlow.Component.Monitoring (packetflow v0.1.0)
Component monitoring interfaces for health checks and metrics
This module provides:
- Health check interfaces and implementations
- Metrics collection and reporting
- Performance monitoring
- Resource usage tracking
- Alert and notification systems
- Monitoring dashboard data
Summary
Functions
Perform health check for a specific component
Returns a specification to start this module under a supervisor.
Clear alerts for a component
Get current alerts
Get current health status for all components
Get all current metrics
Get metrics for a specific component
Get monitoring dashboard data
Callback implementation for GenServer.init/1
.
Record a metric for a component
Register a component for monitoring
Subscribe to monitoring events for a component
Unregister a component from monitoring
Unsubscribe from monitoring events
Update monitoring configuration
Types
@type health_status() :: :healthy | :unhealthy | :degraded | :unknown
@type metric() :: %{ name: String.t(), type: metric_type(), value: metric_value(), labels: map(), timestamp: integer(), component_id: atom() }
@type metric_type() :: :counter | :gauge | :histogram | :summary
Functions
@spec check_component_health(atom()) :: health_check() | {:error, term()}
Perform health check for a specific component
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec clear_alerts(atom()) :: :ok
Clear alerts for a component
@spec get_alerts() :: map()
Get current alerts
@spec get_all_health_status() :: %{required(atom()) => health_check()}
Get current health status for all components
Get all current metrics
Get metrics for a specific component
@spec get_dashboard_data() :: map()
Get monitoring dashboard data
Callback implementation for GenServer.init/1
.
@spec record_metric(atom(), String.t(), metric_type(), metric_value(), map()) :: :ok
Record a metric for a component
Register a component for monitoring
Subscribe to monitoring events for a component
@spec unregister_component(atom()) :: :ok
Unregister a component from monitoring
Unsubscribe from monitoring events
@spec update_config(monitoring_config()) :: :ok | {:error, term()}
Update monitoring configuration