summaryrefslogtreecommitdiff
path: root/app/models/environment.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/models/environment.rb
parenta5db7f54252d22e3ecd49786a3fdff7c46658fa3 (diff)
downloadgitlab-ce-55f2a5debcf10a4d3ca1d0e53fe06f38bc0b77a9.tar.gz
Added Prometheus Service and Prometheus graphs
Diffstat (limited to 'app/models/environment.rb')
-rw-r--r--app/models/environment.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb
index 1a21b5e52b5..bf33010fd21 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -145,6 +145,14 @@ class Environment < ActiveRecord::Base
project.deployment_service.terminals(self) if has_terminals?
end
+ def has_metrics?
+ project.monitoring_service.present? && available? && last_deployment.present?
+ end
+
+ def metrics
+ project.monitoring_service.metrics(self) if has_metrics?
+ end
+
# An environment name is not necessarily suitable for use in URLs, DNS
# or other third-party contexts, so provide a slugified version. A slug has
# the following properties: