diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-29 10:12:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-29 10:12:44 +0300 |
commit | 6a4f265c940d3d0a9aeacf09222920d7d2cc4e45 (patch) | |
tree | 4cf73897e78f8fee50e39edb7d74fa628b6a87da /app/services/prometheus | |
parent | cba453953c1598f83b2ed72bc012b65e0df5b767 (diff) |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'app/services/prometheus')
-rw-r--r-- | app/services/prometheus/proxy_variable_substitution_service.rb | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/app/services/prometheus/proxy_variable_substitution_service.rb b/app/services/prometheus/proxy_variable_substitution_service.rb index aa3a09ba05c..7b98cfc592a 100644 --- a/app/services/prometheus/proxy_variable_substitution_service.rb +++ b/app/services/prometheus/proxy_variable_substitution_service.rb @@ -32,8 +32,8 @@ module Prometheus def validate_variables(_result) return success unless variables - unless variables.is_a?(Array) && variables.size.even? - return error(_('Optional parameter "variables" must be an array of keys and values. Ex: [key1, value1, key2, value2]')) + unless variables.is_a?(ActionController::Parameters) + return error(_('Optional parameter "variables" must be a Hash. Ex: variables[key1]=value1')) end success @@ -88,12 +88,7 @@ module Prometheus end def variables_hash - # .each_slice(2) converts ['key1', 'value1', 'key2', 'value2'] into - # [['key1', 'value1'], ['key2', 'value2']] which is then converted into - # a hash by to_h: {'key1' => 'value1', 'key2' => 'value2'} - # to_h will raise an ArgumentError if the number of elements in the original - # array is not even. - variables&.each_slice(2).to_h + variables.to_h end def query(result) |