Raxol.Terminal.Metrics.Manager (Raxol v0.5.0)

View Source

Manages terminal metrics and statistics collection, including performance metrics, usage statistics, and error tracking.

Summary

Functions

Gets the average characters processed per second.

Gets the average commands processed per second.

Gets a custom metric value.

Gets the error log.

Gets the error rate (errors per second).

Gets the current performance metrics.

Gets the uptime in milliseconds.

Gets the current usage statistics.

Creates a new metrics manager instance.

Records the processing of characters.

Records the processing of a command.

Resets all metrics to their initial state.

Adds or updates a custom metric.

Updates performance metrics.

Updates usage statistics.

Types

custom_metrics()

@type custom_metrics() :: %{required(String.t()) => any()}

error_log()

@type error_log() :: %{
  timestamp: DateTime.t(),
  error_type: String.t(),
  message: String.t(),
  context: map()
}

performance_metrics()

@type performance_metrics() :: %{
  processing_time: non_neg_integer(),
  average_latency: float(),
  peak_memory: non_neg_integer(),
  buffer_usage: float()
}

t()

@type t() :: %Raxol.Terminal.Metrics.Manager{
  characters_processed: non_neg_integer(),
  commands_processed: non_neg_integer(),
  custom_metrics: custom_metrics(),
  error_log: [error_log()],
  errors_encountered: non_neg_integer(),
  last_update: DateTime.t(),
  performance_metrics: performance_metrics(),
  start_time: DateTime.t(),
  usage_stats: usage_stats()
}

usage_stats()

@type usage_stats() :: %{
  active_time: non_neg_integer(),
  idle_time: non_neg_integer(),
  command_frequency: %{required(String.t()) => non_neg_integer()},
  feature_usage: %{required(String.t()) => non_neg_integer()}
}

Functions

get_characters_per_second(manager)

Gets the average characters processed per second.

get_commands_per_second(manager)

Gets the average commands processed per second.

get_custom_metric(manager, key)

Gets a custom metric value.

get_error_log(manager)

Gets the error log.

get_error_rate(manager)

Gets the error rate (errors per second).

get_performance_metrics(manager)

Gets the current performance metrics.

get_uptime(manager)

Gets the uptime in milliseconds.

get_usage_stats(manager)

Gets the current usage statistics.

new()

Creates a new metrics manager instance.

record_characters(manager, count)

Records the processing of characters.

record_command(manager, command)

Records the processing of a command.

record_error(manager, error_type, message, context \\ %{})

Records an error occurrence.

record_feature_usage(manager, feature)

Records feature usage.

reset(manager)

Resets all metrics to their initial state.

set_custom_metric(manager, key, value)

Adds or updates a custom metric.

update_performance_metrics(manager, metrics)

Updates performance metrics.

update_usage_stats(manager, stats)

Updates usage statistics.