summaryrefslogtreecommitdiff
path: root/app/models/environment.rb
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-06-16 20:48:34 +0200
committerPawel Chojnacki <pawel@chojnacki.ws>2017-06-16 20:48:34 +0200
commit6e4d5334211d73dd731cb8757b2ef10e8ea428b7 (patch)
treef48f5b8582bd9ff93b8e58182cd5018eda6a82f4 /app/models/environment.rb
parentbe5f665557fc4f5b10d34f407545486746af54b8 (diff)
downloadgitlab-ce-6e4d5334211d73dd731cb8757b2ef10e8ea428b7.tar.gz
Move Prometheus service to project model
Diffstat (limited to 'app/models/environment.rb')
-rw-r--r--app/models/environment.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb
index 62db7e958ab..b391a487b30 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -158,19 +158,15 @@ class Environment < ActiveRecord::Base
end
def has_additional_metrics?
- prometheus_service.present? && available? && last_deployment.present?
+ project.prometheus_service.present? && available? && last_deployment.present?
end
def additional_metrics
if has_additional_metrics?
- prometheus_service.additional_environment_metrics(self)
+ project.prometheus_service.additional_environment_metrics(self)
end
end
- def prometheus_service
- @prometheus_service ||= project.monitoring_services.reorder(nil).find_by(active: true, type: PrometheusService.name)
- 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: