diff options
Diffstat (limited to 'app/services/metrics/dashboard/base_service.rb')
-rw-r--r-- | app/services/metrics/dashboard/base_service.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/app/services/metrics/dashboard/base_service.rb b/app/services/metrics/dashboard/base_service.rb index c2a0f22e73e..5fa127d64b2 100644 --- a/app/services/metrics/dashboard/base_service.rb +++ b/app/services/metrics/dashboard/base_service.rb @@ -10,7 +10,8 @@ module Metrics STAGES = ::Gitlab::Metrics::Dashboard::Stages SEQUENCE = [ STAGES::CommonMetricsInserter, - STAGES::EndpointInserter, + STAGES::MetricEndpointInserter, + STAGES::VariableEndpointInserter, STAGES::PanelIdsInserter, STAGES::Sorter, STAGES::AlertsInserter, @@ -36,6 +37,14 @@ module Metrics Gitlab::Metrics::Dashboard::Cache.fetch(cache_key) { get_raw_dashboard } end + # Should return true if this dashboard service is for an out-of-the-box + # dashboard. + # This method is overridden in app/services/metrics/dashboard/predefined_dashboard_service.rb. + # @return Boolean + def self.out_of_the_box_dashboard? + false + end + private # Determines whether users should be able to view @@ -83,6 +92,17 @@ module Metrics params[:dashboard_path] end + def load_yaml(data) + ::Gitlab::Config::Loader::Yaml.new(data).load_raw! + rescue Gitlab::Config::Loader::Yaml::NotHashError + # Raise more informative error in app/models/performance_monitoring/prometheus_dashboard.rb. + {} + rescue Gitlab::Config::Loader::Yaml::DataTooLargeError => exception + raise Gitlab::Metrics::Dashboard::Errors::LayoutError, exception.message + rescue Gitlab::Config::Loader::FormatError + raise Gitlab::Metrics::Dashboard::Errors::LayoutError, _('Invalid yaml') + end + # @return [Hash] an unmodified dashboard def get_raw_dashboard raise NotImplementedError |