Raxol.Terminal.ScreenBuffer.Metrics (Raxol v0.5.0)
View SourceHandles metrics collection and management for the terminal screen buffer. This module provides functions for recording and retrieving various metrics related to screen buffer performance, operations, and resource usage.
Summary
Functions
Collects metrics of a specific type. Returns a map of metric names to their values.
Gets a metric value with optional tags. Returns the metric value if found, nil otherwise.
Gets metrics by type. Returns a map of metric names to their values for the specified type.
Gets the value of a specific metric. Returns the metric value and its associated tags.
Initializes a new metrics struct with default values.
Records a metric with optional tags. Returns a new metrics state with the metric recorded.
Records an operation metric. Returns a new metrics state with the operation metric updated.
Records a performance metric. Returns a new metrics state with the performance metric updated.
Records a resource metric. Returns a new metrics state with the resource metric updated.
Verifies if the given metrics exist in the state. Returns true if all metrics exist, false otherwise.
Types
@type metric_tags() :: map()
@type metric_type() :: :performance | :operation | :resource
@type t() :: %Raxol.Terminal.ScreenBuffer.Metrics{ metrics: %{required(String.t()) => {metric_value(), metric_tags()}}, operation_metrics: %{required(String.t()) => number()}, performance_metrics: %{required(String.t()) => number()}, resource_metrics: %{required(String.t()) => number()} }
Functions
@spec collect(t(), metric_type()) :: %{required(String.t()) => metric_value()}
Collects metrics of a specific type. Returns a map of metric names to their values.
@spec get(t(), String.t(), metric_tags()) :: metric_value() | nil
Gets a metric value with optional tags. Returns the metric value if found, nil otherwise.
@spec get_by_type(t(), metric_type()) :: %{required(String.t()) => metric_value()}
Gets metrics by type. Returns a map of metric names to their values for the specified type.
@spec get_value(t(), String.t()) :: {metric_value(), metric_tags()} | nil
Gets the value of a specific metric. Returns the metric value and its associated tags.
Initializes a new metrics struct with default values.
@spec record(t(), String.t(), metric_value(), metric_tags()) :: t()
Records a metric with optional tags. Returns a new metrics state with the metric recorded.
Records an operation metric. Returns a new metrics state with the operation metric updated.
Records a performance metric. Returns a new metrics state with the performance metric updated.
Records a resource metric. Returns a new metrics state with the resource metric updated.
Verifies if the given metrics exist in the state. Returns true if all metrics exist, false otherwise.