summaryrefslogtreecommitdiff
path: root/app/controllers/projects/environments_controller.rb
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-03-07 16:57:42 +0000
committerRémy Coutable <remy@rymai.me>2017-03-07 16:57:42 +0000
commit55f2a5debcf10a4d3ca1d0e53fe06f38bc0b77a9 (patch)
tree6ebbdf0f12c5e0d30a3e806284c361b8764d9ccf /app/controllers/projects/environments_controller.rb
parenta5db7f54252d22e3ecd49786a3fdff7c46658fa3 (diff)
downloadgitlab-ce-55f2a5debcf10a4d3ca1d0e53fe06f38bc0b77a9.tar.gz
Added Prometheus Service and Prometheus graphs
Diffstat (limited to 'app/controllers/projects/environments_controller.rb')
-rw-r--r--app/controllers/projects/environments_controller.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb
index fed75396d6e..fa37963dfd4 100644
--- a/app/controllers/projects/environments_controller.rb
+++ b/app/controllers/projects/environments_controller.rb
@@ -5,7 +5,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
before_action :authorize_create_deployment!, only: [:stop]
before_action :authorize_update_environment!, only: [:edit, :update]
before_action :authorize_admin_environment!, only: [:terminal, :terminal_websocket_authorize]
- before_action :environment, only: [:show, :edit, :update, :stop, :terminal, :terminal_websocket_authorize]
+ before_action :environment, only: [:show, :edit, :update, :stop, :terminal, :terminal_websocket_authorize, :metrics]
before_action :verify_api_request!, only: :terminal_websocket_authorize
def index
@@ -109,6 +109,19 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end
end
+ def metrics
+ # Currently, this acts as a hint to load the metrics details into the cache
+ # if they aren't there already
+ @metrics = environment.metrics || {}
+
+ respond_to do |format|
+ format.html
+ format.json do
+ render json: @metrics, status: @metrics.any? ? :ok : :no_content
+ end
+ end
+ end
+
private
def verify_api_request!