Aggregator

Metrics aggregation utilities for combining metrics from multiple collectors.

Classes

class arshai.observability.metrics.aggregator.MetricsAggregator[source]

Bases: object

Aggregates metrics from multiple collectors.

Example

aggregator = MetricsAggregator()

# Add collectors aggregator.add_collector(“circuit_breaker”, cb.metrics) aggregator.add_collector(“batch_processor”, bp.metrics)

# Get aggregated stats all_stats = aggregator.get_aggregated_stats()

__init__()[source]

Initialize metrics aggregator.

add_collector(name, collector)[source]

Add a metrics collector.

Parameters:
  • name (str) – Name for this collector

  • collector (MetricsCollector) – MetricsCollector instance

remove_collector(name)[source]

Remove a metrics collector.

Parameters:

name (str) – Name of collector to remove

get_aggregated_stats()[source]

Get aggregated statistics from all collectors.

Return type:

Dict[str, Any]

Returns:

Dictionary with stats from all collectors

reset_all()[source]

Reset all collectors.

get_collector(name)[source]

Get a specific collector by name.

Parameters:

name (str) – Collector name

Return type:

Optional[MetricsCollector]

Returns:

MetricsCollector or None if not found