Class: GitlabInternalEventsCli::Subflows::EventMetricDefiner

Inherits:
Object
  • Object
show all
Includes:
Helpers, Text::MetricDefiner
Defined in:
lib/gitlab_internal_events_cli/subflows/event_metric_definer.rb

Constant Summary

Constants included from Text::MetricDefiner

Text::MetricDefiner::ALL_METRICS_EXIST_NOTICE, Text::MetricDefiner::DATABASE_INSTRUMENTATION_FILES_NEXT_STEPS, Text::MetricDefiner::DATABASE_METRIC_DESCRIPTION_INTRO, Text::MetricDefiner::DATABASE_METRIC_NAME_HELP, Text::MetricDefiner::DESCRIPTION_HELP, Text::MetricDefiner::EVENT_METRIC_DESCRIPTION_INTRO, Text::MetricDefiner::INSTRUMENTATION_CLASS_ERROR, Text::MetricDefiner::INSTRUMENTATION_CLASS_HELP, Text::MetricDefiner::INSTRUMENTATION_CLASS_INTRO, Text::MetricDefiner::NAME_CONFLICT_HELP, Text::MetricDefiner::NAME_ERROR, Text::MetricDefiner::NAME_FILTER_HELP, Text::MetricDefiner::NAME_LENGTH_HELP, Text::MetricDefiner::NAME_REQUIREMENT_REASONS, Text::MetricDefiner::OPERATION_INTRO

Constants included from Helpers::Formatting

Helpers::Formatting::DEFAULT_WINDOW_HEIGHT, Helpers::Formatting::DEFAULT_WINDOW_WIDTH

Constants included from Helpers

Helpers::NAME_REGEX

Constants included from Helpers::Files

Helpers::Files::MAX_FILENAME_LENGTH

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Formatting

#clear_format, #counter, #divider, #format_error, #format_heading, #format_help, #format_info, #format_prefix, #format_prompt, #format_selection, #format_subheader, #format_warning, #progress_bar

Methods included from Helpers

#feedback_notice, #milestone, #new_page!

Methods included from Helpers::ServicePingDashboards

#metric_exploration_group_path, #metric_trend_path

Methods included from Helpers::MetricOptions

#get_metric_options

Methods included from Helpers::EventOptions

#events_by_filepath, #generate_ai_event_suggestion, #generate_python_advice, #get_event_options

Methods included from Helpers::GroupOwnership

#find_categories, #find_section, #find_stage, #known_categories, #prompt_for_feature_categories, #prompt_for_group_ownership

Methods included from Helpers::Files

#absolute_path, #file_saved_message, #prompt_to_save_file, #write_to_file

Methods included from Helpers::CliInputs

#disableable_option, #disabled_format_callback, #filter_opts, #format_disabled_options_as_dividers, #input_optional_text, #input_opts, #input_required_text, #multiselect_opts, #prompt_for_array_selection, #prompt_for_text, #select_option_divider, #select_opts, #yes_no_opts

Constructor Details

#initialize(cli, selected_event_paths, type) ⇒ EventMetricDefiner

Returns a new instance of EventMetricDefiner.



11
12
13
14
15
16
17
# File 'lib/gitlab_internal_events_cli/subflows/event_metric_definer.rb', line 11

def initialize(cli, selected_event_paths, type)
  @cli = cli
  @metric = nil
  @selected_event_paths = selected_event_paths
  @selected_filters = {}
  @type = type
end

Instance Attribute Details

#metricObject (readonly)

Returns the value of attribute metric.



9
10
11
# File 'lib/gitlab_internal_events_cli/subflows/event_metric_definer.rb', line 9

def metric
  @metric
end

#selected_event_pathsObject (readonly)

Returns the value of attribute selected_event_paths.



9
10
11
# File 'lib/gitlab_internal_events_cli/subflows/event_metric_definer.rb', line 9

def selected_event_paths
  @selected_event_paths
end

#selected_filtersObject (readonly)

Returns the value of attribute selected_filters.



9
10
11
# File 'lib/gitlab_internal_events_cli/subflows/event_metric_definer.rb', line 9

def selected_filters
  @selected_filters
end

Instance Method Details

#runObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/gitlab_internal_events_cli/subflows/event_metric_definer.rb', line 19

def run
  prompt_for_events

  return unless @selected_event_paths.any?

  prompt_for_metrics

  return unless metric

  metric.data_source = 'internal_events'
  prompt_for_event_filters
end