Class: Gitlab::Analytics::CycleAnalytics::DataCollector
- Inherits:
-
Object
- Object
- Gitlab::Analytics::CycleAnalytics::DataCollector
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/analytics/cycle_analytics/data_collector.rb
Overview
Arguments:
stage - an instance of CycleAnalytics::Stage
params:
current_user: an instance of User
from: DateTime
to: DateTime
Constant Summary collapse
- MAX_COUNT =
1001
Instance Method Summary collapse
- #average ⇒ Object
- #count ⇒ Object
-
#initialize(stage:, params: {}) ⇒ DataCollector
constructor
A new instance of DataCollector.
- #median ⇒ Object
- #records_fetcher ⇒ Object
Constructor Details
#initialize(stage:, params: {}) ⇒ DataCollector
Returns a new instance of DataCollector.
19 20 21 22 |
# File 'lib/gitlab/analytics/cycle_analytics/data_collector.rb', line 19 def initialize(stage:, params: {}) @stage = stage @params = params end |
Instance Method Details
#average ⇒ Object
44 45 46 47 48 |
# File 'lib/gitlab/analytics/cycle_analytics/data_collector.rb', line 44 def average strong_memoize(:average) do Average.new(stage: stage, query: query, params: params) end end |
#count ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/gitlab/analytics/cycle_analytics/data_collector.rb', line 50 def count strong_memoize(:count) do if use_aggregated_data_collector? aggregated_data_collector.count else limit_count end end end |
#median ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/gitlab/analytics/cycle_analytics/data_collector.rb', line 34 def median strong_memoize(:median) do if use_aggregated_data_collector? aggregated_data_collector.median else Median.new(stage: stage, query: query, params: params) end end end |
#records_fetcher ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/gitlab/analytics/cycle_analytics/data_collector.rb', line 24 def records_fetcher strong_memoize(:records_fetcher) do if use_aggregated_data_collector? aggregated_data_collector.records_fetcher else RecordsFetcher.new(stage: stage, query: query, params: params) end end end |