diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-05-10 11:25:30 +0200 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-05-25 15:05:56 +0200 |
commit | 2061414054ce43aa6d53d1be3f602114e5a336d2 (patch) | |
tree | c32e83fcd76cd279171117f3ff282ef54f5308a2 /app/models/environment.rb | |
parent | 78de1c059ac588df4ba1ef352b28e5b1c6102804 (diff) | |
download | gitlab-ce-2061414054ce43aa6d53d1be3f602114e5a336d2.tar.gz |
Additional metrics initial work, with working metrics listing, but without actoual metrics mesurements
Diffstat (limited to 'app/models/environment.rb')
-rw-r--r-- | app/models/environment.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb index 61572d8d69a..b4a4f74a8d5 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -149,10 +149,18 @@ class Environment < ActiveRecord::Base project.monitoring_service.present? && available? && last_deployment.present? end + def has_additional_metrics? + has_metrics? && project.monitoring_service&.respond_to?(:reactive_query) + end + def metrics project.monitoring_service.environment_metrics(self) if has_metrics? end + def additional_metrics + project.monitoring_service.reactive_query(Gitlab::Prometheus::Queries::AdditionalMetricsQuery, self.id) if has_additional_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: |