Module: Metrics::Dashboard::PrometheusApiProxy

Extended by:
ActiveSupport::Concern
Includes:
RenderServiceResults
Included in:
Clusters::ClustersController, Projects::Environments::PrometheusApiController
Defined in:
app/controllers/concerns/metrics/dashboard/prometheus_api_proxy.rb

Instance Method Summary collapse

Methods included from RenderServiceResults

#continue_polling_response, #error_response, #success_response

Instance Method Details

#prometheus_proxyObject


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/concerns/metrics/dashboard/prometheus_api_proxy.rb', line 11

def prometheus_proxy
  variable_substitution_result =
    proxy_variable_substitution_service.new(proxyable, permit_params).execute

  if variable_substitution_result[:status] == :error
    return error_response(variable_substitution_result)
  end

  prometheus_result = Prometheus::ProxyService.new(
    proxyable,
    proxy_method,
    proxy_path,
    variable_substitution_result[:params]
  ).execute

  return continue_polling_response if prometheus_result.nil?
  return error_response(prometheus_result) if prometheus_result[:status] == :error

  success_response(prometheus_result)
end