diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 12:09:34 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 12:09:34 +0000 |
commit | 903ccf7c93eb9490c76857bffe744249cc07de09 (patch) | |
tree | 603a3162e91999160e4efc74f351f9405f422d61 /lib | |
parent | 41cb558299b483b44b45351730ee4c0e9fe4ca2c (diff) | |
download | gitlab-ce-903ccf7c93eb9490c76857bffe744249cc07de09.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/project_template.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/prometheus/queries/validate_query.rb | 21 |
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/gitlab/project_template.rb b/lib/gitlab/project_template.rb index 9ed6a23632c..f9a226be3cf 100644 --- a/lib/gitlab/project_template.rb +++ b/lib/gitlab/project_template.rb @@ -74,3 +74,5 @@ module Gitlab end end end + +Gitlab::ProjectTemplate.prepend_if_ee('EE::Gitlab::ProjectTemplate') diff --git a/lib/gitlab/prometheus/queries/validate_query.rb b/lib/gitlab/prometheus/queries/validate_query.rb new file mode 100644 index 00000000000..1f55f3e9768 --- /dev/null +++ b/lib/gitlab/prometheus/queries/validate_query.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Gitlab + module Prometheus + module Queries + class ValidateQuery < BaseQuery + def query(query) + client_query(query) + { valid: true } + rescue Gitlab::PrometheusClient::QueryError, Gitlab::HTTP::BlockedUrlError => ex + { valid: false, error: ex.message } + end + + def self.transform_reactive_result(result) + result[:query] = result.delete :data + result + end + end + end + end +end |