Object.PerformanceMonitor (object v0.1.2)
Real-time performance monitoring and metrics collection for the AAOS system. Uses telemetry and ETS for high-performance metrics aggregation.
Summary
Functions
Returns a specification to start this module under a supervisor.
Gets metrics for an object and metric type within a time range.
Gets comprehensive performance analysis for a specific object.
Gets all current performance alerts.
Generates a comprehensive performance report.
Gets aggregated system-wide performance metrics.
Records a performance metric for an object.
Sets performance thresholds for a metric type.
Starts the performance monitor GenServer.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Gets metrics for an object and metric type within a time range.
Parameters
object_id
- ID of the objectmetric_type
- Type of metric to retrievetime_range
- Time range in milliseconds (default: 5 minutes)
Returns
List of metric entries with timestamps, values, and metadata
Gets comprehensive performance analysis for a specific object.
Parameters
object_id
- ID of the object to analyze
Returns
Map with overall performance score, detailed metrics, and analysis
Gets all current performance alerts.
Returns
List of active performance alerts with severity levels
Generates a comprehensive performance report.
Parameters
time_range
- Time range for the report in milliseconds (default: 1 hour)
Returns
Map with detailed performance analysis, summaries, and recommendations
Gets aggregated system-wide performance metrics.
Returns
Map with system-level performance statistics
Records a performance metric for an object.
High-performance metric recording using ETS tables. Automatically checks for performance alerts based on configured thresholds.
Parameters
object_id
- ID of the objectmetric_type
- Type of metric (atom)value
- Metric value (number)metadata
- Additional metadata (default: %{})
Examples
iex> Object.PerformanceMonitor.record_metric("obj1", :response_time, 50.0)
:ok
Sets performance thresholds for a metric type.
Parameters
metric_type
- Type of metric to configurethreshold_config
- Map with :warning, :critical, and :low_warning thresholds
Examples
iex> Object.PerformanceMonitor.set_performance_threshold(:response_time, %{warning: 100, critical: 500})
:ok
Starts the performance monitor GenServer.
Initializes ETS tables for high-performance metrics storage, sets up telemetry handlers, and starts periodic aggregation tasks.
Returns
{:ok, pid}
- Successfully started performance monitor