Class: Gitlab::Metrics::Dashboard::ServiceSelector

Inherits:
Object
  • Object
show all
Extended by:
Utils::StrongMemoize
Defined in:
lib/gitlab/metrics/dashboard/service_selector.rb

Constant Summary collapse

SERVICES =
[
  ::Metrics::Dashboard::ClusterMetricsEmbedService,
  ::Metrics::Dashboard::ClusterDashboardService,
  ::Metrics::Dashboard::GitlabAlertEmbedService,
  ::Metrics::Dashboard::CustomMetricEmbedService,
  ::Metrics::Dashboard::GrafanaMetricEmbedService,
  ::Metrics::Dashboard::TransientEmbedService,
  ::Metrics::Dashboard::DynamicEmbedService,
  ::Metrics::Dashboard::DefaultEmbedService,
  ::Metrics::Dashboard::SystemDashboardService,
  ::Metrics::Dashboard::PodDashboardService,
  ::Metrics::Dashboard::SelfMonitoringDashboardService,
  ::Metrics::Dashboard::CustomDashboardService
].freeze

Class Method Summary collapse

Methods included from Utils::StrongMemoize

clear_memoization, strong_memoize, strong_memoized?

Class Method Details

.call(params) ⇒ Gitlab::Metrics::Dashboard::Services::BaseService

Returns a class which inherits from the BaseService class that can be used to obtain a dashboard for the provided params.

Returns:

  • (Gitlab::Metrics::Dashboard::Services::BaseService)

34
35
36
37
38
39
40
# File 'lib/gitlab/metrics/dashboard/service_selector.rb', line 34

def call(params)
  service = services.find do |service_class|
    service_class.valid_params?(params)
  end

  service || default_service
end