debian-mirror-gitlab/lib/gitlab/prometheus/queries/validate_query.rb
2020-04-22 19:07:51 +05:30

21 lines
506 B
Ruby

# 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