Class CacheAnalytics

java.lang.Object
com.loomcache.server.metrics.CacheAnalytics

public class CacheAnalytics extends Object
Comprehensive cache analytics aggregating metrics from all data structures. Provides overview metrics, time-series data, and ranked data structure analytics.

Thread-safe using ReentrantReadWriteLock for read-write coordination.

  • Constructor Details

    • CacheAnalytics

      public CacheAnalytics(io.micrometer.core.instrument.MeterRegistry registry, OperationsTracker operationsTracker, CapacityPlanner capacityPlanner, AccessPatternAnalyzer accessPatternAnalyzer)
      Create a new CacheAnalytics instance.
      Parameters:
      registry - the MeterRegistry
      operationsTracker - the operations tracker
      capacityPlanner - the capacity planner
      accessPatternAnalyzer - the access pattern analyzer
    • CacheAnalytics

      public CacheAnalytics(io.micrometer.core.instrument.MeterRegistry registry, OperationsTracker operationsTracker, CapacityPlanner capacityPlanner, AccessPatternAnalyzer accessPatternAnalyzer, @Nullable DataStructureRegistry dataStructureRegistry)
      Create a new CacheAnalytics instance with live data structure access.
      Parameters:
      registry - the MeterRegistry
      operationsTracker - the operations tracker
      capacityPlanner - the capacity planner
      accessPatternAnalyzer - the access pattern analyzer
      dataStructureRegistry - the live data structure registry, or null if unavailable
  • Method Details

    • getOverview

      public CacheAnalytics.AnalyticsOverview getOverview()
      Get overview metrics aggregated from all sources.
      Returns:
      analytics overview with key metrics
    • getDataStructureBreakdown

      public List<CacheAnalytics.DataStructureMetric> getDataStructureBreakdown()
      Get per-data-structure breakdown metrics.
      Returns:
      list of data structure metrics
    • getTimeSeriesData

      public List<CacheAnalytics.TimeSeriesPoint> getTimeSeriesData(CacheAnalytics.TimeSeriesMetric metric, long durationMs, long intervalMs)
      Collect time series data for a specific metric.
      Parameters:
      metric - the metric type
      durationMs - the duration window in milliseconds
      intervalMs - the interval between points in milliseconds
      Returns:
      list of time series points
    • recordTimeSeriesPoint

      public void recordTimeSeriesPoint(CacheAnalytics.TimeSeriesMetric metric, double value)
      Record a time series data point.
      Parameters:
      metric - the metric type
      value - the metric value
    • getTopN

      Get top N ranked metrics for a given type.
      Parameters:
      metric - the metric type
      n - the number of top results
      Returns:
      list of top N metrics