Commit f7628309 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'rc/cluster_metrics_dashboard_paths' into 'master'

Provide metrics dashboard path to cluster health chart

See merge request gitlab-org/gitlab!17648
parents 09cc6c76 683c7c48
......@@ -27,7 +27,7 @@ module EE
def prometheus_proxy
result = ::Prometheus::ProxyService.new(
clusterable.clusterable,
cluster.cluster,
proxy_method,
proxy_path,
proxy_params
......
......@@ -17,6 +17,7 @@ module EE
{
'clusters-path': clusterable.index_path,
'metrics-endpoint': clusterable.metrics_cluster_path(cluster, format: :json),
'dashboard-endpoint': clusterable.metrics_dashboard_path(cluster),
'documentation-path': help_page_path('administration/monitoring/prometheus/index.md'),
'empty-getting-started-svg-path': image_path('illustrations/monitoring/getting_started.svg'),
'empty-loading-svg-path': image_path('illustrations/monitoring/loading.svg'),
......
......@@ -8,6 +8,10 @@ module EE
raise NotImplementedError
end
def metrics_dashboard_path(cluster)
raise NotImplementedError
end
private
override :multiple_clusters_available?
......
......@@ -16,6 +16,11 @@ module EE
environments_group_cluster_path(clusterable, cluster)
end
override :metrics_dashboard_path
def metrics_dashboard_path(cluster)
metrics_dashboard_group_cluster_path(clusterable, cluster)
end
private
def can_read_cluster_environments?
......
......@@ -8,5 +8,10 @@ module EE
def metrics_cluster_path(cluster, params = {})
metrics_admin_cluster_path(cluster, params)
end
override :metrics_dashboard_path
def metrics_dashboard_path(cluster)
metrics_dashboard_admin_cluster_path(cluster)
end
end
end
......@@ -8,5 +8,10 @@ module EE
def metrics_cluster_path(cluster, params = {})
metrics_project_cluster_path(clusterable, cluster, params)
end
override :metrics_dashboard_path
def metrics_dashboard_path(cluster)
metrics_dashboard_project_cluster_path(clusterable, cluster)
end
end
end
......@@ -78,6 +78,7 @@ describe ClustersHelper do
is_expected.to match(
'clusters-path': clusterable_presenter.index_path,
'metrics-endpoint': clusterable_presenter.metrics_cluster_path(cluster, format: :json),
'dashboard-endpoint': clusterable_presenter.metrics_dashboard_path(cluster),
'documentation-path': help_page_path('administration/monitoring/prometheus/index.md'),
'empty-getting-started-svg-path': match_asset_path('/assets/illustrations/monitoring/getting_started.svg'),
'empty-loading-svg-path': match_asset_path('/assets/illustrations/monitoring/loading.svg'),
......
......@@ -14,4 +14,10 @@ describe InstanceClusterablePresenter do
it { is_expected.to eq(metrics_admin_cluster_path(cluster)) }
end
describe '#metrics_dashboard_path' do
subject { presenter.metrics_dashboard_path(cluster) }
it { is_expected.to eq(metrics_dashboard_admin_cluster_path(cluster)) }
end
end
......@@ -40,4 +40,10 @@ describe GroupClusterablePresenter do
it { is_expected.to be_nil }
end
end
describe '#metrics_dashboard_path' do
subject { presenter.metrics_dashboard_path(cluster) }
it { is_expected.to eq(metrics_dashboard_group_cluster_path(group, cluster)) }
end
end
......@@ -14,4 +14,10 @@ describe ProjectClusterablePresenter do
it { is_expected.to eq(metrics_project_cluster_path(project, cluster)) }
end
describe '#metrics_dashboard_path' do
subject { presenter.metrics_dashboard_path(cluster) }
it { is_expected.to eq(metrics_dashboard_project_cluster_path(project, cluster)) }
end
end
......@@ -95,7 +95,7 @@ shared_examples 'cluster metrics' do
context 'with valid requests' do
before do
allow(Prometheus::ProxyService).to receive(:new)
.with(clusterable, 'GET', 'query', expected_params)
.with(cluster, 'GET', 'query', expected_params)
.and_return(prometheus_proxy_service)
allow(prometheus_proxy_service).to receive(:execute)
......@@ -112,7 +112,7 @@ shared_examples 'cluster metrics' do
get :prometheus_proxy, params: prometheus_proxy_params
expect(Prometheus::ProxyService).to have_received(:new)
.with(clusterable, 'GET', 'query', expected_params)
.with(cluster, 'GET', 'query', expected_params)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq(prometheus_json_body)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment