Class: Karafka::Web::Ui::Models::Metrics::Aggregated

Inherits:
Lib::HashProxy show all
Includes:
Core::Helpers::Time
Defined in:
lib/karafka/web/ui/models/metrics/aggregated.rb

Overview

Materializes the aggregated data and computes the expected diffs out of the snapshots We do some pre-processing to make sure, we do not have bigger gaps and to compensate for reporting drifting

Instance Method Summary collapse

Methods inherited from Lib::HashProxy

#method_missing, #respond_to_missing?, #to_h

Constructor Details

#initialize(aggregated) ⇒ Aggregated

Builds the Web-UI historicals representation that includes deltas

Parameters:

  • aggregated (Hash)

    aggregated historical metrics



40
41
42
43
44
45
46
47
48
# File 'lib/karafka/web/ui/models/metrics/aggregated.rb', line 40

def initialize(aggregated)
  aggregated
    .tap { |historicals| reject_drifters(historicals) }
    .tap { |historicals| fill_gaps(historicals) }
    .then { |historicals| enrich_with_deltas(historicals) }
    .tap { |historicals| enrich_with_batch_size(historicals) }
    .tap { |historicals| enrich_with_process_rss(historicals) }
    .then { |enriched| super(enriched) }
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Karafka::Web::Ui::Lib::HashProxy

Instance Method Details

#sufficient?Boolean

Returns do we have enough data to draw any basic charts.

Returns:

  • (Boolean)

    do we have enough data to draw any basic charts



51
52
53
# File 'lib/karafka/web/ui/models/metrics/aggregated.rb', line 51

def sufficient?
  seconds.size > 2
end