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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2018-03-01 20:14:54 +0300
committerPawel Chojnacki <pawel@chojnacki.ws>2018-03-01 20:33:49 +0300
commit8ad9cd5581dafeb7a24da7ed119a30761a0a72fe (patch)
tree8a9796c20ca958738ba74ec008383dc5fc787a18 /app/models/environment.rb
parent2c090539f2dbdbc11c18598c7952a5de497047ea (diff)
Implement PrometheusDeploymentLocator + fix metrics controller
Diffstat (limited to 'app/models/environment.rb')
-rw-r--r--app/models/environment.rb23
1 files changed, 2 insertions, 21 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb
index 57960a7c3b3..baba023c92d 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -1,4 +1,6 @@
class Environment < ActiveRecord::Base
+ include PrometheusAdapterLocator
+
# Used to generate random suffixes for the slug
LETTERS = 'a'..'z'
NUMBERS = '0'..'9'
@@ -224,27 +226,6 @@ class Environment < ActiveRecord::Base
project.deployment_platform
end
- def prometheus_adapter
- @prometheus_adapter ||= if service_prometheus_adapter.can_query?
- service_prometheus_adapter
- else
- cluster_prometheus_adapter
- end
- end
-
- def service_prometheus_adapter
- project.find_or_initialize_service('prometheus')
- end
-
- def cluster_prometheus_adapter
- return unless deployment_platform.respond_to?(:cluster)
-
- cluster = deployment_platform.cluster
- return unless cluster.application_prometheus&.installed?
-
- cluster.application_prometheus
- end
-
private
# Slugifying a name may remove the uniqueness guarantee afforded by it being