Class: Gitlab::Analytics::CycleAnalytics::StageEvents::StageEvent
- Inherits:
-
Object
- Object
- Gitlab::Analytics::CycleAnalytics::StageEvents::StageEvent
- Extended by:
- Utils::Override
- Includes:
- CycleAnalytics::MetricsTables
- Defined in:
- lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb
Overview
Base class for expressing an event that can be used for a stage.
Direct Known Subclasses
CodeStageStart, IssueCreated, IssueDeployedToProduction, MergeRequestCreated, MetricsBasedStageEvent
Class Method Summary collapse
Instance Method Summary collapse
-
#apply_negated_query_customization(query) ⇒ Object
rubocop: disable CodeReuse/ActiveRecord.
-
#apply_query_customization(query) ⇒ Object
Optionally a StageEvent may apply additional filtering or join other tables on the base query.
-
#column_list ⇒ Object
List of columns that are referenced in the ‘timestamp_projection` expression Example timestamp projection: COALESCE(issue_metrics.created_at, issue_metrics.updated_at) Expected column list: issue_metrics.created_at, issue_metrics.updated_at.
- #hash_code ⇒ Object
- #html_description(options = {}) ⇒ Object
-
#include_in(query) ⇒ Object
rubocop: enable CodeReuse/ActiveRecord.
-
#initialize(params) ⇒ StageEvent
constructor
A new instance of StageEvent.
- #object_type ⇒ Object
-
#timestamp_projection ⇒ Object
Each StageEvent must expose a timestamp or a timestamp like expression in order to build a range query.
Methods included from Utils::Override
extended, extensions, included, method_added, override, prepended, queue_verification, verify!
Methods included from CycleAnalytics::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(params) ⇒ StageEvent
Returns a new instance of StageEvent.
14 15 16 |
# File 'lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb', line 14 def initialize(params) @params = params end |
Class Method Details
.identifier ⇒ Object
26 27 28 |
# File 'lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb', line 26 def self.identifier raise NotImplementedError end |
.label_based? ⇒ Boolean
68 69 70 |
# File 'lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb', line 68 def self.label_based? false end |
.name ⇒ Object
18 19 20 |
# File 'lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb', line 18 def self.name raise NotImplementedError end |
Instance Method Details
#apply_negated_query_customization(query) ⇒ Object
rubocop: disable CodeReuse/ActiveRecord
59 60 61 |
# File 'lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb', line 59 def apply_negated_query_customization(query) query.where(.eq(nil)) end |
#apply_query_customization(query) ⇒ Object
Optionally a StageEvent may apply additional filtering or join other tables on the base query.
54 55 56 |
# File 'lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb', line 54 def apply_query_customization(query) query end |
#column_list ⇒ Object
List of columns that are referenced in the ‘timestamp_projection` expression Example timestamp projection: COALESCE(issue_metrics.created_at, issue_metrics.updated_at) Expected column list: issue_metrics.created_at, issue_metrics.updated_at
49 50 51 |
# File 'lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb', line 49 def column_list raise NotImplementedError end |
#hash_code ⇒ Object
34 35 36 |
# File 'lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb', line 34 def hash_code Digest::SHA256.hexdigest(self.class.identifier.to_s) end |
#html_description(options = {}) ⇒ Object
22 23 24 |
# File 'lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb', line 22 def html_description( = {}) self.class.name end |
#include_in(query) ⇒ Object
rubocop: enable CodeReuse/ActiveRecord
64 65 66 |
# File 'lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb', line 64 def include_in(query, **) query end |
#object_type ⇒ Object
30 31 32 |
# File 'lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb', line 30 def object_type raise NotImplementedError end |
#timestamp_projection ⇒ Object
Each StageEvent must expose a timestamp or a timestamp like expression in order to build a range query. Example: get me all the Issue records between start event end end event
40 41 42 43 44 |
# File 'lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb', line 40 def columns = column_list columns.one? ? columns.first : Arel::Nodes::NamedFunction.new('COALESCE', columns) end |