Class: Metrics::Dashboard::PredefinedDashboardService

Inherits:
BaseService show all
Defined in:
app/services/metrics/dashboard/predefined_dashboard_service.rb

Constant Summary collapse

DASHBOARD_PATH =

These constants should be overridden in the inheriting class. For Ex: DASHBOARD_PATH = 'config/prometheus/common_metrics.yml' DASHBOARD_NAME = 'Default'

nil
DASHBOARD_NAME =
nil
SEQUENCE =
[
  STAGES::MetricEndpointInserter,
  STAGES::VariableEndpointInserter,
  STAGES::PanelIdsInserter
].freeze

Constants inherited from BaseService

BaseService::STAGES

Constants included from Gitlab::Metrics::Dashboard::Errors

Gitlab::Metrics::Dashboard::Errors::DashboardProcessingError, Gitlab::Metrics::Dashboard::Errors::LayoutError, Gitlab::Metrics::Dashboard::Errors::MissingIntegrationError, Gitlab::Metrics::Dashboard::Errors::MissingQueryError, Gitlab::Metrics::Dashboard::Errors::NOT_FOUND_ERROR, Gitlab::Metrics::Dashboard::Errors::PanelNotFoundError

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseService

all_dashboard_paths, #get_dashboard

Methods included from Gitlab::Metrics::Dashboard::Errors

#handle_errors, #panels_not_found!

Methods inherited from BaseService

#initialize

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

This class inherits a constructor from BaseService

Class Method Details

.matching_dashboard?(filepath) ⇒ Boolean

Returns:

  • (Boolean)

23
24
25
# File 'app/services/metrics/dashboard/predefined_dashboard_service.rb', line 23

def matching_dashboard?(filepath)
  filepath == self::DASHBOARD_PATH
end

.out_of_the_box_dashboard?Boolean

Returns:

  • (Boolean)

27
28
29
# File 'app/services/metrics/dashboard/predefined_dashboard_service.rb', line 27

def out_of_the_box_dashboard?
  true
end

.valid_params?(params) ⇒ Boolean

Returns:

  • (Boolean)

19
20
21
# File 'app/services/metrics/dashboard/predefined_dashboard_service.rb', line 19

def valid_params?(params)
  matching_dashboard?(params[:dashboard_path])
end

Instance Method Details

#raw_dashboardObject

Returns an un-processed dashboard from the cache.


33
34
35
# File 'app/services/metrics/dashboard/predefined_dashboard_service.rb', line 33

def raw_dashboard
  Gitlab::Metrics::Dashboard::Cache.fetch(cache_key) { get_raw_dashboard }
end