diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /app/services/clusters/applications/prometheus_config_service.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'app/services/clusters/applications/prometheus_config_service.rb')
-rw-r--r-- | app/services/clusters/applications/prometheus_config_service.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/services/clusters/applications/prometheus_config_service.rb b/app/services/clusters/applications/prometheus_config_service.rb index 34d44ab881e..50c4e26b0d0 100644 --- a/app/services/clusters/applications/prometheus_config_service.rb +++ b/app/services/clusters/applications/prometheus_config_service.rb @@ -132,19 +132,21 @@ module Clusters end def alerts(environment) - variables = Gitlab::Prometheus::QueryVariables.call(environment) alerts = Projects::Prometheus::AlertsFinder .new(environment: environment) .execute alerts.map do |alert| - substitute_query_variables(alert.to_param, variables) + hash = alert.to_param + hash['expr'] = substitute_query_variables(hash['expr'], environment) + hash end end - def substitute_query_variables(hash, variables) - hash['expr'] %= variables - hash + def substitute_query_variables(query, environment) + result = ::Prometheus::ProxyVariableSubstitutionService.new(environment, query: query).execute + + result[:params][:query] end def environments |