2019-05-01 10:16:03 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module MetricsDashboardHelpers
|
|
|
|
def project_with_dashboard(dashboard_path, dashboard_yml = nil)
|
|
|
|
dashboard_yml ||= fixture_file('lib/gitlab/metrics/dashboard/sample_dashboard.yml')
|
|
|
|
|
|
|
|
create(:project, :custom_repo, files: { dashboard_path => dashboard_yml })
|
|
|
|
end
|
|
|
|
|
|
|
|
def delete_project_dashboard(project, user, dashboard_path)
|
|
|
|
project.repository.delete_file(
|
|
|
|
user,
|
|
|
|
dashboard_path,
|
|
|
|
branch_name: 'master',
|
|
|
|
message: 'Delete dashboard'
|
|
|
|
)
|
|
|
|
|
|
|
|
project.repository.refresh_method_caches([:metrics_dashboard])
|
|
|
|
end
|
|
|
|
|
2020-06-18 15:08:45 +00:00
|
|
|
def load_sample_dashboard
|
2020-06-27 00:09:17 +00:00
|
|
|
load_dashboard_yaml(fixture_file('lib/gitlab/metrics/dashboard/sample_dashboard.yml'))
|
|
|
|
end
|
|
|
|
|
|
|
|
def load_dashboard_yaml(data)
|
|
|
|
::Gitlab::Config::Loader::Yaml.new(data).load_raw!
|
2020-06-18 15:08:45 +00:00
|
|
|
end
|
|
|
|
|
2019-08-07 16:17:35 +00:00
|
|
|
def system_dashboard_path
|
2019-11-27 12:06:30 +00:00
|
|
|
Metrics::Dashboard::SystemDashboardService::DASHBOARD_PATH
|
2019-08-07 16:17:35 +00:00
|
|
|
end
|
|
|
|
|
2019-12-17 12:08:11 +00:00
|
|
|
def pod_dashboard_path
|
|
|
|
Metrics::Dashboard::PodDashboardService::DASHBOARD_PATH
|
|
|
|
end
|
|
|
|
|
2019-08-07 16:17:35 +00:00
|
|
|
def business_metric_title
|
|
|
|
PrometheusMetricEnums.group_details[:business][:group_title]
|
|
|
|
end
|
2020-02-13 15:08:52 +00:00
|
|
|
|
|
|
|
def self_monitoring_dashboard_path
|
|
|
|
Metrics::Dashboard::SelfMonitoringDashboardService::DASHBOARD_PATH
|
|
|
|
end
|
2019-05-01 10:16:03 +00:00
|
|
|
end
|