Raxol.Terminal.Metrics.UnifiedMetrics (Raxol v0.5.0)
View SourceUnified metrics system for the Raxol terminal emulator. This module provides centralized metrics collection for:
- Performance metrics (response times, throughput)
- Resource usage (memory, CPU)
- Error tracking
- Usage statistics
Summary
Functions
Returns a specification to start this module under a supervisor.
Cleans up old metrics.
Exports metrics in the configured format.
Gets error statistics.
Gets the current value of a metric.
Records an error event.
Records a metric value.
Starts the unified metrics manager.
Types
@type metric_config() :: %{ retention_period: non_neg_integer(), aggregation_interval: non_neg_integer(), alert_thresholds: map(), export_format: :prometheus | :json | :custom }
@type metric_id() :: term()
@type metric_state() :: %{ id: metric_id(), type: metric_type(), value: metric_value(), timestamp: integer(), labels: map(), metadata: map() }
@type metric_type() :: :counter | :gauge | :histogram | :summary
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Cleans up old metrics.
Parameters
opts
- Cleanup options:before
- Timestamp before which to clean up
Exports metrics in the configured format.
Parameters
opts
- Export options:format
- Override the default export format:time_range
- Time range to export
Gets error statistics.
Parameters
opts
- Get options:time_range
- Time range to query:severity
- Filter by severity
Gets the current value of a metric.
Parameters
name
- The metric nameopts
- Get options:labels
- Filter by labels:time_range
- Time range to query
Records an error event.
Parameters
error
- The error to recordopts
- Recording options:severity
- Error severity:context
- Error context:metadata
- Additional metadata
Records a metric value.
Parameters
name
- The metric namevalue
- The metric valueopts
- Recording options:type
- Metric type (:counter, :gauge, :histogram, :summary):labels
- Metric labels:metadata
- Additional metadata
Starts the unified metrics manager.
Options
:retention_period
- How long to keep metrics (in milliseconds):aggregation_interval
- How often to aggregate metrics (in milliseconds):alert_thresholds
- Thresholds for alerting:export_format
- Format for exporting metrics