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

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_metrics(object_id, metric_type, time_range \\ 300_000)

Gets metrics for an object and metric type within a time range.

Parameters

  • object_id - ID of the object
  • metric_type - Type of metric to retrieve
  • time_range - Time range in milliseconds (default: 5 minutes)

Returns

List of metric entries with timestamps, values, and metadata

get_object_performance(object_id)

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

get_performance_alerts()

Gets all current performance alerts.

Returns

List of active performance alerts with severity levels

get_performance_report(time_range \\ 3_600_000)

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

get_system_metrics()

Gets aggregated system-wide performance metrics.

Returns

Map with system-level performance statistics

handle_telemetry_event(event, measurements, metadata, config)

record_metric(object_id, metric_type, value, metadata \\ %{})

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 object
  • metric_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

set_performance_threshold(metric_type, threshold_config)

Sets performance thresholds for a metric type.

Parameters

  • metric_type - Type of metric to configure
  • threshold_config - Map with :warning, :critical, and :low_warning thresholds

Examples

iex> Object.PerformanceMonitor.set_performance_threshold(:response_time, %{warning: 100, critical: 500})
:ok

start_link(_)

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