Class: Gitlab::CycleAnalytics::BaseEventFetcher

Inherits:
Object
  • Object
show all
Includes:
BaseQuery, GroupProjectsProvider
Defined in:
lib/gitlab/cycle_analytics/base_event_fetcher.rb

Constant Summary collapse

MAX_EVENTS =
50

Constants included from Database::Median

Database::Median::NotSupportedError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GroupProjectsProvider

#group, #project, #projects

Methods included from Database::DateTime

#subtract_datetimes, #subtract_datetimes_diff

Methods included from Database::Median

#extract_median, #extract_medians, #median_datetime, #median_datetimes, #pg_median_datetime_sql

Methods included from MetricsTables

#build_table, #issue_metrics_table, #issue_table, #mr_closing_issues_table, #mr_diff_commits_table, #mr_diff_table, #mr_metrics_table, #mr_table, #projects_table, #routes_table, #user_table

Constructor Details

#initialize(stage:, options:) ⇒ BaseEventFetcher

Returns a new instance of BaseEventFetcher.


13
14
15
16
# File 'lib/gitlab/cycle_analytics/base_event_fetcher.rb', line 13

def initialize(stage:, options:)
  @stage = stage
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options


9
10
11
# File 'lib/gitlab/cycle_analytics/base_event_fetcher.rb', line 9

def options
  @options
end

#projectionsObject (readonly)

Returns the value of attribute projections


9
10
11
# File 'lib/gitlab/cycle_analytics/base_event_fetcher.rb', line 9

def projections
  @projections
end

#queryObject (readonly)

Returns the value of attribute query


9
10
11
# File 'lib/gitlab/cycle_analytics/base_event_fetcher.rb', line 9

def query
  @query
end

#stageObject (readonly)

Returns the value of attribute stage


9
10
11
# File 'lib/gitlab/cycle_analytics/base_event_fetcher.rb', line 9

def stage
  @stage
end

Instance Method Details

#fetchObject


18
19
20
21
22
23
24
# File 'lib/gitlab/cycle_analytics/base_event_fetcher.rb', line 18

def fetch
  update_author!

  event_result.map do |event|
    serialize(event) if has_permission?(event['id'])
  end.compact
end

#orderObject


26
27
28
# File 'lib/gitlab/cycle_analytics/base_event_fetcher.rb', line 26

def order
  @order || default_order
end