diff options
-rw-r--r-- | app/services/metrics/dashboard/custom_metric_embed_service.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/app/services/metrics/dashboard/custom_metric_embed_service.rb b/app/services/metrics/dashboard/custom_metric_embed_service.rb index 972e07566df..50f070989fc 100644 --- a/app/services/metrics/dashboard/custom_metric_embed_service.rb +++ b/app/services/metrics/dashboard/custom_metric_embed_service.rb @@ -76,14 +76,16 @@ module Metrics # Metrics which match the provided inputs. # There may be multiple metrics, but they should be # displayed in a single panel/chart. - # @return [Array] + # @return [ActiveRecord::AssociationRelation<PromtheusMetric>] + # rubocop: disable CodeReuse/ActiveRecord def metrics - project.prometheus_metrics.select do |metric| - metric.group == group_key && - metric.title == title && - metric.y_label == y_label - end + project.prometheus_metrics.where( + group: group_key, + title: title, + y_label: y_label + ) end + # rubocop: enable CodeReuse/ActiveRecord # Returns a symbol representing the group that # the dashboard's group title belongs to. |