Welcome to mirror list, hosted at ThFree Co, Russian Federation.

prometheus_controller.rb « projects « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 507468d71023c3a384b38e3cc7183f1df7d67fce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class Projects::PrometheusController < Projects::ApplicationController
  before_action :authorize_read_project!
  before_action :require_prometheus_metrics!

  def active_metrics
    respond_to do |format|
      format.json do
        matched_metrics = project.prometheus_service.matched_metrics || {}

        if matched_metrics.any?
          render json: matched_metrics
        else
          head :no_content
        end
      end
    end
  end

  private

  def require_prometheus_metrics!
    render_404 unless project.prometheus_service.present?
  end
end