Commit 6f09f635 authored by Sean McGivern's avatar Sean McGivern

Merge branch '207457-fix-multi-metrics-panels' into 'master'

Protect against nil metric identifier

Closes #207457

See merge request gitlab-org/gitlab!27461
parents e432329a 0cf571fc
......@@ -75,6 +75,7 @@ module Gitlab
def find_metric(metrics, metric)
return unless metrics
return unless metric.identifier
metrics.find { |m| m[:id] == metric.identifier }
end
......
......@@ -74,6 +74,16 @@ describe Gitlab::Metrics::Dashboard::Processor do
expect(actual_metrics_order).to eq expected_metrics_order
end
context 'when the project has multiple metrics in the same group' do
let!(:project_response_metric) { create(:prometheus_metric, project: project, group: :response) }
let!(:project_response_metric_2) { create(:prometheus_metric, project: project, group: :response) }
it 'includes multiple metrics' do
expect(all_metrics).to include get_metric_details(project_response_metric)
expect(all_metrics).to include get_metric_details(project_response_metric_2)
end
end
context 'when the dashboard should not include project metrics' do
let(:sequence) do
[
......
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