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>2017-05-25 18:39:43 +0300
committerPawel Chojnacki <pawel@chojnacki.ws>2017-05-25 18:39:43 +0300
commit608186d54bb9aefb0b867c177ac62d534e8840ad (patch)
treec3ccf45692edd2b73dc9bdbfcf53500cce7532b0 /app/models/deployment.rb
parent4d8f3978a254f33d959de65dbf7b20a1d41a058d (diff)
Add per deployment additional metrics
Diffstat (limited to 'app/models/deployment.rb')
-rw-r--r--app/models/deployment.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb
index 216cec751e3..f49410f18ae 100644
--- a/app/models/deployment.rb
+++ b/app/models/deployment.rb
@@ -103,12 +103,22 @@ class Deployment < ActiveRecord::Base
project.monitoring_service.present?
end
+ def has_additional_metrics?
+ has_metrics? && project.monitoring_service&.respond_to?(:reactive_query)
+ end
+
def metrics
return {} unless has_metrics?
project.monitoring_service.deployment_metrics(self)
end
+ def additional_metrics
+ return {} unless has_additional_metrics?
+ metrics = project.monitoring_service.reactive_query(Gitlab::Prometheus::Queries::AdditionalMetricsDeploymentQuery.name, id, &:itself)
+ metrics&.merge(deployment_time: created_at.to_i) || {}
+ end
+
private
def ref_path