Class: Metrics::Dashboard::PanelPreviewService
- Inherits:
-
Object
- Object
- Metrics::Dashboard::PanelPreviewService
- Defined in:
- app/services/metrics/dashboard/panel_preview_service.rb
Constant Summary collapse
- SEQUENCE =
[ ::Gitlab::Metrics::Dashboard::Stages::CommonMetricsInserter, ::Gitlab::Metrics::Dashboard::Stages::MetricEndpointInserter, ::Gitlab::Metrics::Dashboard::Stages::PanelIdsInserter, ::Gitlab::Metrics::Dashboard::Stages::AlertsInserter, ::Gitlab::Metrics::Dashboard::Stages::UrlValidator ].freeze
- HANDLED_PROCESSING_ERRORS =
[ Gitlab::Metrics::Dashboard::Errors::DashboardProcessingError, Gitlab::Config::Loader::Yaml::NotHashError, Gitlab::Config::Loader::Yaml::DataTooLargeError, Gitlab::Config::Loader::FormatError ].freeze
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project, panel_yaml, environment) ⇒ PanelPreviewService
constructor
A new instance of PanelPreviewService.
Constructor Details
#initialize(project, panel_yaml, environment) ⇒ PanelPreviewService
Returns a new instance of PanelPreviewService.
24 25 26 27 28 |
# File 'app/services/metrics/dashboard/panel_preview_service.rb', line 24 def initialize(project, panel_yaml, environment) @project = project @panel_yaml = panel_yaml @environment = environment end |
Instance Method Details
#execute ⇒ Object
30 31 32 33 34 35 |
# File 'app/services/metrics/dashboard/panel_preview_service.rb', line 30 def execute dashboard = ::Gitlab::Metrics::Dashboard::Processor.new(project, dashboard_structure, SEQUENCE, environment: environment).process ServiceResponse.success(payload: dashboard[:panel_groups][0][:panels][0]) rescue *HANDLED_PROCESSING_ERRORS => error ServiceResponse.error(message: error.) end |