diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2018-02-07 03:35:57 +0300 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2018-02-07 03:54:09 +0300 |
commit | 277f7fef2c7369dc9fc8f54f9ad35a2d3086ee2b (patch) | |
tree | 024d6bbfeda59017ac820b8a574bfae647877fb7 /app/models/project_services | |
parent | eac8ad6a454fed1bcbf77a4a7eedd0c5e8123f6f (diff) |
Make prometheus service querying approach much nicer wrt to arity and default function params
Diffstat (limited to 'app/models/project_services')
-rw-r--r-- | app/models/project_services/prometheus_service.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/models/project_services/prometheus_service.rb b/app/models/project_services/prometheus_service.rb index c35e725aa20..e07340d572d 100644 --- a/app/models/project_services/prometheus_service.rb +++ b/app/models/project_services/prometheus_service.rb @@ -91,16 +91,17 @@ class PrometheusService < MonitoringService end def matched_metrics - with_reactive_cache(Gitlab::Prometheus::Queries::MatchedMetricsQuery.name, nil, &:itself) + with_reactive_cache(Gitlab::Prometheus::Queries::MatchedMetricsQuery.name, &:itself) end # Cache metrics for specific environment - def calculate_reactive_cache(query_class_name, environment_id, *args) + def calculate_reactive_cache(query_class_name, *args) return unless active? && project && !project.pending_delete? + environment_id = args.first client = client(environment_id) - data = Kernel.const_get(query_class_name).new(client).query(environment_id, *args) + data = Kernel.const_get(query_class_name).new(client).query(*args) { success: true, data: data, |