debian-mirror-gitlab/lib/gitlab/prometheus/queries/additional_metrics_deployment_query.rb
2018-03-17 18:26:18 +05:30

21 lines
603 B
Ruby

module Gitlab
module Prometheus
module Queries
class AdditionalMetricsDeploymentQuery < BaseQuery
include QueryAdditionalMetrics
def query(environment_id, deployment_id)
Deployment.find_by(id: deployment_id).try do |deployment|
query_metrics(
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