debian-mirror-gitlab/lib/gitlab/prometheus/queries/additional_metrics_deployment_query.rb

23 lines
621 B
Ruby
Raw Normal View History

2017-09-10 17:25:29 +05:30
module Gitlab
module Prometheus
module Queries
class AdditionalMetricsDeploymentQuery < BaseQuery
include QueryAdditionalMetrics
2018-03-27 19:54:05 +05:30
def query(deployment_id)
2017-09-10 17:25:29 +05:30
Deployment.find_by(id: deployment_id).try do |deployment|
query_metrics(
2018-03-27 19:54:05 +05:30
deployment.project,
2017-09-10 17:25:29 +05:30
common_query_context(
deployment.environment,
timeframe_start: (deployment.created_at - 30.minutes).to_f,
timeframe_end: (deployment.created_at + 30.minutes).to_f
)
)
end
end
end
end
end
end