Commit f78fd3de authored by Pawel Chojnacki's avatar Pawel Chojnacki

Fix Additional metrics filtering

+ remove test button that was leftover after a bad merge
parent 6eb96b20
......@@ -72,7 +72,11 @@ class PrometheusService < MonitoringService
end
def matched_metrics
additional_deployment_metrics(Gitlab::Prometheus::Queries::MatchedMetricsQuery.name, &:itself)
with_reactive_cache(Gitlab::Prometheus::Queries::MatchedMetricsQuery.name, &:itself)
end
def with_reactive_cache(*args, &block)
yield calculate_reactive_cache(*args)
end
# Cache metrics for specific environment
......
......@@ -22,7 +22,6 @@
- disabled_class = 'disabled'
- disabled_title = @service.disabled_title
= link_to 'Test settings', test_namespace_project_service_path(@project.namespace, @project, @service), class: "btn #{disabled_class}", title: disabled_title
= link_to 'Cancel', namespace_project_settings_integrations_path(@project.namespace, @project), class: 'btn btn-cancel'
- if lookup_context.template_exists?('show', "projects/services/#{@service.to_param}", true)
......
......@@ -4,7 +4,7 @@ module Gitlab
extend self
def load_groups_from_yaml
additional_metrics_raw.map(&method(:new))
additional_metrics_raw.map(&method(:group_from_entry))
end
private
......@@ -25,7 +25,7 @@ module Gitlab
raise ParsingError.new("entry missing required fields #{missing_fields}") unless missing_fields.empty?
group = MetricGroup.new(entry[:group], entry[:priority])
group.tap { |g| g.metrics = Metric.metrics_from_list(entry[:metrics]) }
group.tap { |g| g.metrics = metrics_from_list(entry[:metrics]) }
end
def additional_metrics_raw
......
......@@ -4,7 +4,7 @@ module Gitlab
attr_reader :priority, :name
attr_accessor :metrics
def initialize(name:, priority:, metrics: [])
def initialize(name, priority, metrics = [])
@name = name
@priority = priority
@metrics = metrics
......
......@@ -37,7 +37,7 @@ module Gitlab
def query_with_result(query)
query[:result]&.any? do |item|
item&.[](:values)&.any? || item&.[](:value)&.any?
item&.[]('values')&.any? || item&.[]('value')&.any?
end
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