2017-06-06 14:07:33 +00:00
|
|
|
module Gitlab
|
|
|
|
module Prometheus
|
|
|
|
module Queries
|
|
|
|
class AdditionalMetricsDeploymentQuery < BaseQuery
|
|
|
|
include QueryAdditionalMetrics
|
2017-05-25 15:39:43 +00:00
|
|
|
|
2018-08-27 15:31:01 +00:00
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2018-02-23 20:33:33 +00:00
|
|
|
def query(deployment_id)
|
2017-06-20 13:53:55 +00:00
|
|
|
Deployment.find_by(id: deployment_id).try do |deployment|
|
2017-08-01 19:51:53 +00:00
|
|
|
query_metrics(
|
2018-02-23 17:58:40 +00:00
|
|
|
deployment.project,
|
2018-06-25 09:57:29 +00:00
|
|
|
deployment.environment,
|
2017-08-01 19:51:53 +00:00
|
|
|
common_query_context(
|
|
|
|
deployment.environment,
|
2017-07-28 21:02:21 +00:00
|
|
|
timeframe_start: (deployment.created_at - 30.minutes).to_f,
|
|
|
|
timeframe_end: (deployment.created_at + 30.minutes).to_f
|
2017-08-01 19:51:53 +00:00
|
|
|
)
|
2017-07-28 21:02:21 +00:00
|
|
|
)
|
2017-06-20 13:53:55 +00:00
|
|
|
end
|
2017-06-06 14:07:33 +00:00
|
|
|
end
|
2018-08-27 15:31:01 +00:00
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2017-06-06 14:07:33 +00:00
|
|
|
end
|
2017-05-25 15:39:43 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|