Class: Gitlab::Analytics::CycleAnalytics::DataCollector

Inherits:
Object
  • Object
show all
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/analytics/cycle_analytics/data_collector.rb

Overview

Arguments:

stage - an instance of CycleAnalytics::ProjectStage or CycleAnalytics::GroupStage
params:
  current_user: an instance of User
  from: DateTime
  to: DateTime

Instance Method Summary collapse

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(stage:, params: {}) ⇒ DataCollector

Returns a new instance of DataCollector.


17
18
19
20
# File 'lib/gitlab/analytics/cycle_analytics/data_collector.rb', line 17

def initialize(stage:, params: {})
  @stage = stage
  @params = params
end

Instance Method Details

#medianObject


28
29
30
31
32
# File 'lib/gitlab/analytics/cycle_analytics/data_collector.rb', line 28

def median
  strong_memoize(:median) do
    Median.new(stage: stage, query: query)
  end
end

#records_fetcherObject


22
23
24
25
26
# File 'lib/gitlab/analytics/cycle_analytics/data_collector.rb', line 22

def records_fetcher
  strong_memoize(:records_fetcher) do
    RecordsFetcher.new(stage: stage, query: query, params: params)
  end
end