Skip to content
代码片段 群组 项目
提交 97075034 编辑于 作者: Peter Leitzen's avatar Peter Leitzen
浏览文件

Merge branch '397139-metrics-delete-usages-2' into 'master'

Remove MetricEndpointInserter usages

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/127084



Merged-by: default avatarPeter Leitzen <pleitzen@gitlab.com>
Approved-by: default avatarPeter Leitzen <pleitzen@gitlab.com>
Reviewed-by: default avatarRajendra Kadam <rkadam@gitlab.com>
Co-authored-by: default avatarRajendra Kadam <rkadam@gitlab.com>
No related branches found
No related tags found
无相关合并请求
......@@ -10,7 +10,6 @@ class BaseService < ::BaseService
STAGES = ::Gitlab::Metrics::Dashboard::Stages
SEQUENCE = [
STAGES::CommonMetricsInserter,
STAGES::MetricEndpointInserter,
STAGES::VariableEndpointInserter,
STAGES::PanelIdsInserter,
STAGES::TrackPanelType,
......
......@@ -12,7 +12,6 @@ class GitlabAlertEmbedService < ::Metrics::Dashboard::BaseEmbedService
include Gitlab::Utils::StrongMemoize
SEQUENCE = [
STAGES::MetricEndpointInserter,
STAGES::PanelIdsInserter
].freeze
......
......@@ -10,7 +10,6 @@ class PodDashboardService < ::Metrics::Dashboard::PredefinedDashboardService
DASHBOARD_VERSION = '3a91b32f91b2dd3d90275333c0ea3630b3f3f37c4296ede5b5eef59bf523d66b'
SEQUENCE = [
STAGES::MetricEndpointInserter,
STAGES::VariableEndpointInserter,
STAGES::PanelIdsInserter
].freeze
......
......@@ -10,7 +10,6 @@ class PredefinedDashboardService < ::Metrics::Dashboard::BaseService
DASHBOARD_NAME = nil
SEQUENCE = [
STAGES::MetricEndpointInserter,
STAGES::VariableEndpointInserter,
STAGES::PanelIdsInserter
].freeze
......
......@@ -15,7 +15,6 @@ class SystemDashboardService < ::Metrics::Dashboard::PredefinedDashboardService
STAGES::CommonMetricsInserter,
STAGES::CustomMetricsInserter,
STAGES::CustomMetricsDetailsInserter,
STAGES::MetricEndpointInserter,
STAGES::VariableEndpointInserter,
STAGES::PanelIdsInserter
].freeze
......
......@@ -28,11 +28,6 @@ def get_raw_dashboard
invalid_embed_json!(e.message)
end
override :sequence
def sequence
[STAGES::MetricEndpointInserter]
end
override :identifiers
def identifiers
Digest::SHA256.hexdigest(params[:embed_json])
......
......@@ -31,13 +31,6 @@
it_behaves_like 'misconfigured dashboard service response', :unprocessable_entity
end
context 'when the dashboard contains a metric without a query' do
let(:dashboard) { { 'panel_groups' => [{ 'panels' => [{ 'metrics' => [{ 'id' => 'mock' }] }] }] } }
let(:project) { project_with_dashboard(dashboard_path, dashboard.to_yaml) }
it_behaves_like 'misconfigured dashboard service response', :unprocessable_entity
end
context 'when the system dashboard is specified' do
let(:dashboard_path) { system_dashboard_path }
......
......@@ -15,7 +15,6 @@
Gitlab::Metrics::Dashboard::Stages::CommonMetricsInserter,
Gitlab::Metrics::Dashboard::Stages::CustomMetricsInserter,
Gitlab::Metrics::Dashboard::Stages::CustomMetricsDetailsInserter,
Gitlab::Metrics::Dashboard::Stages::MetricEndpointInserter,
Gitlab::Metrics::Dashboard::Stages::PanelIdsInserter,
Gitlab::Metrics::Dashboard::Stages::UrlValidator
]
......@@ -91,8 +90,7 @@
context 'when the dashboard should not include project metrics' do
let(:sequence) do
[
Gitlab::Metrics::Dashboard::Stages::CommonMetricsInserter,
Gitlab::Metrics::Dashboard::Stages::MetricEndpointInserter
Gitlab::Metrics::Dashboard::Stages::CommonMetricsInserter
]
end
......@@ -105,16 +103,6 @@
expect(metrics).to eq %w(metric_b metric_a2 metric_a1)
end
end
context 'when sample_metrics are requested' do
let(:process_params) { [project, dashboard_yml, sequence, { environment: environment, sample_metrics: true }] }
it 'includes a sample metrics path for the prometheus endpoint with each metric' do
expect(all_metrics).to satisfy_all do |metric|
metric[:prometheus_endpoint_path] == sample_metrics_path(metric[:id])
end
end
end
end
context 'when there are no alerts' do
......@@ -153,12 +141,6 @@
it_behaves_like 'errors with message', 'Each "panel" must define an array :metrics'
end
context 'when the dashboard contains a metric which is missing a query' do
let(:dashboard_yml) { { panel_groups: [{ panels: [{ metrics: [{}] }] }] } }
it_behaves_like 'errors with message', 'Each "metric" must define one of :query or :query_range'
end
end
private
......@@ -177,7 +159,6 @@ def get_metric_details(metric)
unit: metric.unit,
label: metric.legend,
metric_id: metric.id,
prometheus_endpoint_path: prometheus_path(metric.query),
edit_path: edit_metric_path(metric)
}
end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册