Raxol.Core.Metrics.Aggregator (Raxol v2.0.1)

View Source

Metric aggregation system for the Raxol metrics.

This module handles:

  • Metric aggregation by time windows
  • Statistical calculations (mean, median, percentiles)
  • Metric grouping and categorization
  • Aggregation rules and policies
  • Real-time aggregation updates

Summary

Functions

Adds a new aggregation rule.

Calculates an aggregation of values using the specified method.

Returns a specification to start this module under a supervisor.

Clears all aggregations and rules.

Gets aggregated metrics for a specific rule.

Gets all aggregation rules.

Records a metric for aggregation.

Stops the aggregator.

Updates aggregation for a specific rule.

Types

aggregation_rule()

@type aggregation_rule() :: %{
  type: aggregation_type(),
  window: time_window(),
  metric_name: String.t(),
  tags: map(),
  group_by: [String.t()]
}

aggregation_type()

@type aggregation_type() :: :sum | :mean | :median | :min | :max | :percentile

time_window()

@type time_window() :: :minute | :hour | :day | :week | :month

Functions

add_rule(rule)

Adds a new aggregation rule.

calculate_aggregation(values, arg2)

@spec calculate_aggregation([number()], atom() | {:percentile, float()}) :: number()

Calculates an aggregation of values using the specified method.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear()

Clears all aggregations and rules.

get_aggregated_metrics(rule_id)

Gets aggregated metrics for a specific rule.

get_rules()

Gets all aggregation rules.

handle_manager_cast(msg, state)

Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.

record(name, value, tags \\ [])

Records a metric for aggregation.

start_link(init_opts \\ [])

stop(pid \\ __MODULE__)

Stops the aggregator.

update_aggregation(rule_id)

Updates aggregation for a specific rule.